Chromium Code Reviews| Index: webrtc/voice_engine/transmit_mixer.cc |
| diff --git a/webrtc/voice_engine/transmit_mixer.cc b/webrtc/voice_engine/transmit_mixer.cc |
| index 7dbe380de98d6ae353be28537618ca8661eaf099..a0489fc0fc3686fc026cef4769fae678b5d7ebd3 100644 |
| --- a/webrtc/voice_engine/transmit_mixer.cc |
| +++ b/webrtc/voice_engine/transmit_mixer.cc |
| @@ -26,14 +26,13 @@ |
| namespace webrtc { |
| namespace voe { |
| +#if WEBRTC_VOICE_ENGINE_TYPING_DETECTION |
| // TODO(ajm): The thread safety of this is dubious... |
| -void |
| -TransmitMixer::OnPeriodicProcess() |
| +void TransmitMixer::OnPeriodicProcess() |
| { |
| WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, -1), |
| "TransmitMixer::OnPeriodicProcess()"); |
| -#if WEBRTC_VOICE_ENGINE_TYPING_DETECTION |
| bool send_typing_noise_warning = false; |
| bool typing_noise_detected = false; |
| { |
| @@ -64,32 +63,8 @@ TransmitMixer::OnPeriodicProcess() |
| } |
| } |
| } |
| -#endif // WEBRTC_VOICE_ENGINE_TYPING_DETECTION |
| - |
| - bool saturationWarning = false; |
| - { |
| - // Modify |_saturationWarning| under lock to avoid conflict with write op |
| - // in ProcessAudio and also ensure that we don't hold the lock during the |
| - // callback. |
| - rtc::CritScope cs(&_critSect); |
| - saturationWarning = _saturationWarning; |
| - if (_saturationWarning) |
| - _saturationWarning = false; |
| - } |
| - |
| - if (saturationWarning) |
| - { |
| - rtc::CritScope cs(&_callbackCritSect); |
| - if (_voiceEngineObserverPtr) |
| - { |
| - WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, -1), |
| - "TransmitMixer::OnPeriodicProcess() =>" |
| - " CallbackOnError(VE_SATURATION_WARNING)"); |
| - _voiceEngineObserverPtr->CallbackOnError(-1, VE_SATURATION_WARNING); |
| - } |
| - } |
| } |
| - |
| +#endif // WEBRTC_VOICE_ENGINE_TYPING_DETECTION |
| void TransmitMixer::PlayNotification(int32_t id, |
| uint32_t durationMs) |
| @@ -176,12 +151,14 @@ TransmitMixer::Destroy(TransmitMixer*& mixer) |
| } |
| TransmitMixer::TransmitMixer(uint32_t instanceId) : |
| - _monitorModule(this), |
| // Avoid conflict with other channels by adding 1024 - 1026, |
| // won't use as much as 1024 channels. |
| _filePlayerId(instanceId + 1024), |
| _fileRecorderId(instanceId + 1025), |
| _fileCallRecorderId(instanceId + 1026), |
| +#if WEBRTC_VOICE_ENGINE_TYPING_DETECTION |
| + _monitorModule(this), |
| +#endif |
| _instanceId(instanceId) |
| { |
| WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId, -1), |
| @@ -1077,10 +1054,6 @@ void TransmitMixer::ProcessAudio(int delay_ms, int clock_drift, |
| // Store new capture level. Only updated when analog AGC is enabled. |
| _captureLevel = agc->stream_analog_level(); |
| - |
| - rtc::CritScope cs(&_critSect); |
|
tommi
2017/02/28 11:46:43
look, we can haz one less locks!
|
| - // Triggers a callback in OnPeriodicProcess(). |
| - _saturationWarning |= agc->stream_is_saturated(); |
| } |
| #if WEBRTC_VOICE_ENGINE_TYPING_DETECTION |