diff options
author | Roxie Linden <roxie@lindenlab.com> | 2023-09-13 14:49:42 -0700 |
---|---|---|
committer | Roxie Linden <roxie@lindenlab.com> | 2024-02-22 23:11:33 -0800 |
commit | 8ba90d077381bf16b4ba03a0f530f76e770e69c1 (patch) | |
tree | 7fe5653bb09fbe43d2cbb266b6d78492445bae5d /indra/llwebrtc | |
parent | 5f267412f6f110a87583b547d27744d8760fc2ef (diff) |
Hook up speaker volume.
Diffstat (limited to 'indra/llwebrtc')
-rw-r--r-- | indra/llwebrtc/llwebrtc.cpp | 22 | ||||
-rw-r--r-- | indra/llwebrtc/llwebrtc.h | 1 | ||||
-rw-r--r-- | indra/llwebrtc/llwebrtc_impl.h | 1 |
3 files changed, 24 insertions, 0 deletions
diff --git a/indra/llwebrtc/llwebrtc.cpp b/indra/llwebrtc/llwebrtc.cpp index c2631b2ea3..93e9db9c1d 100644 --- a/indra/llwebrtc/llwebrtc.cpp +++ b/indra/llwebrtc/llwebrtc.cpp @@ -341,6 +341,28 @@ void LLWebRTCImpl::setMute(bool mute) }); } +void LLWebRTCImpl::setSpeakerVolume(float volume) +{ + mSignalingThread->PostTask( + [this, volume]() + { + auto receivers = mPeerConnection->GetReceivers(); + + RTC_LOG(LS_INFO) << __FUNCTION__ << "Set volume" << receivers.size(); + for (auto &receiver : receivers) + { + webrtc::MediaStreamTrackInterface *track = receiver->track().get(); + if (track->kind() == webrtc::MediaStreamTrackInterface::kAudioKind) + { + webrtc::AudioTrackInterface* audio_track = static_cast<webrtc::AudioTrackInterface*>(track); + webrtc::AudioSourceInterface* source = audio_track->GetSource(); + source->SetVolume(10.0 * volume); + + } + } + }); +} + // // PeerConnectionObserver implementation. // diff --git a/indra/llwebrtc/llwebrtc.h b/indra/llwebrtc/llwebrtc.h index acc3665e95..ca558add01 100644 --- a/indra/llwebrtc/llwebrtc.h +++ b/indra/llwebrtc/llwebrtc.h @@ -93,6 +93,7 @@ class LLWebRTCAudioInterface { public: virtual void setMute(bool mute) = 0; + virtual void setSpeakerVolume(float volume) = 0; // volume between 0.0 and 1.0 }; class LLWebRTCSignalingObserver diff --git a/indra/llwebrtc/llwebrtc_impl.h b/indra/llwebrtc/llwebrtc_impl.h index d439bd253d..5c6cfcdbc6 100644 --- a/indra/llwebrtc/llwebrtc_impl.h +++ b/indra/llwebrtc/llwebrtc_impl.h @@ -125,6 +125,7 @@ class LLWebRTCImpl : public LLWebRTCDeviceInterface, // LLWebRTCAudioInterface // void setMute(bool mute) override; + void setSpeakerVolume(float folume) override; // range 0.0-1.0 // // PeerConnectionObserver implementation. |