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
This commit is contained in:
andrew@webrtc.org
2011-11-30 17:43:05 +00:00
parent 524eb48081
commit 587c844741

View File

@ -3354,20 +3354,6 @@ DWORD AudioDeviceWindowsCore::DoGetCaptureVolumeThread()
while (1) 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()) if (AGC())
{ {
WebRtc_UWord32 currentMicLevel = 0; WebRtc_UWord32 currentMicLevel = 0;
@ -3382,6 +3368,20 @@ DWORD AudioDeviceWindowsCore::DoGetCaptureVolumeThread()
_UnLock(); _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); DWORD waitResult = WaitForMultipleObjects(2, waitArray, FALSE, INFINITE);
switch (waitResult) switch (waitResult)
{ {
case WAIT_OBJECT_0: // _hShutdownCaptureEvent case WAIT_OBJECT_0: // _hShutdownCaptureEvent
return 0; return 0;
case WAIT_OBJECT_0 + 1: // _hSetCaptureVolumeEvent case WAIT_OBJECT_0 + 1: // _hSetCaptureVolumeEvent
break; break;
default: // unexpected error default: // unexpected error
WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id,
" unknown wait termination on set volume thread"); " unknown wait termination on set volume thread");
return -1; return -1;