Hi,
I have been fighting with ExtAudioFileSeek and I am not sure if I am experiencing a bug, or if the error is on my side.
When reading an AAC compressed audio file, it seems that ExtAudioFileSeek is not jumping to the correct position.
We have stumbled across this issue during the following test scenario while reading a 16khz AAC audio file, with the exact length of 1 sec (16000 frames) (pseudo code):
frames_per_read_op = 400; num_packages_read = 0; while(num_read_frames > 0) {
// Seek to zero ExtAudioFileSeek(ext_af_ref, 0); SInt64 offset = num_packages_read*frames_per_read_op;
// Jump back where we left ExtAudioFileSeek(ext_af_ref, offset); ExtAudioFileRead(ext_af_ref, &num_read_frames, &abl); total_num_read_frames += num_read_frames; num_packages_read++; }
When the while loop has finished, the variable total_num_read_frames must be exactly equal to 16000. This is, however, not the case with the AAC compressed file. Reading sequentially, without the back and forth seeking in between works fine. Also, loading the same file uncompressed as a WAV file, works fine, too.
I have quickly tossed together a test app that reconstructs this issue. You can download it from here:
The archive also contains the mentioned AAC compressed audio file which is reported by afinfo to contain 16000 valid frames.
Am I misunderstanding the ExtAudioFile API, or have I stumbled across a real bug? In my understanding I expect the ExtAudioFileSeek to jump to the exact given offset. I would really appreciate any comments on this situation.
best regards,
Heinrich Fink
|