AudioQueueDispose taking over 1 second

Originator:fmod.mathew
Number:rdar://12497498 Date Originated:5-Oct-2012
Status:Open Resolved:No
Product:iPhone SDK Product Version:6.0
Classification:Serious Bug Reproducible:Always
 
Summary:
I am using AudioQueue to do offline rendering. When the app goes into the background, then returns the offline rendering function returns 0 bytes. The only way I can see to recover the AudioQueue is to dispose it and rebuild and as such have been doing this successfully for quite some time. 

With iOS 6.0 the AudioQueueDispose call is now taking over 1 seconds, considering the offline decoding code I have is inside our audio streamer, a 1 second pause is totally unworkable. If the same code is run on iOS 5 AudioQueueDispose executes in the order of milliseconds, perfectly acceptable. 

Steps to Reproduce:
I have provided a modified version of the Apple offline render example. To reproduce the issue run the app, click the on screen button then press the home button. Now open the app again and watch the TTY output, you will see that the offline render returns 0, which is where I call dispose. It will print out the time taken to do the dispose, generally over 1 second. 

Expected Results:
AudioQueueDispose finishes in a reasonable amount of time.

Actual Results:
AudioQueueDispose takes over 1 second.

Regression:
Works as expected on iOS 5.

Notes:
The key ingredient in causing this extended time during dispose is the use of an AudioUnit, simply initializing it is enough to reproduce the bad behavior. You will note that commenting out the audio unit init call at the top of DoAQOfflineRender will significantly reduce the time it takes to process the dispose.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!