ExtAudioFile - ExtAudioFileTell Incorrect Position Work Around
Q:
I'm calling ExtAudioFileTell
for a .m4a file containing AAC audio (immediately after I set the client format) and the API returns a value of -2112 instead of 0. Is this a know issue?
A: I'm calling ExtAudioFileTell
for a .m4a file containing AAC audio (immediately after I set the client format) and the API returns a value of -2112 instead of 0. Is this a know issue?
ExtAudioFileTell
currently always returns a value which is the number of priming-frames too small.
The ExtAudioFile
APIs should take care of this priming offset on behalf of the client however, as the AAC bitstream contains 2112 priming frames, ExtAudioFileTell
returns a value which is priming-frames too small, in this case -2112 instead of 0 (zero).
The work around requires the client to compensate:
Make an initial call to
ExtAudioFileTell
immediately after opening the file and setting the client format.If the returned position is negative, all future calls to
ExtAudioFileTell
will be off by this value and the client should compensate.
Listing 1 Figure out the offset correction value.
... // call ExtAudioFileTell immediately after opening the file and setting the client format // and get the correction value to add to all future calls SInt64 frameOffset = 0; SInt64 frameOffsetCorrection = 0; ExtAudioFileTell(sourceFile, &frameOffset); if (frameOffset < 0) frameOffsetCorrection = -frameOffset; ... |
Listing 2 As a general work around always add this correction when calling ExtAudioFileTell
.
... ExtAudioFileTell(sourceFile, &frameOffset); frameOffset += frameOffsetCorrection; ... |
Document Revision History
Date | Notes |
---|---|
2009-12-07 | New document that discusses how to work around a bug in ExtAudioFileTell where the returned value may be priming-frames too small. |
Copyright © 2009 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2009-12-07