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

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: misc 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
Index: webrtc/media/engine/webrtcvoiceengine.cc
diff --git a/webrtc/media/engine/webrtcvoiceengine.cc b/webrtc/media/engine/webrtcvoiceengine.cc
index 9fbfd494ebcef26e8ae589e4ec7a6b1d74dc6b98..d707902d7e29a5bf19826b37909f49ebe82ad881 100644
--- a/webrtc/media/engine/webrtcvoiceengine.cc
+++ b/webrtc/media/engine/webrtcvoiceengine.cc
@@ -1263,6 +1263,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(
bool use_transport_cc,
@@ -2204,19 +2209,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 channel with ssrc " << ssrc;
kwiberg-webrtc 2016/06/16 09:26:53 "recv stream"?
the sun 2016/06/16 14:34:06 Done.
return true;
}

Powered by Google App Engine
This is Rietveld 408576698