Hi @t0m, first of all very sorry about the late reply we had to put this on hold for a while.
So we’ve just gotten to trying to reproduce the crash with the Juce demo example and… it turns out we end up with a slightly different symptom but yet a very similar problem.
Basically when rerouting the audio output to a headphone intermittently, Juce will indefinitely hang when calling AudioComponentInstanceDispose(audioUnit) in iOSAudioIODevice::createAudioUnit
So it seems that, unlike in our case, the audio routing change message is posted in the main thread, but it will result in a deadlock when releasing the former audio component.
I have no idea how these two symptoms relate to each other but they look way too similar to me not to have a root cause in common.
We can reproduce this on different iPhone models (5 to 7) and with different wireless/cable headphones.
How to reproduce?
It’s very easy to reproduce with a Bluetooth headphone (1 out of 3), more randomly with a 3.5mm socket (1 crash out of 10).
Get your hand on a Bluetooth headphone (it’s the future man!) and run the Juce Demos project
- Open the Synthesizers tab of Juce Demos
- Play around with the keyboard while connecting/disconnecting the external audio output
After 1 to 3 attempts the app will hang
What to do now?
This is a major blocker for our release unfortunately, as we don’t want our users to experience a crash or a hang as soon as they plug their headphone.
How could we support you fix this bug?
Should we report these two bugs in your issue tracker?
Thank you so much!
Screenshot of the callstack stuck in a seemingly deadlock: