AVAssetReader Seeking

后端 未结 2 1240
猫巷女王i
猫巷女王i 2020-12-30 15:12

I am in need of seeking around an audio file and pull out chunks. I am trying to use the AVAssetReader. The bug I am seeing is if I read the audio over a period of time from

2条回答
  •  猫巷女王i
    2020-12-30 15:40

    It appears to me that you problem is with assuming the following code accurately seeks to startTime:

    CMTimeRange timeRange = CMTimeRangeMake(startTime, kCMTimePositiveInfinity);
    assetReader.timeRange = timeRange;
    

    You can test this using a call to

    CMSampleBufferGetOutputPresentationTimeStamp(nextBuffer);

    From this you will be able to see the exact time (in seconds) of start of the buffer.

提交回复
热议问题