From 587c844741488ce659c1b100e7d56ed6f93ca64e Mon Sep 17 00:00:00 2001 From: "andrew@webrtc.org" Date: Wed, 30 Nov 2011 17:43:05 +0000 Subject: [PATCH] Query the capture volume immediately on Win Core. This allows the capture volume to be queried immediately at capture startup, rather than waiting the usual one second interval. Review URL: http://webrtc-codereview.appspot.com/297003 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1064 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../main/source/win/audio_device_core_win.cc | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/modules/audio_device/main/source/win/audio_device_core_win.cc b/src/modules/audio_device/main/source/win/audio_device_core_win.cc index f9e27c5aa..14f7850bb 100644 --- a/src/modules/audio_device/main/source/win/audio_device_core_win.cc +++ b/src/modules/audio_device/main/source/win/audio_device_core_win.cc @@ -3354,20 +3354,6 @@ DWORD AudioDeviceWindowsCore::DoGetCaptureVolumeThread() while (1) { - DWORD waitResult = WaitForSingleObject(waitObject, - GET_MIC_VOLUME_INTERVAL_MS); - switch (waitResult) - { - case WAIT_OBJECT_0: // _hShutdownCaptureEvent - return 0; - case WAIT_TIMEOUT: // timeout notification - break; - default: // unexpected error - WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, - " unknown wait termination on get volume thread"); - return -1; - } - if (AGC()) { WebRtc_UWord32 currentMicLevel = 0; @@ -3382,6 +3368,20 @@ DWORD AudioDeviceWindowsCore::DoGetCaptureVolumeThread() _UnLock(); } } + + DWORD waitResult = WaitForSingleObject(waitObject, + GET_MIC_VOLUME_INTERVAL_MS); + switch (waitResult) + { + case WAIT_OBJECT_0: // _hShutdownCaptureEvent + return 0; + case WAIT_TIMEOUT: // timeout notification + break; + default: // unexpected error + WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, + " unknown wait termination on get volume thread"); + return -1; + } } } @@ -3394,11 +3394,11 @@ DWORD AudioDeviceWindowsCore::DoSetCaptureVolumeThread() DWORD waitResult = WaitForMultipleObjects(2, waitArray, FALSE, INFINITE); switch (waitResult) { - case WAIT_OBJECT_0: // _hShutdownCaptureEvent + case WAIT_OBJECT_0: // _hShutdownCaptureEvent return 0; - case WAIT_OBJECT_0 + 1: // _hSetCaptureVolumeEvent + case WAIT_OBJECT_0 + 1: // _hSetCaptureVolumeEvent break; - default: // unexpected error + default: // unexpected error WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, " unknown wait termination on set volume thread"); return -1;