Skip to content

Commit f05f282

Browse files
Tony HerreWebRTC LUCI CQ
authored andcommitted
Allow setting volume on unstarted AudioRtpReceivers
This was the behaviour before https://webrtc-review.googlesource.com/c/src/+/218605, and is currently relied upon by Chrome to mute received audio tracks by default, until they should be played out. Bug: chromium:1272566 Change-Id: I8a288a287e7c01392f4af1db5b083e8d7ee7b2a8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/238665 Commit-Queue: Tony Herre <[email protected]> Reviewed-by: Tommi <[email protected]> Cr-Commit-Position: refs/heads/main@{#35401}
1 parent a9730e5 commit f05f282

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pc/audio_rtp_receiver.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,14 @@ void AudioRtpReceiver::OnSetVolume(double volume) {
9393
RTC_DCHECK_RUN_ON(&signaling_thread_checker_);
9494
RTC_DCHECK_GE(volume, 0);
9595
RTC_DCHECK_LE(volume, 10);
96-
if (stopped_)
97-
return;
9896

97+
// Update the cached_volume_ even when stopped_, to allow clients to set the
98+
// volume before starting/restarting, eg see crbug.com/1272566.
9999
cached_volume_ = volume;
100100

101+
if (stopped_)
102+
return;
103+
101104
// When the track is disabled, the volume of the source, which is the
102105
// corresponding WebRtc Voice Engine channel will be 0. So we do not allow
103106
// setting the volume to the source when the track is disabled.

0 commit comments

Comments
 (0)