summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorRoxie Linden <roxie@lindenlab.com>2024-02-03 18:53:04 -0800
committerRoxie Linden <roxie@lindenlab.com>2024-02-22 23:11:37 -0800
commit9389532761ca3987a37a705d534f4ca62baf7697 (patch)
treeb5ea3ae4b30fd1ec86dc62de80abb0d428fde640 /indra
parentda7dfd8186d378b4d87f0bdecad29cf0f51e0793 (diff)
fix locking race condition
Diffstat (limited to 'indra')
-rw-r--r--indra/llwebrtc/llwebrtc.cpp40
1 files changed, 24 insertions, 16 deletions
diff --git a/indra/llwebrtc/llwebrtc.cpp b/indra/llwebrtc/llwebrtc.cpp
index fca490e8c2..900698aa56 100644
--- a/indra/llwebrtc/llwebrtc.cpp
+++ b/indra/llwebrtc/llwebrtc.cpp
@@ -673,20 +673,24 @@ void LLWebRTCPeerConnectionImpl::AnswerAvailable(const std::string &sdp)
void LLWebRTCPeerConnectionImpl::setMute(bool mute)
{
mMute = mute;
- if (mPeerConnection)
- {
- auto senders = mPeerConnection->GetSenders();
-
- RTC_LOG(LS_INFO) << __FUNCTION__ << (mute ? "disabling" : "enabling") << " streams count " << senders.size();
- for (auto &sender : senders)
+ mWebRTCImpl->PostSignalingTask(
+ [this]()
+ {
+ if (mPeerConnection)
{
- auto track = sender->track();
- if(track)
+ auto senders = mPeerConnection->GetSenders();
+
+ RTC_LOG(LS_INFO) << __FUNCTION__ << (mMute ? "disabling" : "enabling") << " streams count " << senders.size();
+ for (auto &sender : senders)
{
- track->set_enabled(!mMute);
+ auto track = sender->track();
+ if (track)
+ {
+ track->set_enabled(!mMute);
+ }
}
}
- }
+ });
}
void LLWebRTCPeerConnectionImpl::resetMute()
@@ -719,13 +723,17 @@ void LLWebRTCPeerConnectionImpl::setReceiveVolume(float volume)
void LLWebRTCPeerConnectionImpl::setSendVolume(float volume)
{
- if (mLocalStream)
- {
- for (auto &track : mLocalStream->GetAudioTracks())
+ mWebRTCImpl->PostSignalingTask(
+ [this, volume]()
{
- track->GetSource()->SetVolume(volume);
- }
- }
+ if (mLocalStream)
+ {
+ for (auto &track : mLocalStream->GetAudioTracks())
+ {
+ track->GetSource()->SetVolume(volume);
+ }
+ }
+ });
}
//