In my macOS app I launch the ffmpeg task in order to retrieve the media file information.
And I receive many crashes due to EXC_GUARD:
Exception Type: EXC_GUARD
Exception Codes: 0x4000000200000001, 0xd71a2ae8e8dab339
Exception Subtype: GUARD_TYPE_FD, id=0xd71a2ae8e8dab339, fd=1, flavor=0x00000002 (DUP)
Here is the code I use:
NSArray *ffmpegArgs = [NSArray arrayWithObjects:@"-hide_banner", @"-nostdin", @"-nostats",
@"-i", self.media.path,
nil];
self.task = [[NSTask alloc] init];
[self.task setLaunchPath:[[NSBundle mainBundle] pathForResource:@"ffmpeg" ofType:nil]];
[self.task setArguments:ffmpegArgs];
NSPipe *errorPipe = [NSPipe pipe];
self.task.standardError = errorPipe;
NSFileHandle *errorHandle = [errorPipe fileHandleForReading];
@try {
[self.task launch];
} @catch (NSException *exception) {
NSLog(@"An exception %@ was thrown while attempting to launch the ffmpeg task with arguments: %@.", exception.description, [ffmpegArgs componentsJoinedByString:@" "]);
[errorHandle closeFile];
return;
}
[self.task waitUntilExit];
NSData *outputData = [errorHandle readDataToEndOfFile];
[errorHandle closeFile];
I can't reproduce this crash on my device.
Can anyone help me?
User contributions licensed under CC BY-SA 3.0