I init AVCaptureVideoDataOutput with this method:
// Setup the video output
_videoOutput = [[AVCaptureVideoDataOutput alloc] init];
_videoOutput.alwaysDiscardsLateVideoFrames = YES;
_videoOutput.minFrameDuration = kCMTimeZero;
_videoOutput.videoSettings =
[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:kCVPixelFormatType_32BGRA],(id)kCVPixelBufferPixelFormatTypeKey
,AVVideoCodecH264, AVVideoCodecKey, nil];
// Setup the audio output
_audioOutput = [[AVCaptureAudioDataOutput alloc] init];
NSLog(@"dispatch_queue_t");
// Setup the queue
dispatch_queue_t queue = dispatch_queue_create("MyQueue", NULL);
[_videoOutput setSampleBufferDelegate:self queue:queue];
[_audioOutput setSampleBufferDelegate:self queue:queue];
dispatch_release(queue);
And i have a problem that the delegate method:
- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection
is won't called.in IOS4 this method called, any idea why it happen?