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

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

Issue 2206223002: Removed calls to VoE::SetPlayout() from WebRTCVoiceEngine. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Updated comments in test. Created 4 years, 4 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/webrtcvoiceengine.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 2aa0552b9378a8b4df743f7db56e5dfeb9819d9e..be1888eea338392e0f3952061990d8ba24a776b1 100644
--- a/webrtc/media/engine/webrtcvoiceengine.cc
+++ b/webrtc/media/engine/webrtcvoiceengine.cc
@@ -1363,6 +1363,18 @@ class WebRtcVoiceMediaChannel::WebRtcAudioReceiveStream {
stream_->SetGain(volume);
}
+ void SetPlayout(bool playout) {
+ RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
+ RTC_DCHECK(stream_);
+ if (playout) {
+ LOG(LS_INFO) << "Starting playout for channel #" << channel();
+ stream_->Start();
+ } else {
+ LOG(LS_INFO) << "Stopping playout for channel #" << channel();
+ stream_->Stop();
+ }
+ }
+
private:
void RecreateAudioReceiveStream(
uint32_t local_ssrc,
@@ -1642,7 +1654,7 @@ bool WebRtcVoiceMediaChannel::SetRecvCodecs(
if (playout_) {
// Receive codecs can not be changed while playing. So we temporarily
// pause playout.
- PausePlayout();
+ ChangePlayout(false);
}
bool result = true;
@@ -1670,7 +1682,7 @@ bool WebRtcVoiceMediaChannel::SetRecvCodecs(
}
if (desired_playout_ && !playout_) {
- ResumePlayout();
+ ChangePlayout(desired_playout_);
}
return result;
}
@@ -1925,35 +1937,22 @@ bool WebRtcVoiceMediaChannel::SetSendCodec(
return true;
}
-bool WebRtcVoiceMediaChannel::SetPlayout(bool playout) {
+void WebRtcVoiceMediaChannel::SetPlayout(bool playout) {
desired_playout_ = playout;
return ChangePlayout(desired_playout_);
}
-bool WebRtcVoiceMediaChannel::PausePlayout() {
- return ChangePlayout(false);
-}
-
-bool WebRtcVoiceMediaChannel::ResumePlayout() {
- return ChangePlayout(desired_playout_);
-}
-
-bool WebRtcVoiceMediaChannel::ChangePlayout(bool playout) {
+void WebRtcVoiceMediaChannel::ChangePlayout(bool playout) {
TRACE_EVENT0("webrtc", "WebRtcVoiceMediaChannel::ChangePlayout");
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
if (playout_ == playout) {
- return true;
+ return;
}
- for (const auto& ch : recv_streams_) {
- if (!SetPlayout(ch.second->channel(), playout)) {
- LOG(LS_ERROR) << "SetPlayout " << playout << " on channel "
- << ch.second->channel() << " failed";
- return false;
- }
+ for (const auto& kv : recv_streams_) {
+ kv.second->SetPlayout(playout);
}
playout_ = playout;
- return true;
}
void WebRtcVoiceMediaChannel::SetSend(bool send) {
@@ -2180,7 +2179,7 @@ bool WebRtcVoiceMediaChannel::AddRecvStream(const StreamParams& sp) {
sp.sync_label, recv_rtp_extensions_,
call_, this,
engine()->decoder_factory_)));
- SetPlayout(channel, playout_);
+ recv_streams_[ssrc]->SetPlayout(playout_);
return true;
}
@@ -2614,20 +2613,6 @@ int WebRtcVoiceMediaChannel::GetSendChannelId(uint32_t ssrc) const {
}
return -1;
}
-
-bool WebRtcVoiceMediaChannel::SetPlayout(int channel, bool playout) {
- if (playout) {
- LOG(LS_INFO) << "Starting playout for channel #" << channel;
- if (engine()->voe()->base()->StartPlayout(channel) == -1) {
- LOG_RTCERR1(StartPlayout, channel);
- return false;
- }
- } else {
- LOG(LS_INFO) << "Stopping playout for channel #" << channel;
- engine()->voe()->base()->StopPlayout(channel);
- }
- return true;
-}
} // namespace cricket
#endif // HAVE_WEBRTC_VOICE
« no previous file with comments | « webrtc/media/engine/webrtcvoiceengine.h ('k') | webrtc/media/engine/webrtcvoiceengine_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698