diff options
author | Roxie Linden <roxie@lindenlab.com> | 2023-12-04 14:22:40 -0800 |
---|---|---|
committer | Roxie Linden <roxie@lindenlab.com> | 2024-02-22 23:11:35 -0800 |
commit | 4f4f9032cb56712b2b514b5eea46ddda54b4094b (patch) | |
tree | 753284bca6bf6f1911879396edd5fe2433fc4752 /indra/llwebrtc | |
parent | e5a95a96bface28bbd37afe655209d04f03cd250 (diff) |
Mute using enable.
Muting using the device module microphone mute was muting other
applications, speakers, and so on. Instead, we mute by enabling/disabling
the input and output streams.
Diffstat (limited to 'indra/llwebrtc')
-rw-r--r-- | indra/llwebrtc/llwebrtc.cpp | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/indra/llwebrtc/llwebrtc.cpp b/indra/llwebrtc/llwebrtc.cpp index 2bcbb135c0..9fd8fd8ee6 100644 --- a/indra/llwebrtc/llwebrtc.cpp +++ b/indra/llwebrtc/llwebrtc.cpp @@ -287,16 +287,11 @@ void LLWebRTCImpl::setRenderDevice(const std::string &id) break; } } - mTuningDeviceModule->SetSpeakerMute(true); bool was_tuning_playing = mTuningDeviceModule->Playing(); if (was_tuning_playing) { mTuningDeviceModule->StopPlayout(); } - if (mPeerDeviceModule) - { - mPeerDeviceModule->SetSpeakerMute(true); - } mTuningDeviceModule->SetPlayoutDevice(tuningPlayoutDevice); mTuningDeviceModule->InitSpeaker(); @@ -326,10 +321,8 @@ void LLWebRTCImpl::setRenderDevice(const std::string &id) mPeerDeviceModule->InitSpeaker(); mPeerDeviceModule->InitPlayout(); mPeerDeviceModule->StartPlayout(); - mPeerDeviceModule->SetSpeakerMute(false); } - mTuningDeviceModule->SetSpeakerMute(false); }); } @@ -369,29 +362,25 @@ void LLWebRTCImpl::setTuningMode(bool enable) { mTuningDeviceModule->StartRecording(); - mTuningDeviceModule->SetMicrophoneMute(false); - - - mTuningDeviceModule->SetSpeakerMute(false); if (mPeerDeviceModule) { mPeerDeviceModule->StopRecording(); - mPeerDeviceModule->SetSpeakerMute(true); } } else { + mTuningDeviceModule->StartRecording(); if (mPeerDeviceModule) { mPeerDeviceModule->StartRecording(); - mPeerDeviceModule->SetSpeakerMute(false); } } }); for (auto& connection : mPeerConnections) { - connection->enableTracks(enable ? false : !mMute); + connection->enableSenderTracks(enable ? false : !mMute); + connection->enableReceiverTracks(!enable); } } @@ -409,7 +398,7 @@ LLWebRTCPeerConnection * LLWebRTCImpl::newPeerConnection() peerConnection->init(this); mPeerConnections.emplace_back(peerConnection); - peerConnection->enableTracks(!mMute); + peerConnection->enableSenderTracks(!mMute); return peerConnection.get(); } @@ -570,7 +559,7 @@ void LLWebRTCPeerConnectionImpl::shutdownConnection() }); } -void LLWebRTCPeerConnectionImpl::enableTracks(bool enable) +void LLWebRTCPeerConnectionImpl::enableSenderTracks(bool enable) { // set_enabled shouldn't be done on the worker thread if (mPeerConnection) @@ -583,6 +572,19 @@ void LLWebRTCPeerConnectionImpl::enableTracks(bool enable) } } +void LLWebRTCPeerConnectionImpl::enableReceiverTracks(bool enable) +{ + // set_enabled shouldn't be done on the worker thread + if (mPeerConnection) + { + auto receivers = mPeerConnection->GetReceivers(); + for (auto &receiver : receivers) + { + receiver->track()->set_enabled(enable); + } + } +} + void LLWebRTCPeerConnectionImpl::AnswerAvailable(const std::string &sdp) { RTC_LOG(LS_INFO) << __FUNCTION__ << " Remote SDP: " << sdp; |