AVAudioEngine: audio input does not work on iOS 17 simulator

Hello,

I'm facing an issue with Xcode 15 and iOS 17: it seems impossible to get AVAudioEngine's audio input node to work on simulator.

  • inputNode has a 0ch, 0kHz input format,
  • connecting input node to any node or installing a tap on it fails systematically.

What we tested:

  • Everything works fine on iOS simulators <= 16.4, even with Xcode 15.
  • Nothing works on iOS simulator 17.0 on Xcode 15.
  • Everything works fine on iOS 17.0 device with Xcode 15.

More details on this here: https://github.com/Fesongs/InputNodeFormat

Any idea on this? Something I'm missing?

Thanks for your help 🙏

Tom

PS: I filed a bug on Feedback Assistant, but it usually takes ages to get any answer so I'm also trying here 😉

Started facing the same issue today after updating simulator to iOS 17.0

This is what I get if I try to log the inputNode.outputFormat(forBus: 0)

<AVAudioFormat 0x6000022ca8a0:  2 ch,      0 Hz, Float32, deinterleaved>

I have not been able to test on an iOS 17 device yet. Will update.

Got the same problem when updating simulator to iOS 17.0.1. App crashed with a "SetProperty: RPC timeout. Apparently deadlocked. Aborting now." error. Code works fine on a 16.0 simulator.

Same issue. iPhone 15 Pro Max Simulator, iOS 17.0.1 - Deadlock when calling AudioUnitInitialize in tests. The app works fine on physical device with iOS 17. Also, the tests pass on iOS 16.4 Simulator. The deadlock is preceded with some warnings, here's how it looks like in console log:

2023-11-29 16:13:08.950085+0000 xctest[8838:88018] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x6000003f64e0> F8BB1C28-BAE8-11D6-9C31-00039315CD46
2023-11-29 16:13:09.013816+0000 xctest[8838:88068]             HALSystem.cpp:2216   AudioObjectPropertiesChanged: no such object
2023-11-29 16:13:09.014314+0000 xctest[8838:88068]         HALB_MachPort.cpp:174    HALB_MachPort::DestroyPort: not going to destroy anything this way
2023-11-29 16:13:18.014192+0000 xctest[8838:88036] [default] SetProperty: RPC timeout. Apparently deadlocked. Aborting now.

Did anyone of you ever find a solution to this or at least some feedback from Apple? :) This is drving me nuts. All my projects using ADM will get this deadlock and the REAL issue is that debugging on a live device after iOS 17 is unbearably slow, but the simulator is REALLY FAST making that my go-to nowadays...

You need to activate the AudioSession.

I have added the following line to your code sample from github

        try! AVAudioSession.sharedInstance().setActive(true)

after the setCategory line. Then it works for me on an iOS 17.2 simulator.

I can confirm that your code works on iOS 16.4 Simulator without setActive. Not sure why, as my understanding is it has always been the intended way of doing stuff using setActive.

We've ran into this issue on iOS 17 Simulator, too.

Getting SetProperty: RPC timeout. Apparently deadlocked. Aborting now. with stacktraces looking like this:

	0x125b1f124 - /usr/lib/system/libsystem_pthread.dylib : pthread_kill
2024-07-26 10:32:22.997235+0200 VoizeSDKDemo[19261:2764555] [default] SetProperty: RPC timeout. Apparently deadlocked. Aborting now.
	0x123eef5c0 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_c.dylib : abort
	0x12c656400 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/AudioToolboxCore.framework/AudioToolboxCore : _Z14_CheckRPCErrorPKcii
	0x12c65656c - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/AudioToolboxCore.framework/AudioToolboxCore : _Z14_CheckRPCErrorPKcii
	0x358dc0d0c - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/AudioToolbox.framework/libEmbeddedSystemAUs.dylib : _ZN10AURemoteIO11SetPropertyEjjjPKvj
	0x358dbfb40 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/AudioToolbox.framework/libEmbeddedSystemAUs.dylib : _ZN10AURemoteIO10InitializeEv
	0x358e0a614 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/AudioToolbox.framework/libEmbeddedSystemAUs.dylib : _ZN5ausdk6AUBase12DoInitializeEv
	0x358e0bfe8 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/AudioToolbox.framework/libEmbeddedSystemAUs.dylib : _ZN5ausdkL18AUMethodInitializeEPv
	0x12c800dd4 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/AudioToolboxCore.framework/AudioToolboxCore : AudioUnitInitialize
	0x12c770b04 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/AudioToolboxCore.framework/AudioToolboxCore : -[AUAudioUnitV2Bridge allocateRenderResourcesAndReturnError:]
	0x13cd74424 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/AVFAudio.framework/AVFAudio : _ZN17AUInterfaceBaseV310InitializeEv
	0x13cd5c8ac - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/AVFAudio.framework/AVFAudio : _ZN17AVAudioIONodeImpl14GetInputFormatEm
	0x13cd55cb8 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/AVFAudio.framework/AVFAudio : -[AVAudioNode inputFormatForBus:]
	0x13cd6ec98 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/AVFAudio.framework/AVFAudio : _ZN17AVAudioEngineImpl15UpdateInputNodeEb
	0x13cd6b0e8 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/AVFAudio.framework/AVFAudio : -[AVAudioEngine inputNode]

We were calling audioEngine.inputNode.inputFormatForBus(bus) and audioEngine.inputNode.outputFormatForBus repeatedly on separate threads for debugging purposes.

It looks like calling the inputNode getter that often seems to create the problem.
Calling the inputNode getter once and putting it into a variable and using that instance appeared to fix the issue.

AVAudioEngine: audio input does not work on iOS 17 simulator
 
 
Q