iOS 17 - Core Audio error leading to FMOD_ERR_OUTPUT_INIT

My users are starting to update to iOS 17, and it appears Apple included a nice new bug in Core Audio for this release. Yay! :roll_eyes:

Weirdly, the issue only begins when audio is not playing back; my app is a music generation/playback app, so stopping/starting playback happens all the time.

Some time (usually one to several seconds) after calling FMOD::System->mixerSuspend() I get this error in the Xcode logs:

connection <connection: 0x11bd294f0> { name = com.apple.audio.AudioQueueServer, listener = false, pid = 0, euid = 4294967295, egid = 4294967295, asid = 4294967295 } : error <dictionary: 0x23aecadc0> { count = 1, transaction: 0, voucher = 0x0, contents =
	"XPCErrorDescription" => <string: 0x23aecafb0> { length = 22, contents = "Connection interrupted" }
}
Type: Error | Timestamp: 2023-09-22 07:50:32.614689-07:00 | Library: libAudioToolboxUtility.dylib | Subsystem: com.apple.coreaudio | Category: AQClient | TID: 0xd53cf

auto-cancelling <connection: 0x11bd294f0> { name = com.apple.audio.AudioQueueServer, listener = false, pid = 0, euid = 4294967295, egid = 4294967295, asid = 4294967295 }
Type: Error | Timestamp: 2023-09-22 07:50:32.614901-07:00 | Library: libAudioToolboxUtility.dylib | Subsystem: com.apple.coreaudio | Category: AQClient | TID: 0xd53c

At this point, calling FMOD::System->mixerResume() yields a FMOD_ERR_OUTPUT_INIT result: “Error initializing output device.” The FMOD debug log shows this:

[LOG] SystemI::mixerResume        : Resuming output.
[ERR] OutputCoreAudio::suspend    : Cannot start audio unit. (err: -50)

To be clear, I am all but convinced this is totally Apple’s fault and not something FMOD is responsible for. Case in point, setting AVAudioSession immediately after the first error above puts this in the logs:

AVAudioSessionUtilities.h:196 Invalid XPC connection, session ID = 0x0, property ID = AudioCategory
Type: Error | Timestamp: 2023-09-22 07:50:33.479027-07:00 | Library: AudioSession | Subsystem: com.apple.coreaudio | Category: as_client | TID: 0xd42d

(Although, interestingly, after the failed attempt to resume FMOD I am once again able to set AVAudioSession without issue. Not that it does me any good, mind you.)

Anyway, I am tearing my hair out trying to come up with a workaround for this issue. Wanted to post this just in case someone had any ideas of where to go from here, but mostly so that any other programmers using FMOD are affected by this issue know: it’s not just you!

I will also paste in the output from Console.app, filtered to my app’s name (shortened here to MyApp for brevity):

Show relevant Console.app output
892: 0x26da0	default	17:41:37.186922	MyApp	AudioComponentPluginMgr.mm:310   registration server connection interrupted
892: 0x26da1	debug	17:41:37.187069	MyApp	        AudioServices.cpp:387   the server just died :(
892: 0x26da2	debug	17:41:37.187216	MyApp	           AURemoteIO.cpp:174   RIOServer::ServerPortDied: PID 887
892: 0x26da2	debug	17:41:37.187354	MyApp	           AURemoteIO.cpp:1326  ->AURemoteIO(0x152810640)::Cleanup
892: 0x26da2	default	17:41:37.187642	MyApp	           AURemoteIO.cpp:1733  Stopping AURemoteIO(0x152810640)
892: 0x26da2	debug	17:41:37.187777	MyApp	           AURemoteIO.cpp:1756  <-AURemoteIO::Stop
892: 0x26da2	debug	17:41:37.189918	MyApp	           AURemoteIO.cpp:1332  <-AURemoteIO::Cleanup

892: 0x26da2	default	17:41:37.198185	MyApp	[0x2839b6800] Failed to derive connection port; error 0xf
892: 0x26da1	error	17:41:37.198323	MyApp	connection <connection: 0x151119c10> { name = com.apple.audio.AudioQueueServer, listener = false, pid = 0, euid = 4294967295, egid = 4294967295, asid = 4294967295 } : error <dictionary: 0x26060edc0> { count = 1, transaction: 0, voucher = 0x0, contents = "XPCErrorDescription" => <string: 0x26060efb0> { length = 22, contents = "Connection interrupted" } }
892: 0x26da0	default	17:41:37.198404	MyApp	      sc_XPCConnection.mm:228   session server connection interrupted
892: 0x26da0	default	17:41:37.198488	MyApp	    AVAudioSession_iOS.mm:1530  Session 0x377011 posting AVAudioSessionMediaServicesWereLostNotification
892: 0x26da1	error	17:41:37.204875	MyApp	auto-cancelling <connection: 0x151119c10> { name = com.apple.audio.AudioQueueServer, listener = false, pid = 0, euid = 4294967295, egid = 4294967295, asid = 4294967295 }
892: 0x26da1	debug	17:41:37.205018	MyApp	canceling connection <connection: 0x151119c10> { name = com.apple.audio.AudioQueueServer, listener = false, pid = 0, euid = 4294967295, egid = 4294967295, asid = 4294967295 }
892: 0x26da1	default	17:41:37.205148	MyApp	[0x151119c10] invalidated on xpc_connection_cancel()
892: 0x26da1	debug	17:41:37.205272	MyApp	canceled connection <connection: 0x151119c10> { name = com.apple.audio.AudioQueueServer, listener = false, pid = 0, euid = 4294967295, egid = 4294967295, asid = 4294967295 }
892: 0x26da1	debug	17:41:37.205429	MyApp	proceeding after canceling <connection: 0x151119c10> { name = com.apple.audio.AudioQueueServer, listener = false, pid = 0, euid = 4294967295, egid = 4294967295, asid = 4294967295 }
892: 0x26da1	default	17:41:37.205565	MyApp	destructor connimpl 0x2805c3640
892: 0x26da0	default	17:41:37.205718	MyApp	[0x2839b6800] invalidated on xpc_connection_cancel()

45: 0x26dc2	default	17:41:37.306881	powerd	Process runningboardd.31 Released SystemIsActive "app<com.myapp.mobiledev(7580BE9C-A613-4FC3-B2C3-1A568BF6B601)>31-887-10541:audiomxd(887).2023.09.22_17:41:28:4128.MediaExperience.892."com.myapp.mobiledev"."{"ID":"0x377011","name":"MyApp(892)"}"."MediaPlayback".isPlayingProcessAssertion" age:00:00:40  id:51539642145 [System: PrevIdle SysAct]

892: 0x26da0	debug	17:41:37.354341	MyApp	PERF: [app<com.myapp.mobiledev(7580BE9C-A613-4FC3-B2C3-1A568BF6B601)>:892] Received message from runningboardd: async_observedProcessStatesDidChange:completion:
892: 0x26da0	debug	17:41:37.354526	MyApp	Decoded RBSProcessHandle with IPC ID 1a14c0780000037c
892: 0x26da0	default	17:41:37.355187	MyApp	Received state update for 892 (app<com.myapp.mobiledev(7580BE9C-A613-4FC3-B2C3-1A568BF6B601)>, unknown-NotVisible
892: 0x26da0	info	17:41:37.355906	MyApp	Update skipped for [app<com.myapp.mobiledev(7580BE9C-A613-4FC3-B2C3-1A568BF6B601)>:892]

892: 0x26da1	default	17:41:38.242655	MyApp	[0x2839b0400] activating connection: mach=true listener=false peer=false name=com.apple.audio.AudioSession
892: 0x26da1	default	17:41:39.149106	MyApp	      sc_XPCConnection.mm:287   reconnection successful
892: 0x24c77	error	17:41:39.149288	MyApp	    AVAudioSession_iOS.mm:1043  AudioSessionGetProperty (CurrentOutputLatency) failed with error: -50
892: 0x24c77	error	17:41:39.161206	MyApp	    AVAudioSession_iOS.mm:2017  Failed to get category, error: -50
892: 0x24c77	error	17:41:39.161473	MyApp	    AVAudioSession_iOS.mm:1043  AudioSessionGetProperty (CurrentOutputSampleRate) failed with error: -50
892: 0x24c77	default	17:41:39.161669	MyApp	0x10e0a46c0 - [PID=896, throttler=0x10f004300] ProcessThrottler::Activity::Activity: Starting foreground activity / 'WebPageProxy::runJavaScriptInFrameInScriptWorld'
892: 0x24c77	default	17:41:39.161931	MyApp	Audio latency reported as 0 ms
892: 0x24c77	default	17:41:39.162431	MyApp	0x10e0a46c0 - [PID=896, throttler=0x10f004300] ProcessThrottler::Activity::invalidate: Ending foreground activity / 'WebPageProxy::runJavaScriptInFrameInScriptWorld'
892: 0x24c77	default	17:41:40.253739	MyApp	FMOD clock synchronized to 789.857000
892: 0x24c77	default	17:41:40.254292	MyApp	0x10e0a6c80 - [PID=896, throttler=0x10f004300] ProcessThrottler::Activity::Activity: Starting foreground activity / 'WebPageProxy::runJavaScriptInFrameInScriptWorld'
892: 0x24c77	error	17:41:40.256232	MyApp	    AVAudioSession_iOS.mm:2290  Failed to set properties, error: -50
892: 0x26da0	default	17:41:40.257860	MyApp	     CAReportingClient.mm:349   Creating CAReportingClient { useXPC="Y", endpoint="(null)" }
892: 0x26da0	default	17:41:40.258481	MyApp	[0x2839a5600] activating connection: mach=true listener=false peer=false name=com.apple.audioanalyticsd
892: 0x26da0	debug	17:41:40.259942	MyApp	     CAReportingClient.mm:410   Registering appWillResignActive for UIApplicationWillResignActiveNotification
892: 0x26da0	default	17:41:40.260035	MyApp	     CAReportingClient.mm:699   Sending message { message="{
    "bundle_id" = "com.myapp.mobiledev";
    "error_code" = AVAudioSessionErrorCodeBadParam;
    "property_values" =     {
        AudioCategory = MediaPlayback;
        InterruptionStyle = 16;
        WantsToPauseSpokenAudio = 0;
    };
}", reporters="(null)" }
892: 0x24c77	default	17:41:40.347686	MyApp	ERROR while setting AVAudioSession category: Error Domain=NSOSStatusErrorDomain Code=-50 "(null)"
892: 0x24c77	default	17:41:40.348086	MyApp	Audio engine cannot start. Error: Error Domain=NSOSStatusErrorDomain Code=-50 "(null)"
892: 0x24c77	default	17:41:40.348278	MyApp	0x10e0a6c80 - [PID=896, throttler=0x10f004300] ProcessThrottler::Activity::invalidate: Ending foreground activity / 'WebPageProxy::runJavaScriptInFrameInScriptWorld'

I assume the files referenced in the initial messages (AudioComponentPluginMgr.mm, AudioServices.cpp, and AURemoteIO.cpp) refer to the FMOD source code. Makes me wonder if there’s something in that code that can uncover more about what’s going on…

I have not been able to reproduce any issues by calling mixerSuspend/mixerResume on iOS 17. What version of the FMOD API are you using?

These appear to be Core Audio classes actually, but we are likely the ones calling into them, so I would imagine we are somewhere above them in the callstack.

Perhaps we are being disconnected from the audio server after being inactive for too long. If this is the case, we might have some additional logging from our Codec API. Can you please set your logging level to FMOD_DEBUG_TYPE_CODEC and upload the full log to your FMOD Profile?

-50 means invalid param, which suggests our AudioUnit became invalidated during that suspend call.
Again, I think enabling codec logging should help us figure out what’s going wrong here.

It’s not related but using Address Sanitizer you can see more details about an issue that appeared in iOS17: FMOD::System::init

* thread #1, queue = 'com.apple.main-thread', stop reason = Deallocation of non-allocated memory
    frame #0: 0x000000010f4791dc libclang_rt.asan_ios_dynamic.dylib`__asan::AsanDie()
    frame #1: 0x000000010f4925f0 libclang_rt.asan_ios_dynamic.dylib`__sanitizer::Die() + 192
    frame #2: 0x000000010f4770d0 libclang_rt.asan_ios_dynamic.dylib`__asan::ScopedInErrorReport::~ScopedInErrorReport() + 1124
    frame #3: 0x000000010f473e74 libclang_rt.asan_ios_dynamic.dylib`__asan::ReportFreeNotMalloced(unsigned long, __sanitizer::BufferedStackTrace*) + 424
    frame #4: 0x000000010f46f4a4 libclang_rt.asan_ios_dynamic.dylib`wrap_free + 260
    frame #5: 0x000000021a616aec libc++abi.dylib`__cxa_decrement_exception_refcount + 68
    frame #6: 0x00000001bdd24b14 AudioToolboxCore`AudioConverterNewInternal(AudioStreamBasicDescription const*, AudioStreamBasicDescription const*, unsigned int, AudioClassDescription const*, OpaqueAudioConverter**, AudioConverterAPI* (*)(AudioStreamBasicDescription const*, AudioStreamBasicDescription const*, unsigned int, AudioClassDescription const*)) + 892
    frame #7: 0x00000001bdd2475c AudioToolboxCore`AudioConverterNew + 344
    frame #8: 0x00000002260ac838 libEmbeddedSystemAUs.dylib`AUInputFormatConverter2::GetProperty(unsigned int, unsigned int&, void*) + 136
    frame #9: 0x00000002260b1a04 libEmbeddedSystemAUs.dylib`AUConverterBase::SetMaxFramesPerSlice(unsigned int) + 296
    frame #10: 0x00000002260ab0bc libEmbeddedSystemAUs.dylib`AURemoteIO::AURemoteIO(OpaqueAudioComponentInstance*, EIOPersonality) + 3036
    frame #11: 0x00000002260aa3a4 libEmbeddedSystemAUs.dylib`ausdk::ComponentBase::AP_Open(void*, OpaqueAudioComponentInstance*) + 60
    frame #12: 0x00000001bdd2a72c AudioToolboxCore`APComponent::newInstance(unsigned int, bool, void (OpaqueAudioComponentInstance*, int) block_pointer) + 1996
    frame #13: 0x00000001bdd29f54 AudioToolboxCore`__AudioComponentInstanceNew_block_invoke + 120
    frame #14: 0x00000001bdd29eac AudioToolboxCore`Synchronously + 132
    frame #15: 0x00000001bdd29c50 AudioToolboxCore`AudioComponentInstanceNew + 356
    frame #16: 0x00000001088e6ba4 elixir`FMOD::ProfileDsp::create(FMOD::Profile*, FMOD::SystemI*, FMOD::ProfileDsp**) + 603000
    frame #17: 0x00000001088fe1d0 elixir`FMOD::ProfileDsp::create(FMOD::Profile*, FMOD::SystemI*, FMOD::ProfileDsp**) + 698788
    frame #18: 0x00000001088f6d7c elixir`FMOD::ProfileDsp::create(FMOD::Profile*, FMOD::SystemI*, FMOD::ProfileDsp**) + 669008
1 Like

Hi Jeff,

Thanks for your reply. I was able to get my app working again by detecting any “Code=51” errors thrown by mixerResume and destroying/recreating all FMOD objects in that case. Only adds a fraction of a second of delay when hitting play, which is acceptable for now so that I can return to focusing on the next big upgrade we’re currently in the middle of building.

I was using some FMOD 2.02 version from last year. I’ve since updated to the latest version, but to no avail.

Perhaps we are being disconnected from the audio server after being inactive for too long.

The error sometimes happens less than a second after mixerSuspend. Not very long…

One interesting discovery I made: I had two version of the app installed as two separate iOS apps (different app IDs) and was testing and logging both simultaneously as a sort of stress test, and whenever this error occured it would disrupt the audio engine in both apps simultaneously. In other words, it seems like the issue is not specific to the link between one instance of FMOD::System and Core Audio, but something deeper.

Can you please set your logging level to FMOD_DEBUG_TYPE_CODEC and upload the full log to your FMOD Profile?

I won’t be able to for a little while but I have a reminder to do this later so I will report back.

Thanks again.

Good to know, thanks for the tip! Are you getting issues with iOS17 as well?

That is interesting, it sounds like whatever is happening is disrupting the AudioQueueServer. I haven’t been able to recreate any dropouts with either the hardware or software codec policies so I’m not sure what else it could be.
Whenever you get a chance, more logging would be ideal- good to hear you’ve got a workaround for now at least.

I finally got around to trying to capture some codec debug logs, but I don’t think there’s any useful logs here, probably because the issue is happening while FMOD is suspended (pointing to a deeper iOS 17 issue).

Codec logs (mixed in with app logs)
[...steady stream of the 10 lines below during playback...]
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/src/fmod_systemi_sound.cpp:904 SystemI::createSoundInternal - 16 codecs found.  Scan all until one succeeds
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/src/fmod_systemi_sound.cpp:963 SystemI::createSoundInternal - Scan for tags.
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/src/fmod_codec_tag.cpp:106 CodecTag::openInternal - attempting to open ID3 or ASF tags..
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/src/fmod_codec.cpp:29 Codec::release -
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/src/fmod_codec.cpp:102 Codec::release - done
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/platforms/ios/src/fmod_codec_audioqueue.cpp:150 CodecAudioQueue::openInternal - attempting to open as audio queue..
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/platforms/ios/src/fmod_codec_audioqueue.cpp:421 CodecAudioQueue::setupAudioFile - Format discovered: '.mp3'
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/platforms/ios/src/fmod_codec_audioqueue.cpp:437 CodecAudioQueue::setupAudioFile - Format selected: '.mp3'
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/platforms/ios/src/fmod_codec_audioqueue.cpp:445 CodecAudioQueue::setupAudioFile - Max packet size = 1052
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/platforms/ios/src/fmod_codec_audioqueue.cpp:452 CodecAudioQueue::setupAudioFile - Packet info: priming = 576, valid = 66150, remainder = 1242
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/src/fmod_systemi_sound.cpp:904 SystemI::createSoundInternal - 16 codecs found.  Scan all until one succeeds
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/src/fmod_systemi_sound.cpp:963 SystemI::createSoundInternal - Scan for tags.
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/src/fmod_codec_tag.cpp:106 CodecTag::openInternal - attempting to open ID3 or ASF tags..
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/src/fmod_codec.cpp:29 Codec::release -
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/src/fmod_codec.cpp:102 Codec::release - done
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/platforms/ios/src/fmod_codec_audioqueue.cpp:150 CodecAudioQueue::openInternal - attempting to open as audio queue..
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/platforms/ios/src/fmod_codec_audioqueue.cpp:421 CodecAudioQueue::setupAudioFile - Format discovered: '.mp3'
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/platforms/ios/src/fmod_codec_audioqueue.cpp:437 CodecAudioQueue::setupAudioFile - Format selected: '.mp3'
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/platforms/ios/src/fmod_codec_audioqueue.cpp:445 CodecAudioQueue::setupAudioFile - Max packet size = 1052
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/platforms/ios/src/fmod_codec_audioqueue.cpp:452 CodecAudioQueue::setupAudioFile - Packet info: priming = 576, valid = 132300, remainder = 756
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/src/fmod_systemi_sound.cpp:904 SystemI::createSoundInternal - 16 codecs found.  Scan all until one succeeds
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/src/fmod_systemi_sound.cpp:963 SystemI::createSoundInternal - Scan for tags.
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/src/fmod_codec_tag.cpp:106 CodecTag::openInternal - attempting to open ID3 or ASF tags..
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/src/fmod_codec.cpp:29 Codec::release -
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/src/fmod_codec.cpp:102 Codec::release - done
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/platforms/ios/src/fmod_codec_audioqueue.cpp:150 CodecAudioQueue::openInternal - attempting to open as audio queue..
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/platforms/ios/src/fmod_codec_audioqueue.cpp:421 CodecAudioQueue::setupAudioFile - Format discovered: '.mp3'
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/platforms/ios/src/fmod_codec_audioqueue.cpp:437 CodecAudioQueue::setupAudioFile - Format selected: '.mp3'
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/platforms/ios/src/fmod_codec_audioqueue.cpp:445 CodecAudioQueue::setupAudioFile - Max packet size = 1052
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/platforms/ios/src/fmod_codec_audioqueue.cpp:452 CodecAudioQueue::setupAudioFile - Packet info: priming = 576, valid = 8776, remainder = 1016
FMOD::System->mixerSuspend() - OK
AVAudioSession category is now "Ambient"
[Here's the first sign of trouble; this connection interruption happens a second or two *after* FMOD::System->mixerSuspend()]
connection  { name = com.apple.audio.AudioQueueServer, listener = false, pid = 0, euid = 4294967295, egid = 4294967295, asid = 4294967295 } : error  { count = 1, transaction: 0, voucher = 0x0, contents =
	"XPCErrorDescription" =>  { length = 22, contents = "Connection interrupted" }
}
auto-cancelling  { name = com.apple.audio.AudioQueueServer, listener = false, pid = 0, euid = 4294967295, egid = 4294967295, asid = 4294967295 }
AVAudioSession_iOS.mm:1,043 AudioSessionGetProperty (CurrentOutputLatency) failed with error: -50
AVAudioSession_iOS.mm:2,017 Failed to get category, error: -50
AVAudioSession_iOS.mm:1,043 AudioSessionGetProperty (CurrentOutputSampleRate) failed with error: -50
Audio latency reported as 0 ms
FMOD clock synchronized to 24.7770
AVAudioSession_iOS.mm:2,290 Failed to set properties, error: -50
ERROR while setting AVAudioSession category: Error Domain=NSOSStatusErrorDomain Code=-50 "(null)"
Audio engine cannot start. Error: Error Domain=NSOSStatusErrorDomain Code=-50 "(null)"
ERROR: Audio engine cannot start. Error: Error Domain=NSOSStatusErrorDomain Code=-50 "(null)"
ERROR: Audio engine cannot start. Error: Error Domain=NSOSStatusErrorDomain Code=-50 "(null)"
Tearing down FMOD system
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/src/fmod_codec.cpp:29 Codec::release -
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/src/fmod_codec.cpp:102 Codec::release - done
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/src/fmod_codec.cpp:29 Codec::release -
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/src/fmod_codec.cpp:102 Codec::release - done
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/src/fmod_codec.cpp:29 Codec::release -
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/src/fmod_codec.cpp:102 Codec::release - done
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/src/fmod_codec.cpp:29 Codec::release -
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/src/fmod_codec.cpp:102 Codec::release - done
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/src/fmod_codec.cpp:29 Codec::release -
[...omitting many more of these Codec::release lines...]
rebuilding null connection
FMOD::Debug - /opt/teamcity-agent/work/b8b6893b00c565e4/core_api/src/fmod_codec.cpp:102 Codec::release - done
FMOD::System->release() - No errors.
AVAudioSession_iOS.mm:2,290 Failed to set properties, error: -50
ERROR while setting AVAudioSession category: Error Domain=NSOSStatusErrorDomain Code=-50 "(null)"
Initializing AudioManager with mode = cordova
Initializing FMOD Cordova plugin with API version 8
AVAudioSession_iOS.mm:1,043 AudioSessionGetProperty (CurrentAudioHardwareOutputNumberChannels) failed with error: -50
AVAudioSession_iOS.mm:2,017 Failed to get category, error: -50
AVAudioSession_iOS.mm:1,043 AudioSessionGetProperty (CurrentOutputSampleRate) failed with error: -50
AVAudioSession_iOS.mm:2,017 Failed to get category, error: -50
AVAudioSession_iOS.mm:1,043 AudioSessionGetProperty (CurrentOutputSampleRate) failed with error: -50

Thank you for looking into that and sharing the log- it looks like something is wrong with mp3 decoding.
I am also seeing something about Cordova and an “FMOD Cordova plugin”. It appears you are using the native FMOD API, but as far as I understand an FMOD Cordova plugin would be a way to interact with FMOD via WebAssembly/javascript.
It’s probably unrelated, but if there is WebAssembly involved that opens up another class of possible problems. Can you please tell me more about how this FMOD Cordova plugin fits into things?

There’s no WebAssembly involved, rather the Cordova plugin (which I wrote) is basically a Javascript “bridge” between the JS code and iOS code. The plugin accepts commands from the JS side (like “initialize system” or “play this sample at this time with these parameters” and passes them onto a Swift module. That module in turn sends commands to the FMOD API via some thin Objective-C wrappers. I built and tested these modules and wrappers exclusively with native code (Swift & Objective-C) and then wrote a very thin wrapper interface for Cordova interoperability. Hope that makes sense. I don’t think it’s relevant to the issue at hand.

Okay cool makes sense, thank you for clarifying- I agree this is probably unrelated.
In that case, I don’t see anything else to go off with these logs, and everything seems to be pointing towards an issue with iOS17 and not FMOD. I am finding that FMOD recovers correctly from a failure to resume the mixer, so I agree the fatal aspect appears to be inside iOS itself.

If you find yourself with time to send over a minimal reproduction at some point I would be interested in taking a look and trying to get to the bottom of this issue, but aside from that I’m not sure what else we can do to investigate this further.

So I tried to use one of my “Technical Support Incidents” with Apple on this issue. They basically said “sounds like a bug, so go submit a bug report”. Which I’ve done. Fingers crossed somebody actually takes it seriously over there…

Anyway, as part of that I did put together a reproduction Xcode project. Can’t post it publicly but would be happy to share it with you or your team directly; just let me know. I’ve found that running it alone doesn’t trigger the error (probably due to the relative simplicity of what it’s doing with FMOD) but if I run it alongside my production app they will both lead to a Core Audio crash simultaneously, in the same way. I have instructions for this in the Readme.md of my repo project.

Thank you for the additional information, and for offering to share your repro. I would certainly like to take a look- if you could please send it to us privately by uploading it to your FMOD Profile I will see if I can get more information on why our audio unit isn’t restarting.

It’s uploaded! Let me know if you have any questions… feel free to DM me as well.

1 Like

Thank you very much for the repro- with this I have narrowed down the problem a bit more, and it appears to be caused by the iOS media service being reset. I am finding I can reproduce this issue in any FMOD application by hitting the “Reset Media Service” button in the iOS Developer settings application, which sends out this this notification: AVAudioSessionMediaServicesWereResetNotification.

When this reset event occurs, the audio session is invalidated, and the only thing you can do is to reinitialize all of your application’s audio objects, as you are doing. It is not clear to me why this reset notification is suddenly showing up more frequently- we have had a few other reports of this issue now; but it seems the only workaround at the moment would be to handle this media service reset when the AVAudioSessionMediaServicesWereResetNotification occurs. I have passed this onto the Dev team to explore the possibility of handling the reset notification ourselves, or at least adding some documentation on what to do to handle this situation. In any case, thank you for your assistance with investigating this issue, and thank you for bringing it to our attention.

1 Like

Amazing! I’m impressed that you guys were able to track this down. :smiley: