Index: webrtc/media/engine/webrtcvoiceengine.cc |
diff --git a/webrtc/media/engine/webrtcvoiceengine.cc b/webrtc/media/engine/webrtcvoiceengine.cc |
index eb9b4bb3569ce01f175d1f80988f0aefd21a4820..2ddf67dd3a6d76d70236b8562cf2d5d8208bbd70 100644 |
--- a/webrtc/media/engine/webrtcvoiceengine.cc |
+++ b/webrtc/media/engine/webrtcvoiceengine.cc |
@@ -1341,6 +1341,11 @@ class WebRtcVoiceMediaChannel::WebRtcAudioReceiveStream { |
stream_->SetSink(std::move(sink)); |
} |
+ void SetOutputVolume(double volume) { |
+ RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
+ stream_->SetGain(volume); |
+ } |
+ |
private: |
void RecreateAudioReceiveStream( |
uint32_t local_ssrc, |
@@ -2270,19 +2275,14 @@ bool WebRtcVoiceMediaChannel::SetOutputVolume(uint32_t ssrc, double volume) { |
} |
ssrc = static_cast<uint32_t>(default_recv_ssrc_); |
} |
- int ch_id = GetReceiveChannelId(ssrc); |
- if (ch_id < 0) { |
- LOG(LS_WARNING) << "Cannot find channel for ssrc:" << ssrc; |
- return false; |
- } |
- |
- if (-1 == engine()->voe()->volume()->SetChannelOutputVolumeScaling(ch_id, |
- volume)) { |
- LOG_RTCERR2(SetChannelOutputVolumeScaling, ch_id, volume); |
+ const auto it = recv_streams_.find(ssrc); |
+ if (it == recv_streams_.end()) { |
+ LOG(LS_WARNING) << "SetOutputVolume: no recv stream" << ssrc; |
return false; |
} |
- LOG(LS_INFO) << "SetOutputVolume to " << volume |
- << " for channel " << ch_id << " and ssrc " << ssrc; |
+ it->second->SetOutputVolume(volume); |
+ LOG(LS_INFO) << "SetOutputVolume() to " << volume |
+ << " for recv stream with ssrc " << ssrc; |
return true; |
} |