Chromium Code Reviews| Index: talk/media/webrtc/webrtcvoiceengine.cc |
| diff --git a/talk/media/webrtc/webrtcvoiceengine.cc b/talk/media/webrtc/webrtcvoiceengine.cc |
| index 93f4b97b14ad38cecf9c0aeedfd732606c5b3624..843cb60761a5f98e26486efbab9e3179b816d669 100644 |
| --- a/talk/media/webrtc/webrtcvoiceengine.cc |
| +++ b/talk/media/webrtc/webrtcvoiceengine.cc |
| @@ -2374,6 +2374,67 @@ bool WebRtcVoiceMediaChannel::ChangeSend(int channel, SendFlags send) { |
| return true; |
| } |
| +bool WebRtcVoiceMediaChannel::SetAudioSend(uint32 ssrc, bool mute, |
| + const AudioOptions* options, |
| + AudioRenderer* renderer) { |
| + // SetLocalRenderer |
| + { |
| + ChannelMap::iterator it = send_channels_.find(ssrc); |
| + if (it == send_channels_.end()) { |
| + if (renderer) { |
| + // Return error if trying to set a valid renderer with an invalid ssrc. |
| + LOG(LS_ERROR) << "SetLocalRenderer failed with ssrc "<< ssrc; |
| + return false; |
| + } |
| + // The channel likely has gone away, do nothing. |
| + } else { |
| + if (renderer) { |
| + it->second->Start(renderer); |
| + } else { |
| + it->second->Stop(); |
| + } |
| + } |
| + } |
| + |
| + // MuteStream |
| + { |
| + int channel = (ssrc == 0) ? voe_channel() : GetSendChannelNum(ssrc); |
| + if (channel == -1) { |
| + LOG(LS_WARNING) << "The specified ssrc " << ssrc << " is not in use."; |
| + return false; |
| + } |
| + if (engine()->voe()->volume()->SetInputMute(channel, mute) == -1) { |
| + LOG_RTCERR2(SetInputMute, channel, mute); |
| + return false; |
| + } |
| + // We set the AGC to mute state only when all the channels are muted. |
| + // This implementation is not ideal, instead we should signal the AGC when |
| + // the mic channel is muted/unmuted. We can't do it today because there |
| + // is no good way to know which stream is mapping to the mic channel. |
| + bool all_muted = mute; |
| + for (const auto& ch : send_channels_) { |
| + if (!all_muted) { |
| + break; |
| + } |
| + if (engine()->voe()->volume()->GetInputMute(ch.second->channel(), |
| + all_muted)) { |
| + LOG_RTCERR1(GetInputMute, ch.second->channel()); |
| + return false; |
| + } |
| + } |
| + |
| + webrtc::AudioProcessing* ap = engine()->voe()->base()->audio_processing(); |
| + if (ap) |
| + ap->set_output_will_be_muted(all_muted); |
| + |
| + if (!mute && options) { |
| + return SetOptions(*options); |
| + } |
| + } |
| + |
| + return true; |
|
pthatcher1
2015/09/09 07:16:12
Similarly, would it make more sense for this CL to
the sun
2015/09/09 09:50:50
Done.
|
| +} |
| + |
| // TODO(ronghuawu): Change this method to return bool. |
| void WebRtcVoiceMediaChannel::ConfigureSendChannel(int channel) { |
| if (engine()->voe()->network()->RegisterExternalTransport( |
| @@ -2723,28 +2784,6 @@ bool WebRtcVoiceMediaChannel::SetRemoteRenderer(uint32 ssrc, |
| return true; |
| } |
| -bool WebRtcVoiceMediaChannel::SetLocalRenderer(uint32 ssrc, |
| - AudioRenderer* renderer) { |
| - ChannelMap::iterator it = send_channels_.find(ssrc); |
| - if (it == send_channels_.end()) { |
| - if (renderer) { |
| - // Return an error if trying to set a valid renderer with an invalid ssrc. |
| - LOG(LS_ERROR) << "SetLocalRenderer failed with ssrc "<< ssrc; |
| - return false; |
| - } |
| - |
| - // The channel likely has gone away, do nothing. |
| - return true; |
| - } |
| - |
| - if (renderer) |
| - it->second->Start(renderer); |
| - else |
| - it->second->Stop(); |
| - |
| - return true; |
| -} |
| - |
| bool WebRtcVoiceMediaChannel::GetActiveStreams( |
| AudioInfo::StreamList* actives) { |
| // In conference mode, the default channel should not be in |
| @@ -3032,38 +3071,6 @@ void WebRtcVoiceMediaChannel::OnRtcpReceived( |
| } |
| } |
| -bool WebRtcVoiceMediaChannel::MuteStream(uint32 ssrc, bool muted) { |
| - int channel = (ssrc == 0) ? voe_channel() : GetSendChannelNum(ssrc); |
| - if (channel == -1) { |
| - LOG(LS_WARNING) << "The specified ssrc " << ssrc << " is not in use."; |
| - return false; |
| - } |
| - if (engine()->voe()->volume()->SetInputMute(channel, muted) == -1) { |
| - LOG_RTCERR2(SetInputMute, channel, muted); |
| - return false; |
| - } |
| - // We set the AGC to mute state only when all the channels are muted. |
| - // This implementation is not ideal, instead we should signal the AGC when |
| - // the mic channel is muted/unmuted. We can't do it today because there |
| - // is no good way to know which stream is mapping to the mic channel. |
| - bool all_muted = muted; |
| - for (const auto& ch : send_channels_) { |
| - if (!all_muted) { |
| - break; |
| - } |
| - if (engine()->voe()->volume()->GetInputMute(ch.second->channel(), |
| - all_muted)) { |
| - LOG_RTCERR1(GetInputMute, ch.second->channel()); |
| - return false; |
| - } |
| - } |
| - |
| - webrtc::AudioProcessing* ap = engine()->voe()->base()->audio_processing(); |
| - if (ap) |
| - ap->set_output_will_be_muted(all_muted); |
| - return true; |
| -} |
| - |
| // TODO(minyue): SetMaxSendBandwidth() is subject to be renamed to |
| // SetMaxSendBitrate() in future. |
| bool WebRtcVoiceMediaChannel::SetMaxSendBandwidth(int bps) { |