summaryrefslogtreecommitdiff
path: root/indra/llwebrtc
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llwebrtc')
-rw-r--r--indra/llwebrtc/llwebrtc.cpp22
-rw-r--r--indra/llwebrtc/llwebrtc.h1
-rw-r--r--indra/llwebrtc/llwebrtc_impl.h1
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.