When testing our game on the PS4, we are noticing some poor performance issues, which can be pinpointed to our main thread halting and waiting for the FMOD update thread running in the background (entering critical sections).
Our own custom audio obstruction systems does a lot of FMOD_Studio_EventInstance_GetVolume and FMOD_Studio_EventInstance_SetVolume, and on each one of them, the main thread seems to have to wait for the FMOD update thread (see profiling data & callstack: Imgur: The magic of the Internet ). This does not only happen to these calls, but also to many other FMOD API calls unrelated to our audio obstruction system.
I’ve seen in this thread ( [Solved] Severe Performance Issue ) that it might have to do with the command queue being full. So I’ve checked that as well, but it seems that the command queue is never full, at least when I looked at the BufferUsage on a separate occasion (currentUsage not too high, stallcount and stalltime both 0) . Our command queue is already set pretty big at 4194304.
When looking into the profiling data, it’s obviously true that all our cores are pretty busy such that the FMOD thread doesn’t have a chance to update straight away after calling the GetVolume. However I would love to make it so that the main thread can run completely async from the FMOD update thread, even when calling FMOD functions.
We’re currently using Unity version 2019.4.10f1 with FMOD integration version 2.00.07. I’ve also tried upgrading FMOD to version 2.01.09, which didn’t seem to solve this problem.