Updated method to return unique queue names in MPPVisionTaskRunner
This commit is contained in:
parent
37e14a7cad
commit
7797aa932b
|
@ -141,7 +141,19 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
(mediapipe::tasks::core::PacketsCallback)packetsCallback
|
||||
error:(NSError **)error NS_UNAVAILABLE;
|
||||
|
||||
+ (const char *)uniqueQueueNameWithTaskName:(NSString *)taskName;
|
||||
/**
|
||||
* This method returns a unique dispatch queue name by adding the given suffix and a `UUID` to the
|
||||
* pre-defined queue name prefix for vision tasks. The vision tasks can use this method to get
|
||||
* unique dispatch queue names which are consistent with other vision tasks.
|
||||
* Dispatch queue names need not be unique, but for easy debugging we ensure that the queue names
|
||||
* are unique.
|
||||
*
|
||||
* @param suffix A suffix that identifies a dispatch queue's functionality.
|
||||
*
|
||||
* @return A unique dispatch queue name by adding the given suffix and a `UUID` to the pre-defined
|
||||
* queue name prefix for vision tasks.
|
||||
*/
|
||||
+ (const char *)uniqueDispatchQueueNameWithSuffix:(NSString *)suffix;
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
|
|
|
@ -55,10 +55,10 @@ static NSString *const kTaskPrefix = @"com.mediapipe.tasks.vision";
|
|||
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."];
|
||||
[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;
|
||||
|
@ -203,8 +203,9 @@ static NSString *const kTaskPrefix = @"com.mediapipe.tasks.vision";
|
|||
return [self sendPacketMap:packetMap error:error];
|
||||
}
|
||||
|
||||
+ (const char *)uniqueQueueNameWithTaskName:(NSString *)taskName {
|
||||
return [NSString stringWithFormat:@"%@.%@_%@",kTaskPrefix, taskName, [NSString uuidString]].UTF8String;
|
||||
+ (const char *)uniqueDispatchQueueNameWithSuffix:(NSString *)suffix {
|
||||
return [NSString stringWithFormat:@"%@.%@_%@", kTaskPrefix, suffix, [NSString uuidString]]
|
||||
.UTF8String;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in New Issue
Block a user