We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents b3cd244 + 35a2f2f commit 8c27cebCopy full SHA for 8c27ceb
modules/videoio/src/cap_avfoundation_mac.mm
@@ -694,7 +694,15 @@ -(int) updateImage {
694
return;
695
}
696
697
- mAssetTrack = [[mAsset tracksWithMediaType: AVMediaTypeVideo][0] retain];
+ NSArray *tracks = [mAsset tracksWithMediaType:AVMediaTypeVideo];
698
+ if ([tracks count] == 0) {
699
+ fprintf(stderr, "OpenCV: Couldn't read video stream from file \"%s\"\n", filename);
700
+ [localpool drain];
701
+ started = 0;
702
+ return;
703
+ }
704
+
705
+ mAssetTrack = [tracks[0] retain];
706
707
if ( ! setupReadingAt(kCMTimeZero) ) {
708
fprintf(stderr, "OpenCV: Couldn't read movie file \"%s\"\n", filename);
0 commit comments