Added method to send packet map to C++ task runner

This commit is contained in:
Prianka Liz Kariat 2023-03-02 19:34:44 +05:30
parent 6796977a04
commit 87ba86ace2
2 changed files with 15 additions and 0 deletions

View File

@ -74,6 +74,18 @@ NS_ASSUME_NONNULL_BEGIN
*/ */
- (absl::StatusOr<mediapipe::tasks::core::PacketMap>)process: - (absl::StatusOr<mediapipe::tasks::core::PacketMap>)process:
(const mediapipe::tasks::core::PacketMap &)packetMap; (const mediapipe::tasks::core::PacketMap &)packetMap;
- (std::optional<mediapipe::tasks::core::PacketMap>)
processPacketMap:(const mediapipe::tasks::core::PacketMap &)packetMap
error:(NSError **)error;
/**
* An asynchronous method that is designed for handling live streaming data such as live camera. A
* user-defined PacketsCallback function must be provided in the constructor to receive the output
* 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
* method across multiple threads and to ensure that the input packet timestamps are in order.
*/
- (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

View File

@ -52,6 +52,9 @@ using TaskRunnerCpp = ::mediapipe::tasks::core::TaskRunner;
- (absl::StatusOr<PacketMap>)process:(const PacketMap &)packetMap { - (absl::StatusOr<PacketMap>)process:(const PacketMap &)packetMap {
return _cppTaskRunner->Process(packetMap); return _cppTaskRunner->Process(packetMap);
- (BOOL)sendPacketMap:(const PacketMap &)packetMap error:(NSError **)error {
absl::Status sendStatus = _cppTaskRunner->Send(packetMap);
return [MPPCommonUtils checkCppError:sendStatus toError:error];
} }
- (absl::Status)close { - (absl::Status)close {