From d32e63297a0feab50fe27705ebfbc840ea978468 Mon Sep 17 00:00:00 2001 From: Prianka Liz Kariat Date: Fri, 30 Jun 2023 15:34:58 +0530 Subject: [PATCH] Testing for delegates in different running modes removed from vision task runner. --- .../core/sources/MPPVisionTaskRunner.mm | 33 +++---------------- 1 file changed, 4 insertions(+), 29 deletions(-) diff --git a/mediapipe/tasks/ios/vision/core/sources/MPPVisionTaskRunner.mm b/mediapipe/tasks/ios/vision/core/sources/MPPVisionTaskRunner.mm index cba8a63ff..6f17e7965 100644 --- a/mediapipe/tasks/ios/vision/core/sources/MPPVisionTaskRunner.mm +++ b/mediapipe/tasks/ios/vision/core/sources/MPPVisionTaskRunner.mm @@ -51,39 +51,14 @@ static NSString *const kTaskPrefix = @"com.mediapipe.tasks.vision"; runningMode:(MPPRunningMode)runningMode packetsCallback:(PacketsCallback)packetsCallback error:(NSError **)error { - switch (runningMode) { - case MPPRunningModeImage: - case MPPRunningModeVideo: { - if (packetsCallback) { - [MPPCommonUtils createCustomError:error - withCode:MPPTasksErrorCodeInvalidArgumentError - description:@"The vision task is in image or video mode. The " - @"delegate must not be set in the task's options."]; - return nil; - } - break; - } - case MPPRunningModeLiveStream: { - if (!packetsCallback) { - [MPPCommonUtils - createCustomError:error - withCode:MPPTasksErrorCodeInvalidArgumentError - description: - @"The vision task is in live stream mode. An object must be set as the " - @"delegate of the task in its options to ensure asynchronous delivery of " - @"results."]; - return nil; - } - break; - } - default: { + + if (_runningMode > MPPRunningModeLiveStream) { [MPPCommonUtils createCustomError:error withCode:MPPTasksErrorCodeInvalidArgumentError description:@"Unrecognized running mode"]; return nil; - } - } - + } + _runningMode = runningMode; self = [super initWithCalculatorGraphConfig:graphConfig packetsCallback:packetsCallback