2012-06-24 3 views
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 코드를 제거하면 모든 것이 정상입니다.

?

+0

나쁜. 디버거를 통해 두 번째로 호출하려고하는 유효한 객체 인'videoOutput'이 있는지 확인할 수 있습니까? 정확한 오류 메시지를 게시 할 수 있습니까? – Pfitz

+0

그게 문제가 아니며 videoOutput이 제대로 할당되었습니다. 하지만 이제는 AVCaptureSessionRuntimeErrorNotification을 얻었습니다. – Janub

+0

예외 중단 점을 설정 했습니까? – Pfitz

답변

0

...!

내가

AVCaptureConnection *videoConnection = [videoOutput connectionWithMediaType:AVMediaTypeVideo]; 


if ([videoConnection isVideoOrientationSupported]) 
{ 
    [videoConnection setVideoOrientation:AVCaptureVideoOrientationPortrait]; 

} 

전에 [session startRunning] 라고 내 나는 그것이 메모리 관리 문제입니다 가정 :

관련 문제