diff options
-rw-r--r-- | indra/llwebrtc/llwebrtc.cpp | 40 |
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); + } + } + }); } // |