开发者

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开发者_如何学Python 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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜