Updated documentation of MPPTaskRunner

This commit is contained in:
Prianka Liz Kariat 2023-03-03 12:33:17 +05:30
parent fee66069ac
commit 160fa424b5

View File

@ -64,15 +64,23 @@ NS_ASSUME_NONNULL_BEGIN
error:(NSError **)error NS_DESIGNATED_INITIALIZER; error:(NSError **)error NS_DESIGNATED_INITIALIZER;
/** /**
* A synchronous method for processing batch data or offline streaming data. This method is designed * A synchronous method for invoking the C++ task runner for processing batch data or offline
* for processing either batch data such as unrelated images and texts or offline streaming data * streaming data. This method is designed for processing either batch data such as unrelated images
* such as the decoded frames from a video file or audio file. The call blocks the current * and texts or offline streaming data such as the decoded frames from a video file or audio file.
* thread until a failure status or a successful result is returned. If the input packets have no * The call blocks the current thread until a failure status or a successful result is returned. If
* timestamp, an internal timestamp will be assigend per invocation. Otherwise, when the timestamp * the input packets have no timestamp, an internal timestamp will be assigend per invocation.
* is set in the input packets, the caller must ensure that the input packet timestamps are greater * Otherwise, when the timestamp is set in the input packets, the caller must ensure that the input
* than the timestamps of the previous invocation. This method is thread-unsafe and it is the * packet timestamps are greater than the timestamps of the previous invocation. This method is
* caller's responsibility to synchronize access to this method across multiple threads and to * thread-unsafe and it is the caller's responsibility to synchronize access to this method across
* ensure that the input packet timestamps are in order. * multiple threads and to ensure that the input packet timestamps are in order.
*
* @param packetMap A `PacketMap` containing pairs of input stream name and data packet which are to
* be sent to the C++ task runner for processing synchronously.
* @param error Pointer to the memory location where errors if any should be saved. If @c NULL, no
* error will be saved.
*
* @return An optional output `PacketMap` containing pairs of output stream name and data packet
* which holds the results of processing the input packet map, if there are no errors.
*/ */
- (std::optional<mediapipe::tasks::core::PacketMap>) - (std::optional<mediapipe::tasks::core::PacketMap>)
processPacketMap:(const mediapipe::tasks::core::PacketMap &)packetMap processPacketMap:(const mediapipe::tasks::core::PacketMap &)packetMap
@ -84,12 +92,27 @@ NS_ASSUME_NONNULL_BEGIN
* packets. The caller must ensure that the input packet timestamps are monotonically increasing. * packets. The caller must ensure that the input packet timestamps are monotonically increasing.
* This method is thread-unsafe and it is the caller's responsibility to synchronize access to this * This method is thread-unsafe and it is the caller's responsibility to synchronize access to this
* method across multiple threads and to ensure that the input packet timestamps are in order. * method across multiple threads and to ensure that the input packet timestamps are in order.
*
* @param packetMap A `PacketMap` containing pairs of input stream name and data packet that are to
* be sent to the C++ task runner for processing asynchronously.
* @param error Pointer to the memory location where errors if any should be saved. If @c NULL, no
* error will be saved.
*
* @return A `BOOL` indicating if the live stream data was sent to the C++ task runner successfully.
* Please note that any errors during processing of the live stream packet map will only be
* available in the user-defined `packetsCallback` that was provided during initialization of the
* `MPPVisionTaskRunner`.
*/ */
- (BOOL)sendPacketMap:(const mediapipe::tasks::core::PacketMap &)packetMap error:(NSError **)error; - (BOOL)sendPacketMap:(const mediapipe::tasks::core::PacketMap &)packetMap error:(NSError **)error;
/** /**
* Shuts down the C++ task runner. After the runner is closed, any calls that send input data to the * Shuts down the C++ task runner. After the runner is closed, any calls that send input data to the
* runner are illegal and will receive errors. * runner are illegal and will receive errors.
*
* @param error Pointer to the memory location where errors if any should be saved. If @c NULL, no
* error will be saved.
*
* @return A `BOOL` indicating if the C++ task runner was shutdown successfully.
*/ */
- (BOOL)closeWithError:(NSError **)error; - (BOOL)closeWithError:(NSError **)error;