Skip to content

Commit

Permalink
Allow setting volume on unstarted AudioRtpReceivers
Browse files Browse the repository at this point in the history
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 <toprice@chromium.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35401}
  • Loading branch information
Tony Herre authored and WebRTC LUCI CQ committed Nov 22, 2021
1 parent a9730e5 commit f05f282
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pc/audio_rtp_receiver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,14 @@ void AudioRtpReceiver::OnSetVolume(double volume) {
RTC_DCHECK_RUN_ON(&signaling_thread_checker_);
RTC_DCHECK_GE(volume, 0);
RTC_DCHECK_LE(volume, 10);
if (stopped_)
return;

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

if (stopped_)
return;

// When the track is disabled, the volume of the source, which is the
// corresponding WebRtc Voice Engine channel will be 0. So we do not allow
// setting the volume to the source when the track is disabled.
Expand Down

0 comments on commit f05f282

Please sign in to comment.