Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(414)

Unified Diff: webrtc/media/engine/webrtcvoiceengine.cc

Issue 2062193002: Add AudioReceiveStream::SetGain() method and use that in WVoMC::SetOutputVolume(). (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: bad test Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/media/engine/fakewebrtcvoiceengine.h ('k') | webrtc/media/engine/webrtcvoiceengine_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « webrtc/media/engine/fakewebrtcvoiceengine.h ('k') | webrtc/media/engine/webrtcvoiceengine_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698