1

this is my code that freezes my app

 AVCaptureConnection *videoConnection = [videoOutput connectionWithMediaType:AVMediaTypeVideo];


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

}

this is my videoOutput init

// 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]; 

when I initialize the session in the second time my app stop responding but if i remove the code of the avcaptureconnection everything is fine

?

4

1 回答 1

0

……!

[session startRunning] 之前打过电话

AVCaptureConnection *videoConnection = [videoOutput connectionWithMediaType:AVMediaTypeVideo];


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

}

我的错 :)

于 2012-06-24T09:27:29.780 回答