Fixed formatting in MPPImageSegmenter.mm

This commit is contained in:
Prianka Liz Kariat 2023-09-19 20:10:23 +05:30
parent d9d4016334
commit f1a5c8d549

View File

@ -243,17 +243,18 @@ using ::mediapipe::tasks::core::PacketsCallback;
return; return;
} }
// Output packet map is moved to a block variable that will not be deallocated for the lifetime of the `dispatch_async` call. Eventhough masks are not copied, we have to ensure that they are not de allocated before the delegate call completes. // Output packet map is moved to a block variable that will not be deallocated for the lifetime of
// the `dispatch_async` call. Since masks are not copied, this ensures that they are only
// deallocated after the delegate call completes.
__block PacketMap outputPacketMap = std::move(liveStreamResult.value()); __block PacketMap outputPacketMap = std::move(liveStreamResult.value());
if (outputPacketMap[kImageOutStreamName.cppString].IsEmpty()) { if (outputPacketMap[kImageOutStreamName.cppString].IsEmpty()) {
return; return;
} }
dispatch_async(_callbackQueue, ^{ dispatch_async(_callbackQueue, ^{
MPPImageSegmenterResult *result =
MPPImageSegmenterResult *result = [MPPImageSegmenter imageSegmenterResultWithOutputPacketMap:outputPacketMap
[MPPImageSegmenter imageSegmenterResultWithOutputPacketMap:outputPacketMap shouldCopyMaskPacketData:NO];
shouldCopyMaskPacketData:NO];
[self.imageSegmenterLiveStreamDelegate imageSegmenter:self [self.imageSegmenterLiveStreamDelegate imageSegmenter:self
didFinishSegmentationWithResult:result didFinishSegmentationWithResult:result