From e5a95a96bface28bbd37afe655209d04f03cd250 Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Fri, 1 Dec 2023 01:28:38 -0800 Subject: Setting volume for remote stream needs to happen in signaling thread --- indra/llwebrtc/llwebrtc.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'indra/llwebrtc') diff --git a/indra/llwebrtc/llwebrtc.cpp b/indra/llwebrtc/llwebrtc.cpp index 4741ed92a3..2bcbb135c0 100644 --- a/indra/llwebrtc/llwebrtc.cpp +++ b/indra/llwebrtc/llwebrtc.cpp @@ -620,26 +620,29 @@ void LLWebRTCPeerConnectionImpl::setMute(bool mute) void LLWebRTCPeerConnectionImpl::setReceiveVolume(float volume) { - auto receivers = mPeerConnection->GetReceivers(); - - for (auto &receiver : receivers) - { - for (auto& stream : receiver->streams()) + mWebRTCImpl->PostSignalingTask( + [this, volume]() { - for (auto& track : stream->GetAudioTracks()) + auto receivers = mPeerConnection->GetReceivers(); + + for (auto &receiver : receivers) { - track->GetSource()->SetVolume(volume); + for (auto &stream : receiver->streams()) + { + for (auto &track : stream->GetAudioTracks()) + { + track->GetSource()->SetVolume(volume); + } + } } - } - } + }); } void LLWebRTCPeerConnectionImpl::setSendVolume(float volume) { if (mLocalStream) { - auto track = mLocalStream->FindAudioTrack("SLStream"); - if (track) + for (auto &track : mLocalStream->GetAudioTracks()) { track->GetSource()->SetVolume(volume); } -- cgit v1.2.3