Audio Queue Services on iPhone only playing the first enqueued buffer?

I've been up all night trying to figure this one out. My code is basically the same as Apple's example here. However, the device plays only the FIRST buffer placed in the queue (I hear the contents of the first buffer when the app starts). After that, no sound will come from the device at all. The playback is still running though as AQS continues to fire my AudioQueueOutputCallback function. Additionally, every call to AQS returns 0 so nothing is failing.

Now, I can get subsequent buffers to play as long as I call AudioQueueEnqueueBuffer from WITHIN my callback function. This won't work as I can only fill and enqueue the buffers from within my AudioFileStream_PacketsProc callback as the data cines from the socket and into AudioFileStreamParseBytes .

Anyone else have this problem? Seems like a bug in AQS to me...

Thanks, Andrew


Figured it out in case anyone else has this problem...

I didn't realize the AQ always moves forward in time. Since I was using audio data from a UDP data stream, I would slowly fall behind the AQ because of lost packets.

I haven't been able to figure out how to tell the AQ to play a buffer "right-now". My workaround is to just reset the AQ when I detect a dropped packet. This isn't ideal but works for now.

Andrew

链接地址: http://www.djcxy.com/p/26982.html

上一篇: 客观的c警告

下一篇: iPhone上的音频队列服务仅播放第一个入队缓冲区?