Chromium Code Reviews| Index: webrtc/voice_engine/channel.cc |
| diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc |
| index 5bbbce3c406b1c8ebfbbd3ef2e7533e335e836de..754eaf0410326e086a334c3665c63f4df78a8c70 100644 |
| --- a/webrtc/voice_engine/channel.cc |
| +++ b/webrtc/voice_engine/channel.cc |
| @@ -766,7 +766,8 @@ Channel::Channel(int32_t channelId, |
| _sendFrameType(0), |
| _externalMixing(false), |
| _mixFileWithMicrophone(false), |
| - _mute(false), |
| + input_mute_(false), |
| + cached_input_mute_(false), |
| _panLeft(1.0f), |
| _panRight(1.0f), |
| _outputGain(1.0f), |
| @@ -2138,17 +2139,17 @@ int Channel::GetSpeechOutputLevelFullRange(uint32_t& level) const { |
| return 0; |
| } |
| -int Channel::SetMute(bool enable) { |
| +int Channel::SetInputMute(bool enable) { |
| rtc::CritScope cs(&volume_settings_critsect_); |
| WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), |
| "Channel::SetMute(enable=%d)", enable); |
| - _mute = enable; |
| + input_mute_ = enable; |
| return 0; |
| } |
| -bool Channel::Mute() const { |
| +bool Channel::InputMute() const { |
| rtc::CritScope cs(&volume_settings_critsect_); |
| - return _mute; |
| + return input_mute_; |
| } |
| int Channel::SetOutputVolumePan(float left, float right) { |
| @@ -2953,10 +2954,8 @@ uint32_t Channel::PrepareEncodeAndSend(int mixingFrequency) { |
| MixOrReplaceAudioWithFile(mixingFrequency); |
| } |
| - bool is_muted = Mute(); // Cache locally as Mute() takes a lock. |
| - if (is_muted) { |
| - AudioFrameOperations::Mute(_audioFrame); |
| - } |
| + bool is_muted = InputMute(); // Cache locally as InputMute() takes a lock. |
| + AudioFrameOperations::Mute(&_audioFrame, cached_input_mute_, is_muted); |
| if (channel_state_.Get().input_external_media) { |
| rtc::CritScope cs(&_callbackCritSect); |
| @@ -2972,12 +2971,13 @@ uint32_t Channel::PrepareEncodeAndSend(int mixingFrequency) { |
| if (_includeAudioLevelIndication) { |
| size_t length = |
| _audioFrame.samples_per_channel_ * _audioFrame.num_channels_; |
| - if (is_muted) { |
| + if (is_muted && cached_input_mute_) { |
|
peah-webrtc
2016/03/23 15:57:04
If you would rename
cached_input_mute_ to previou
the sun
2016/03/23 21:30:53
Good idea!
|
| rms_level_.ProcessMuted(length); |
| } else { |
| rms_level_.Process(_audioFrame.data_, length); |
| } |
| } |
| + cached_input_mute_ = is_muted; |
| return 0; |
| } |