Re: ExtAudioFileSeek behaves unexpected on AAC compressed audio files
Re: ExtAudioFileSeek behaves unexpected on AAC compressed audio files
- Subject: Re: ExtAudioFileSeek behaves unexpected on AAC compressed audio files
- From: Ian Esten <email@hidden>
- Date: Tue, 15 Mar 2011 10:59:24 -0700
Sounds like you are seeking relative to the client format sample rate, not the audio file format sample rate.
Ian
On Mar 15, 2011, at 8:12 AM, Heinrich Fink wrote:
> 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 am aware of the ExtAudioFileTell bug (QA1678). This issue, however, does not seem to be related with that. Also, a previous posting on this mailing list (http://lists.apple.com/archives/coreaudio-api/2010/Sep/msg00063.html) did not help either.
>
> I have quickly tossed together a test app that reconstructs this issue. You can download it from here:
>
> http://files.hfink.eu/ExtAudioFileSeekBug.zip
>
> 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
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Coreaudio-api mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden