I am using pixelBufferPool in AVAssetWriterInputPixelBufferAdaptor to create pixel buffers for use with the add method. After creating 4 buffers, the pixelBufferPool property becomes NULL;
I configure my script, input, and adapter as follows:
- (BOOL) setupRecorder { NSError *error = nil; if([[NSFileManager defaultManager] fileExistsAtPath:[[self tempFileURL] path]]) [[NSFileManager defaultManager] removeItemAtURL:[self tempFileURL] error:&error]; assetWriter = [[AVAssetWriter alloc] initWithURL: [self tempFileURL] fileType:AVFileTypeQuickTimeMovie error:&error]; if (error) { NSLog(@"Error creating asset writer: %@", error); [assetWriter release]; return NO; }
and I am handing out pixel buffers as follows:
- (CVPixelBufferRef) createPixelBufferRef { CVPixelBufferPoolRef pixelBufferPool = adaptor.pixelBufferPool; CVPixelBufferRef pixelBuffer = NULL; CVReturn cvReturn = CVPixelBufferPoolCreatePixelBuffer(NULL, pixelBufferPool, &pixelBuffer); if(cvReturn != kCVReturnSuccess) NSLog(@"CVPixelBuffePoolCreatePixelBuffer: %d", cvReturn); bufferCreatedCount++; return pixelBuffer; }
when I finished passing the pixel buffer to appendPixelBuffer, I release the pixel buffer using CVPixelBufferRelease. In no case, before this happens, NULL I call markAsFinished, endSessionAtSourceTime or finishWriting. In addition, the adapter itself is not NULL.
Most of the messages that I read say that the pool is missing at the beginning due to an incorrectly configured adapter, but mine is there, but only for a short time. Has anyone else seen this behavior?
ios iphone avassetwriter
davidbitton
source share