Changed iWebRTCUpdateDevices and iAudioDeviceMutex to gWebRTCUpdateDevicesand gAudioDeviceMutex to follow Firestorm coding standards.
They are global static variables.
Added three FMOD specific changes based upon reading the FMOD manual.
See: https://www.fmod.com/docs/2.00/api/platforms-win.html
As well, switched to using the FMOD log version of the library and found one error on the get advanced features.
Also, the call back method should be a static method. Just being cautious.
As with the previous change, this is to address the issue FIRE-36022 where users who remove their USB headsets with microphones are having the viewer lock up.
This introduces a new inline mutex called iAudioDeviceMutex. This is stored in a shared header file located on llcommon. iAudioDeviceMutex is a timed_mutex which allows for a time limit to be placed on a wait for a lock. Once the time runs out or the lock is achiveved the code moves on. With a check after the lock, if the owner is the current thread, then the lock was successful, otherwise it's still being used by another thread and the function should exit to try again later on.
This logic is wrapping WebRTC, FMOD and Vinvox calls to the audio hardware by the Viewer. OpenAL does not currently support changing of audio hardware and always defaults to the default audio hardware.
Added exceptions handling for the new unique_lock with the timed_mutex as they can throw 2 exceptions if the thread is already locked by the current thread and if the mutex is invalid.
Further testing may reveal other areas which would need the timed_mutex added to protect from threads locking up.
The work queue callback binds "this". This is deemed safe due to current dependencies, but see the associated comment in the return callback. There was some trial and error to get a this-binded lambda to compile.
Due to LLVorbisDecodeState writing to disk off-thread, limit audio decodes proportional to general worker thread count. Guess the thread count for now.
This reverts commits b21c17eee9 and 2f78338aeb.
'Debug Fmod' was not an intended commit, was meant for local testing. But might be a good idea to make this a part of DebWithRelInfo or provide a cmake switch.
This particular case of LLAPRFile crashes due to thread issues (and if it doesn't it might be affecting some other apr call due to using default pool).
Function is not opening the .dsf file in question and LLAPRFile won't ensure that file exists till the end of the function, it just checks that file exists at a given moment. No point to overcomplicate things by adding thread safe pool, so replaced with dirutil.
This particular case of LLAPRFile crashes due to thread issues (and if it doesn't it might be affecting some other apr call due to using default pool).
Function is not opening the .dsf file in question and LLAPRFile won't ensure that file exists till the end of the function, it just checks that file exists at a given moment. No point to overcomplicate things by adding thread safe pool, so replaced with dirutil.
Selecting "Default" will always select the first output device; if the available
devices change and the previous default device isn't available anymore, the
viewer automatically switches to the new default device (depends on the OS which
gets the new default one!). Selecting a particular device will NOT automatically
switch to another device if it isn't available anymore (preferences will show
"Unavailable device"), but will switch back to this device once it becomes
available again.
Yank this change before Firestorm releases it and I will gladly yank your unreleased stuff!