Chromium Code Reviews| Index: webrtc/modules/audio_device/mac/audio_device_mac.cc |
| diff --git a/webrtc/modules/audio_device/mac/audio_device_mac.cc b/webrtc/modules/audio_device/mac/audio_device_mac.cc |
| index 3449188dc0c9bf9b90b9a285ab44e6b675a18def..d963f2b7f2a65503bce08ff238c7df4b0ef57609 100644 |
| --- a/webrtc/modules/audio_device/mac/audio_device_mac.cc |
| +++ b/webrtc/modules/audio_device/mac/audio_device_mac.cc |
| @@ -149,7 +149,8 @@ AudioDeviceMac::AudioDeviceMac(const int32_t id) : |
| _paRenderBuffer(NULL), |
| _captureBufSizeSamples(0), |
| _renderBufSizeSamples(0), |
| - prev_key_state_() |
| + prev_key_state_(), |
| + get_mic_volume_counter_ms_(0) |
| { |
| WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, id, |
| "%s created", __FUNCTION__); |
| @@ -379,6 +380,8 @@ int32_t AudioDeviceMac::Init() |
| _recWarning = 0; |
| _recError = 0; |
| + get_mic_volume_counter_ms_ = 0; |
| + |
| _initialized = true; |
| return 0; |
| @@ -3181,12 +3184,17 @@ bool AudioDeviceMac::CaptureWorkerThread() |
| if (AGC()) |
| { |
| - // store current mic level in the audio buffer if AGC is enabled |
| - if (MicrophoneVolume(currentMicLevel) == 0) |
| - { |
| - // this call does not affect the actual microphone volume |
| - _ptrAudioBuffer->SetCurrentMicLevel(currentMicLevel); |
| + // Use mod to ensure we check the volume on the first pass. |
|
henrika_webrtc
2016/01/08 08:14:42
Out indentation kind of sucks but I guess we shoul
Andrew MacDonald
2016/01/08 08:22:09
:)
I can run clang-format on these files in a fol
|
| + if (get_mic_volume_counter_ms_ % kGetMicVolumeIntervalMs == 0) { |
| + get_mic_volume_counter_ms_ = 0; |
| + // store current mic level in the audio buffer if AGC is enabled |
| + if (MicrophoneVolume(currentMicLevel) == 0) |
| + { |
| + // this call does not affect the actual microphone volume |
| + _ptrAudioBuffer->SetCurrentMicLevel(currentMicLevel); |
| + } |
| } |
| + get_mic_volume_counter_ms_ += kBufferSizeMs; |
| } |
| _ptrAudioBuffer->SetVQEData(msecOnPlaySide, msecOnRecordSide, 0); |