diff --git a/indra/llaudio/llaudioengine_fmodstudio.cpp b/indra/llaudio/llaudioengine_fmodstudio.cpp index fab0bfabda..ddac609b85 100644 --- a/indra/llaudio/llaudioengine_fmodstudio.cpp +++ b/indra/llaudio/llaudioengine_fmodstudio.cpp @@ -135,7 +135,7 @@ static FMOD_RESULT F_CALL systemCallback(FMOD_SYSTEM *system, FMOD_SYSTEM_CALLBA { // [FIRE-36022] - Removing my USB headset crashes entire viewer // Attempt to lock the access to the audio device, wait up to 3 seconds for other threads to unlock. - std::unique_lock lock(iAudioDeviceMutex, 3s); + std::unique_lock lock(gAudioDeviceMutex, 3s); // If the lock could not be accessed, return as we don't have hardware access and will need to try again another pass. // Prevents threads from interacting with the hardware at the same time as other audio/voice threads. if (!lock.owns_lock()) @@ -430,7 +430,7 @@ void LLAudioEngine_FMODSTUDIO::setDevice(const LLUUID& device_uuid) try // Try catch needed for uniquie lock as will throw an exception if a second lock is attempted or the mutex is invalid { // Attempt to lock the access to the audio device, wait up to 3 seconds for other threads to unlock. - std::unique_lock lock(iAudioDeviceMutex, 3s); + std::unique_lock lock(gAudioDeviceMutex, 3s); // If the lock could not be accessed, return as we don't have hardware access and will need to try again another pass. // Prevents threads from interacting with the hardware at the same time as other audio/voice threads. if (!lock.owns_lock()) diff --git a/indra/llcommon/inlinemutexs.h b/indra/llcommon/inlinemutexs.h index 38030f88e7..3b8ab5c4ef 100644 --- a/indra/llcommon/inlinemutexs.h +++ b/indra/llcommon/inlinemutexs.h @@ -35,5 +35,5 @@ // Audio device mutex to be shared between audio engine and Voice systems to // syncronize on when audio hardware accessed for disconnected/connecting hardware // Uses Timed Mutex so as to not lockup the threads forever. -inline std::timed_mutex iAudioDeviceMutex; +inline std::timed_mutex gAudioDeviceMutex; #endif diff --git a/indra/llwebrtc/llwebrtc.cpp b/indra/llwebrtc/llwebrtc.cpp index 4aeb152278..26e05118da 100644 --- a/indra/llwebrtc/llwebrtc.cpp +++ b/indra/llwebrtc/llwebrtc.cpp @@ -48,7 +48,7 @@ // Audio device mutex to be shared between audio engine and Voice systems to // syncronize on when audio hardware accessed for disconnected/connecting hardware // Uses Timed Mutex so as to not lockup the threads forever. -inline std::timed_mutex iAudioDeviceMutex; +inline std::timed_mutex gAudioDeviceMutex; // Need to use to access the 3 second timeout for the lock. using namespace std::chrono_literals; // [FIRE-36022] @@ -478,7 +478,7 @@ void LLWebRTCImpl::workerDeployDevices() try // Try catch needed for uniquie lock as will throw an exception if a second lock is attempted or the mutex is invalid { // Attempt to lock the access to the audio device, wait up to 3 seconds for other threads to unlock. - std::unique_lock lock(iAudioDeviceMutex, 3s); + std::unique_lock lock(gAudioDeviceMutex, 3s); // If the lock could not be accessed, return as we don't have hardware access and will need to try again another pass. // Prevents threads from interacting with the hardware at the same time as other audio/voice threads. if (!lock.owns_lock()) @@ -490,7 +490,7 @@ void LLWebRTCImpl::workerDeployDevices() { // [FIRE-36022] // If the device is not avaiable, then make sure the flag for the WebRTC updated devices flag is turned off for the co-routine - iWebRTCUpdateDevices = false; + gWebRTCUpdateDevices = false; // [FIRE-36022] - Removing my USB headset crashes entire viewer return; } @@ -518,7 +518,7 @@ void LLWebRTCImpl::workerDeployDevices() // [FIRE-36022] - Removing my USB headset crashes entire viewer // Flag the device is being interacted with for the Co-routine in case something goes wrong. - iWebRTCUpdateDevices = true; + gWebRTCUpdateDevices = true; // [FIRE-36022] mDeviceModule->StopPlayout(); mDeviceModule->ForceStopRecording(); @@ -585,7 +585,7 @@ void LLWebRTCImpl::workerDeployDevices() } // [FIRE-36022] - Removing my USB headset crashes entire viewer // Finally signal to the co-routine everyting is OK. - iWebRTCUpdateDevices = false; + gWebRTCUpdateDevices = false; // [FIRE-36022] mSignalingThread->PostTask( [this] @@ -628,14 +628,14 @@ void LLWebRTCImpl::workerDeployDevices() mLogSink->OnLogMessage(std::string("Excepton: WebRTC: ") + e.what()); } // Device no longer being interacted with - iWebRTCUpdateDevices = false; + gWebRTCUpdateDevices = false; return; } catch (const std::exception& e) { mLogSink->OnLogMessage(std::string("Excepton: WebRTC: ") + e.what()); // Device no longer being interacted with - iWebRTCUpdateDevices = false; + gWebRTCUpdateDevices = false; return; } // [FIRE-36022] @@ -661,7 +661,7 @@ void LLWebRTCImpl::updateDevices() try // Try catch needed for uniquie lock as will throw an exception if a second lock is attempted or the mutex is invalid { // Attempt to lock the access to the audio device, wait up to 3 seconds for other threads to unlock. - std::unique_lock lock(iAudioDeviceMutex, 3s); + std::unique_lock lock(gAudioDeviceMutex, 3s); // If the lock could not be accessed, return as we don't have hardware access and will need to try again another pass. // Prevents threads from interacting with the hardware at the same time as other audio/voice threads. if (!lock.owns_lock()) @@ -676,7 +676,7 @@ void LLWebRTCImpl::updateDevices() // [FIRE-36022] - Removing my USB headset crashes entire viewer // Flag the device is being interacted with for the Co-routine in case something goes wrong. - iWebRTCUpdateDevices = true; + gWebRTCUpdateDevices = true; // [FIRE-36022] int16_t renderDeviceCount = mDeviceModule->PlayoutDevices(); @@ -716,7 +716,7 @@ void LLWebRTCImpl::updateDevices() // [FIRE-36022] - Removing my USB headset crashes entire viewer // Flag the device is no longer being interacted with for the Co-routine in case something goes wrong. - iWebRTCUpdateDevices = false; + gWebRTCUpdateDevices = false; // [FIRE-36022] for (auto &observer : mVoiceDevicesObserverList) { @@ -743,14 +743,14 @@ void LLWebRTCImpl::updateDevices() mLogSink->OnLogMessage(std::string("Excepton: WebRTC: ") + e.what()); } // Device no longer being interacted with - iWebRTCUpdateDevices = false; + gWebRTCUpdateDevices = false; return; } catch (const std::exception& e) { mLogSink->OnLogMessage(std::string("Excepton: WebRTC: ") + e.what()); // Device no longer being interacted with - iWebRTCUpdateDevices = false; + gWebRTCUpdateDevices = false; return; } // [FIRE-36022] @@ -856,7 +856,7 @@ void LLWebRTCImpl::intSetMute(bool mute, int delay_ms) // invalid { // Attempt to lock the access to the audio device, wait up to 3 seconds for other threads to unlock. - std::unique_lock lock(iAudioDeviceMutex, 3s); + std::unique_lock lock(gAudioDeviceMutex, 3s); // If the lock could not be accessed, return as we don't have hardware access and will need to try again another pass. // Prevents threads from interacting with the hardware at the same time as other audio/voice threads. if (!lock.owns_lock()) @@ -864,12 +864,12 @@ void LLWebRTCImpl::intSetMute(bool mute, int delay_ms) return; } // Flag the device is being interacted with for the Co-routine in case something goes wrong. - iWebRTCUpdateDevices = true; + gWebRTCUpdateDevices = true; // [FIRE-36022] mDeviceModule->ForceStopRecording(); // [FIRE-36022] - Removing my USB headset crashes entire viewer // Finally signal to the co-routine everyting is OK. - iWebRTCUpdateDevices = false; + gWebRTCUpdateDevices = false; } // There are two exceptions that unique_lock can trigger, operation_not_permitted or resource_deadlock_would_occur catch (const std::system_error& e) @@ -890,14 +890,14 @@ void LLWebRTCImpl::intSetMute(bool mute, int delay_ms) mLogSink->OnLogMessage(std::string("Excepton: WebRTC: ") + e.what()); } // Device no longer being interacted with - iWebRTCUpdateDevices = false; + gWebRTCUpdateDevices = false; return; } catch (const std::exception& e) { mLogSink->OnLogMessage(std::string("Excepton: WebRTC: ") + e.what()); // Device no longer being interacted with - iWebRTCUpdateDevices = false; + gWebRTCUpdateDevices = false; return; } // [FIRE-36022] @@ -917,7 +917,7 @@ void LLWebRTCImpl::intSetMute(bool mute, int delay_ms) // invalid { // Attempt to lock the access to the audio device, wait up to 3 seconds for other threads to unlock. - std::unique_lock lock(iAudioDeviceMutex, 3s); + std::unique_lock lock(gAudioDeviceMutex, 3s); // If the lock could not be accessed, return as we don't have hardware access and will need to try again another pass. // Prevents threads from interacting with the hardware at the same time as other audio/voice threads. if (!lock.owns_lock()) @@ -925,13 +925,13 @@ void LLWebRTCImpl::intSetMute(bool mute, int delay_ms) return; } // Flag the device is being interacted with for the Co-routine in case something goes wrong. - iWebRTCUpdateDevices = true; + gWebRTCUpdateDevices = true; // [FIRE-36022] mDeviceModule->InitRecording(); mDeviceModule->ForceStartRecording(); // [FIRE-36022] - Removing my USB headset crashes entire viewer // Finally signal to the co-routine everyting is OK. - iWebRTCUpdateDevices = false; + gWebRTCUpdateDevices = false; } // There are two exceptions that unique_lock can trigger, operation_not_permitted or resource_deadlock_would_occur catch (const std::system_error& e) @@ -952,14 +952,14 @@ void LLWebRTCImpl::intSetMute(bool mute, int delay_ms) mLogSink->OnLogMessage(std::string("Excepton: WebRTC: ") + e.what()); } // Device no longer being interacted with - iWebRTCUpdateDevices = false; + gWebRTCUpdateDevices = false; return; } catch (const std::exception& e) { mLogSink->OnLogMessage(std::string("Excepton: WebRTC: ") + e.what()); // Device no longer being interacted with - iWebRTCUpdateDevices = false; + gWebRTCUpdateDevices = false; return; } // [FIRE-36022] diff --git a/indra/llwebrtc/llwebrtc.h b/indra/llwebrtc/llwebrtc.h index 572f5ecce9..acd3b686fa 100644 --- a/indra/llwebrtc/llwebrtc.h +++ b/indra/llwebrtc/llwebrtc.h @@ -61,7 +61,7 @@ // Create an atomic inline flag that will be shared between the various WebRTC threads and co-routines // to track of when the audio hardware is being talked to. The co-routine can use it to // exit if it too many iterations with the hardware locked indicating that the worker thread died. -inline std::atomic iWebRTCUpdateDevices = false; +inline std::atomic gWebRTCUpdateDevices = false; // [FIRE-36022] namespace llwebrtc { diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 11f0c96083..3c8b091a48 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -2420,7 +2420,7 @@ void LLVivoxVoiceClient::sendCaptureAndRenderDevices() try // Try catch needed for uniquie lock as will throw an exception if a second lock is attempted or the mutex is invalid { // Attempt to lock the access to the audio device, wait up to 3 seconds for other threads to unlock. - std::unique_lock lock(iAudioDeviceMutex, 3s); + std::unique_lock lock(gAudioDeviceMutex, 3s); // If the lock could not be accessed, return as we don't have hardware access and will need to try again another pass. // Prevents threads from interacting with the hardware at the same time as other audio/voice threads. if (!lock.owns_lock()) diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index c7d04fd5bf..2d13a62904 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -602,7 +602,7 @@ void LLWebRTCVoiceClient::voiceConnectionCoro() } // [FIRE-36022] - Removing my USB headset crashes entire viewer // If the device locked, count up by 1 - if (iWebRTCUpdateDevices) + if (gWebRTCUpdateDevices) { crash_check++; } @@ -764,7 +764,7 @@ void LLWebRTCVoiceClient::OnDevicesChangedImpl(const llwebrtc::LLWebRTCVoiceDevi try // Try catch needed for uniquie lock as will throw an exception if a second lock is attempted or the mutex is invalid { // Attempt to lock the access to the audio device, wait up to 3 seconds for other threads to unlock. - std::unique_lock lock(iAudioDeviceMutex, 3s); + std::unique_lock lock(gAudioDeviceMutex, 3s); // If the lock could not be accessed, return as we don't have hardware access and will need to try again another pass. // Prevents threads from interacting with the hardware at the same time as other audio/voice threads. if (!lock.owns_lock())