From 1db1c29f5016cafb1934eadf15de2ce8e6241588 Mon Sep 17 00:00:00 2001 From: Prianka Liz Kariat Date: Fri, 5 May 2023 01:04:04 +0530 Subject: [PATCH] Added code comments --- .../ios/vision/object_detector/sources/MPPObjectDetector.mm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mediapipe/tasks/ios/vision/object_detector/sources/MPPObjectDetector.mm b/mediapipe/tasks/ios/vision/object_detector/sources/MPPObjectDetector.mm index 5dfbfdab..6daebcf9 100644 --- a/mediapipe/tasks/ios/vision/object_detector/sources/MPPObjectDetector.mm +++ b/mediapipe/tasks/ios/vision/object_detector/sources/MPPObjectDetector.mm @@ -85,6 +85,11 @@ static NSString *const kTaskName = @"objectDetector"; // Capturing `self` as weak in order to avoid `self` being kept in memory // and cause a retain cycle, after self is set to `nil`. MPPObjectDetector *__weak weakSelf = self; + + // Create a private serial dispatch queue in which the deleagte method will be called + // asynchronously. This is to ensure that if the client performs a long running operation in + // the delegate method, the queue on which the C++ callbacks is invoked is not blocked and is + // freed up to continue with its operations. dispatch_queue_t callbackQueue = dispatch_queue_create([MPPVisionTaskRunner uniqueDispatchQueueNameWithSuffix:kTaskName], NULL); packetsCallback = [=](absl::StatusOr statusOrPackets) {