1
的应用程序,这是我的代码冻结我的应用程序AVCaptureConnection冻结我的第二个呼叫
AVCaptureConnection *videoConnection = [videoOutput connectionWithMediaType:AVMediaTypeVideo];
if ([videoConnection isVideoOrientationSupported])
{
[videoConnection setVideoOrientation:AVCaptureVideoOrientationPortrait];
}
这是我videoOutput初始化
// Setup video capture
videoInput = [[AVCaptureDeviceInput deviceInputWithDevice: front? frontVideoDevice: rearVideoDevice error: &error] retain];
videoOutput = [[AVCaptureVideoDataOutput alloc] init];
[videoOutput setAlwaysDiscardsLateVideoFrames: YES];
// Set the video output to store frame in BGRA (It is supposed to be faster)
NSString* key = (NSString*)kCVPixelBufferPixelFormatTypeKey;
NSNumber* value = [NSNumber numberWithUnsignedInt:kCVPixelFormatType_32BGRA];
NSDictionary* videoSettings = [NSDictionary dictionaryWithObject:value forKey:key];
[videoOutput setVideoSettings:videoSettings];
当我在第二次我的应用程序停止初始化会话回应 但如果我删除avcaptureconnection的代码一切都很好
?
我认为它是一个内存管理问题。你可以通过调试器检查第二次调用它时是否有一个有效的对象'videoOutput'?你能发布确切的错误消息吗? – Pfitz
我得到没有错误,这是问题,并正确分配videoOutput。但现在我注意到我得到了AVCaptureSessionRuntimeErrorNotification。 – Janub
您是否设置了异常断点? – Pfitz