Add lock to prevent possible rare race condition in Win coreAudio capture implementation.
BUG = TEST = voe_auto_test Review URL: https://webrtc-codereview.appspot.com/1320011 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3868 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -3677,8 +3677,8 @@ Exit:
|
||||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
_UnLock();
|
||||
_ptrClientOut->Stop();
|
||||
_UnLock();
|
||||
_TraceCOMError(hr);
|
||||
}
|
||||
|
||||
@@ -3690,7 +3690,11 @@ Exit:
|
||||
}
|
||||
}
|
||||
|
||||
_Lock();
|
||||
|
||||
if (keepPlaying)
|
||||
{
|
||||
if (_ptrClientOut != NULL)
|
||||
{
|
||||
hr = _ptrClientOut->Stop();
|
||||
if (FAILED(hr))
|
||||
@@ -3702,7 +3706,7 @@ Exit:
|
||||
{
|
||||
_TraceCOMError(hr);
|
||||
}
|
||||
|
||||
}
|
||||
// Trigger callback from module process thread
|
||||
_playError = 1;
|
||||
WEBRTC_TRACE(kTraceError, kTraceUtility, _id, "kPlayoutError message posted: rendering thread has ended pre-maturely");
|
||||
@@ -3712,6 +3716,8 @@ Exit:
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "_Rendering thread is now terminated properly");
|
||||
}
|
||||
|
||||
_UnLock();
|
||||
|
||||
return (DWORD)hr;
|
||||
}
|
||||
|
||||
@@ -4177,13 +4183,15 @@ DWORD AudioDeviceWindowsCore::DoCaptureThread()
|
||||
Exit:
|
||||
if (FAILED(hr))
|
||||
{
|
||||
_UnLock();
|
||||
_ptrClientIn->Stop();
|
||||
_UnLock();
|
||||
_TraceCOMError(hr);
|
||||
}
|
||||
|
||||
RevertCaptureThreadPriority();
|
||||
|
||||
_Lock();
|
||||
|
||||
if (keepRecording)
|
||||
{
|
||||
if (_ptrClientIn != NULL)
|
||||
@@ -4212,6 +4220,8 @@ Exit:
|
||||
SAFE_RELEASE(_ptrClientIn);
|
||||
SAFE_RELEASE(_ptrCaptureClient);
|
||||
|
||||
_UnLock();
|
||||
|
||||
if (syncBuffer)
|
||||
{
|
||||
delete [] syncBuffer;
|
||||
|
Reference in New Issue
Block a user