Maintain audio receive stream gain across recreations
When a receive stream is created its internal Channel defaults to a gain of 1.0. If a gain has been set for the stream, but it needs to be recreated internally, its volume will not carry over but reset to 1.0. This CL fixes that, for now. Ideally, we'd not recreate these streams internally. Bug: chromium:810848 Change-Id: Ia2ce87a39f1f4d7d3596c1b5ab256b10bdbca3c3 Reviewed-on: https://webrtc-review.googlesource.com/54402 Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org> Commit-Queue: Oskar Sundbom <ossu@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22156}
This commit is contained in:

committed by
Commit Bot

parent
415920b053
commit
c66810830c
@ -1195,6 +1195,7 @@ class WebRtcVoiceMediaChannel::WebRtcAudioReceiveStream {
|
||||
|
||||
void SetOutputVolume(double volume) {
|
||||
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
|
||||
output_volume_ = volume;
|
||||
stream_->SetGain(volume);
|
||||
}
|
||||
|
||||
@ -1223,6 +1224,7 @@ class WebRtcVoiceMediaChannel::WebRtcAudioReceiveStream {
|
||||
}
|
||||
stream_ = call_->CreateAudioReceiveStream(config_);
|
||||
RTC_CHECK(stream_);
|
||||
stream_->SetGain(output_volume_);
|
||||
SetPlayout(playout_);
|
||||
stream_->SetSink(raw_audio_sink_.get());
|
||||
}
|
||||
@ -1240,6 +1242,7 @@ class WebRtcVoiceMediaChannel::WebRtcAudioReceiveStream {
|
||||
// configuration changes.
|
||||
webrtc::AudioReceiveStream* stream_ = nullptr;
|
||||
bool playout_ = false;
|
||||
float output_volume_ = 1.0;
|
||||
std::unique_ptr<webrtc::AudioSinkInterface> raw_audio_sink_;
|
||||
|
||||
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcAudioReceiveStream);
|
||||
|
Reference in New Issue
Block a user