[iOS] change to setDSPBufferSize causing increased occurrence of 'Error initializing output device.'

Recently we have changed the DSP buffer size in an iOS application in order to reduce audio latency, but have found that the FMOD error ‘Error initializing output device.’ seems to be occurring at a much higher rate than before.

The only change we have made was to add

fmodSystem->setDSPBufferSize(256, 4);

whereas this was previously not stated (I presume therefore using the default of 1024, 4)

Is there any reason that decreasing the buffer size would cause this issue to occur at a much higher rate? (~5000% increase in rate of the issue/crash) or anything I could do to investigate further?
I’ve confirmed on all known hardware that this isn’t related to a specific device or iOS version.

Additionally is there any solution to this or steps that should be taken if the output device can’t be initialized on iOS?

The used FMOD version is 0x00010815

Are you getting any errors or warnings in the log from the device?

Unfortunately not, these are just coming in logged via analytics and not something we’ve ever reproduced.
Is there anything I could log from FMOD that could further diagnose this?

Without the logging libs it may be difficult to find out more information.
If you have any more information that comes in with that error it may help.

You could check the result of setDSPBufferSize, if it is failing there it may give some more information.

Sorry to resurrect this topic, but I’ve FINALLY got a log from a reproduction (by chance, it isn’t consistently reproduceable)

It may or may not be related to the issue at hand however it presents the same crash and result.
Is this of any use? I presume not without logging libraries…

2019-02-25 12:00:46.934935+0000 [redacted][4219:930887] [aurioc] 1029: failed: ‘!pla’ (enable 2, outf< 2 ch, 48000 Hz, Float32, inter> inf< 2 ch, 0 Hz, Float32, non-inter>)

FMOD error! Error initializing output device.libc++abi.dylib: terminating with uncaught exception of type std::runtime_error: FMOD error! Error initializing output device.

Make sure that your AudioSession is configured correctly, as FMOD does not handle that.

https://developer.apple.com/library/archive/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/AudioSessionBasics/AudioSessionBasics.html

What does ‘correctly’ mean in this case? Is the default Audio session configuration (as pointed out in that link) not sufficient? And in what cases?

The app in question does not use any recording and merely plays back audio.

Sorry I could have been clearer, ‘correctly’ meaning the required configuration for your specific app.
If the default is all you require then that should not be an issue.

This post may be relevant: FMOD fails to initialize on iOS after shutting down then quickly restarting app

We aren’t however in need of anything beyond default AudioSession and this working fine for us in most cases. (There is no code to get a session or to set it active). However the issue in the OP is still happening.

Based on the linked question, do we need to always create an AudioSession even if the default one is sufficient and to handle error cases for it? This seems somewhat strange as this requirement is not documented. (We have no plans to change any audiosession parameters or configuration and therefore do not need to manually set one active)

… cases where the phone has transitioned to the foreground but as far as the audio system is concerned it is still backgrounded causing the AudioSession errors.

iOS will not allow FMOD to run in the background.

To avoid this you will either need to change the AudioSession category or, as mentioned in the linked post, close and retry initializing the FMOD System.