开发者

Read multiple tracks with AVAssetReader

I need to read raw samples of both audio and video from an AVAsset. What is the开发者_运维知识库 best way to do this? I can attache multiple AVAssetReaderTrackOutput objects to one AVAssetReader. But [AVAssetReaderOutput copyNextSampleBuffer] is synchronous. What is the best way to read the two tracks in chronological order Is it safe to assign a thread to each AVAssetReaderTrackOutput?


Good question - one thread per AVAssetReaderTrackOutput seems to work fine on iOS but whether it should is not documented. Depending on how AVFoundation is implemented you could be causing asynchronous access to both the AVAssetReader and the AVAsset. Should that work? Nobody knows.

To be really safe you should create two AVAssetReaders and even two AVAssets (they're probably just AVURLAssets anyway).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜