summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Nikolenko <maximnproductengine@lindenlab.com>2026-01-26 16:32:00 +0200
committerGitHub <noreply@github.com>2026-01-26 16:32:00 +0200
commitd13c442923ad37bd1133ddc39fc54c7d8627a599 (patch)
treedf13ed971c4855967b21cedc19eeed32bad250d8
parentc7e1d9f5d985bce651de23fb0a6c0a62bf843324 (diff)
#5314 fix WebRTC voice being muted after quickly toggling the Speak button
-rw-r--r--indra/llwebrtc/llwebrtc.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/indra/llwebrtc/llwebrtc.cpp b/indra/llwebrtc/llwebrtc.cpp
index 8e08239ee6..39cecbda25 100644
--- a/indra/llwebrtc/llwebrtc.cpp
+++ b/indra/llwebrtc/llwebrtc.cpp
@@ -733,12 +733,17 @@ void LLWebRTCImpl::intSetMute(bool mute, int delay_ms)
{
mPeerCustomProcessor->setGain(mMute ? 0.0f : mGain);
}
+
+ // Sequence counter to prevent race conditions from rapid requests to mute/unmute
+ static std::atomic<uint32_t> mute_sequence(0);
+ uint32_t current_sequence = ++mute_sequence;
+
if (mMute)
{
mWorkerThread->PostDelayedTask(
- [this]
+ [this, current_sequence]
{
- if (mDeviceModule)
+ if (mDeviceModule && (current_sequence == mute_sequence.load()))
{
mDeviceModule->ForceStopRecording();
}
@@ -748,9 +753,9 @@ void LLWebRTCImpl::intSetMute(bool mute, int delay_ms)
else
{
mWorkerThread->PostTask(
- [this]
+ [this, current_sequence]
{
- if (mDeviceModule)
+ if (mDeviceModule && (current_sequence == mute_sequence.load()))
{
mDeviceModule->InitRecording();
mDeviceModule->ForceStartRecording();