Inter-App Audio node input callback run twice per render session, on 2 different threads, when hosted

Number:rdar://33049097 Date Originated:June 29 2017, 5:12 PM
Status:Open Resolved:
Product:iOS Audio Product Version:10.3.3
Classification:Serious Bug Reproducible:Always

If an Inter-App Audio node configures its Remote IO audio unit with an input callback (kAudioOutputUnitProperty_SetInputCallback) and also publishes it (AudioOutputUnitPublish), then when it is hosted within Inter-App Audio, the input callback is called twice for each time interval, once from a thread called AURemoteIO::IOThread, once from a thread called

Steps to Reproduce:
See attached sample app; this is derived from the InterAppAudioSampler sample project provided by Apple; diff also attached for reference. The sample app configures an input callback which prints out the name of the current thread on the console. Build and run, then host the app within an IAA host like GarageBand.

Expected Results:
Upon hosting, "AURemoteIO::IOThread" should be printed out for each render interval.

Observed Results:
"AURemoteIO::IOThread" and "" are printed out for each render interval.

Tested on iOS 10.3.3

This is a problem for many apps that both publish their audio units via IAA and take input from the microphone, as this can cause double processing of the input handling code. The only workaround I have found is to defer input handling to the audio unit's render callback instead, and only use the input callback to retrieve the AudioTimeStamp. If one uses the mSampleTime element of the AudioTimeStamp, however, this is still likely to lead to problems as the sample times for the two invocations are different: upon hosting, the thread reports sample times starting from zero.

Tested on an iPad Air 2


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at 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!