Testing for delegates in different running modes removed from vision task runner.
This commit is contained in:
parent
c81fd19810
commit
d32e63297a
|
@ -51,38 +51,13 @@ static NSString *const kTaskPrefix = @"com.mediapipe.tasks.vision";
|
||||||
runningMode:(MPPRunningMode)runningMode
|
runningMode:(MPPRunningMode)runningMode
|
||||||
packetsCallback:(PacketsCallback)packetsCallback
|
packetsCallback:(PacketsCallback)packetsCallback
|
||||||
error:(NSError **)error {
|
error:(NSError **)error {
|
||||||
switch (runningMode) {
|
|
||||||
case MPPRunningModeImage:
|
if (_runningMode > MPPRunningModeLiveStream) {
|
||||||
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: {
|
|
||||||
[MPPCommonUtils createCustomError:error
|
[MPPCommonUtils createCustomError:error
|
||||||
withCode:MPPTasksErrorCodeInvalidArgumentError
|
withCode:MPPTasksErrorCodeInvalidArgumentError
|
||||||
description:@"Unrecognized running mode"];
|
description:@"Unrecognized running mode"];
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
_runningMode = runningMode;
|
_runningMode = runningMode;
|
||||||
self = [super initWithCalculatorGraphConfig:graphConfig
|
self = [super initWithCalculatorGraphConfig:graphConfig
|
||||||
|
|
Loading…
Reference in New Issue
Block a user