refactor: move dispatch block to startGraphAndVideo

This commit is contained in:
sabade-omkar 2023-12-05 00:09:49 +05:30 committed by GitHub
parent db712e31e2
commit 5ada0efd23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -112,9 +112,8 @@ static const char* kVideoQueueLabel = "com.google.mediapipe.example.videoQueue";
withExtension:@"mov"]];
self.videoSource = [[MPPPlayerInputSource alloc] initWithAVAsset:video];
[self.videoSource setDelegate:self queue:self.videoQueue];
dispatch_async(self.videoQueue, ^{
[self startGraphAndVideo];
});
self.noCameraLabel.hidden = YES;
[self startGraphAndVideo];
break;
}
case MediaPipeDemoSourceCamera: {
@ -157,8 +156,9 @@ static const char* kVideoQueueLabel = "com.google.mediapipe.example.videoQueue";
else if (![self.mediapipeGraph waitUntilIdleWithError:&error]) {
NSLog(@"Failed to complete graph initial run: %@", error);
}
[self.videoSource start];
dispatch_async(self.videoQueue, ^{
[self.videoSource start];
});
}
- (void)startGraphAndCamera {