Re: AudioConverterFillComplexBuffer never returns
Re: AudioConverterFillComplexBuffer never returns
- Subject: Re: AudioConverterFillComplexBuffer never returns
- From: Hank Heijink <email@hidden>
- Date: Thu, 05 Jan 2012 21:51:08 -0500
Interesting idea. I never considered that option, thinking that pausing would be the "best practice" scenario. I'll give it a try. I still don't understand what happens though--from what I understand, my approach should work just as well.
Thanks!
On Jan 5, 2012, at 5:58 PM, David M. Cotter wrote:
> i'd recommend NOT stopping the AUGraph when the download stalls, instead keep it running and just send out silent samples. when the download resumes, just resume sending actual audio samples.
>
> On Jan 5, 2012, at 12:55 PM, Heijink, Hank wrote:
>
>> Hi all,
>>
>> I've been trying to solve this problem for a couple of days, and I'm totally stuck. I'm posting this here in hopes that someone on the list sees what I'm missing!
>>
>> I'm downloading audio and playing it at the same time, and I'm trying to handle the case where the download errors out, the end of the data is encountered and the audio stops playing. This part works fine. The problem appears when I have more data available and playback should resume.
>>
>> What happens is this:
>>
>> I call AudioConverterFillComplexBuffer in the callback of my audio graph (which consists of a RemoteIO unit, an AUiPodTime unit, and a MultiChannelMixer). The audio converter then calls its callback and asks for 1 packet. The converter is converting from MP3 to LPCM, the callback reads 104 bytes from the file, and AudioConverterFillComplexBuffer returns having read 1024 frames.
>>
>> This is all fine. Now, when the end of the audio data is reached, the callback returns 0 bytes (and 0 packets) and an error code of -10012 (according to the docs, any nonzero value should be fine). AudioConverterFillComplexBuffer returns having read more than 0 and less than 1024 frames. At this point, I pause the audio graph by calling AUGraphStop.
>>
>> Now, when I start the audio graph again by calling AUGraphStart, AudioConverterFillComplexBuffer calls my callback, which returns the next 104 bytes in the file with its packet description, but at that point AudioConverterFillComplexBuffer just calls my callback again and keeps calling it without ever returning. The upshot of this is that my file is being read correctly, all pointers are advanced, but no audio is actually played.
>>
>> I must not be supplying the audio converter with what it wants, since it keeps asking for that 1 packet, but I can't figure out what the problem is. As best I can tell, my callback is providing it the right stuff.
>>
>> I didn't include code here, since the post would become very lengthy with it, but I'll provide it if it's impossible to tell what's going on without it.
>>
>> Any ideas?
>>
>> Thanks much in advance,
>> Hank
>>
>>
_______________________________________________
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