AVAssetWriterInputPixelBufferAdaptor pixelBufferPool becomes nil, kCMBufferQueueError_InvalidBuffer

I have some code that uses AVAssetWriter to build a video file from images. It works fine on my machines, but consistently fails for one user. What happens is that at some point the pixelBufferBool property of the AVAssetWriterInputPixelBufferAdaptor becomes nil. At that point, the error property of the AVAssetWriter is AVErrorUnknown (-11800), and the underlying error code is -12769, which I think means kCMBufferQueueError_InvalidBuffer.


Creation of the AVAssetWriterInput looks like this:


AVAssetWriterInput* videoWriterInput = [AVAssetWriterInput
assetWriterInputWithMediaType: AVMediaTypeVideo
outputSettings: @{
AVVideoCodecKey: AVVideoCodecH264,
AVVideoWidthKey: @(spec.width),
AVVideoHeightKey: @(_imageHeight)
}];


Creation of the AVAssetWriterInputPixelBufferAdaptor:


AVAssetWriterInputPixelBufferAdaptor* adaptor = [[[AVAssetWriterInputPixelBufferAdaptor alloc]
initWithAssetWriterInput: videoWriterInput
sourcePixelBufferAttributes: @{
(NSString*) kCVPixelBufferCGBitmapContextCompatibilityKey: @YES,
(NSString*) kCVPixelBufferCGImageCompatibilityKey: @YES,
(NSString*) kCVPixelBufferPixelFormatTypeKey: @(kCVPixelFormatType_32ARGB),
(NSString*) kCVPixelBufferWidthKey: @(spec.width),
(NSString*) kCVPixelBufferHeightKey: @(_imageHeight),
(NSString*) kCVPixelBufferBytesPerRowAlignmentKey: @(4)
}] autorelease];


Any suggestions on what could be wrong or how to track it down?