Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Unified Diff: webrtc/modules/audio_device/mac/audio_device_mac.cc

Issue 1564223002: Check the mic volume only periodically on Mac. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/audio_device/mac/audio_device_mac.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « webrtc/modules/audio_device/mac/audio_device_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698