Is AVAssetWriterInput readyForMoreMediaData supported in the background thread? If readyForMoreMediaData is NO, can I lock in the main thread and wait until the value changes to YES?
I use AVAssetWriterInput, clicking data on it (i.e. without using requestMediaDataWhenReadyOnQueue), and I set expectsMediaDataInRealTime, and 99.9% of the time I can just call appendSampleBuffer (or appendPixelBuffer) on it as fast as my application can generate frames .
This works great if you do not turn on the device (iPhone 3GS) for 15 minutes or so in the middle of an AVAssetWriter session. After waking up the device, appendPixelBuffer sometimes receives an error message: "The pixel buffer cannot be added when readyForMoreMediaData NO." Hence my question - what is the best answer to readyForMoreMediaData = NO, and if I can just wait a bit in the main thread, for example:
while ( ![assetWriterInput readyForMoreMediaData] )
{
Sleep for a few milliseconds
}
source
share