Index: webrtc/media/engine/webrtcvoiceengine.cc |
diff --git a/webrtc/media/engine/webrtcvoiceengine.cc b/webrtc/media/engine/webrtcvoiceengine.cc |
index 2aa0552b9378a8b4df743f7db56e5dfeb9819d9e..5aeace7de5997c7825145008c4f5c0c9fe3808e7 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, |
@@ -1945,12 +1957,8 @@ bool WebRtcVoiceMediaChannel::ChangePlayout(bool playout) { |
return true; |
} |
- 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; |
@@ -2180,7 +2188,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 +2622,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); |
the sun
2016/08/03 14:50:56
Note that the return value for stop is ignored. I
aleloi
2016/08/04 09:08:30
Done.
|
- } |
- return true; |
-} |
} // namespace cricket |
#endif // HAVE_WEBRTC_VOICE |