Add more sanity checks to workaround the unidentified problem that CaptureThread is still running while related resouces are destroyed already.

BUG=
TEST=auto test
R=henrika@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/28859004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7590 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
braveyao@webrtc.org 2014-11-03 09:58:40 +00:00
parent ed45896759
commit bf09976e86

View File

@ -3893,6 +3893,12 @@ DWORD AudioDeviceWindowsCore::DoCaptureThread()
// This value is fixed during the capturing session. // This value is fixed during the capturing session.
// //
UINT32 bufferLength = 0; UINT32 bufferLength = 0;
if (_ptrClientIn == NULL)
{
WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id,
"input state has been modified before capture loop starts.");
return 1;
}
hr = _ptrClientIn->GetBufferSize(&bufferLength); hr = _ptrClientIn->GetBufferSize(&bufferLength);
EXIT_ON_ERROR(hr); EXIT_ON_ERROR(hr);
WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "[CAPT] size of buffer : %u", bufferLength); WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "[CAPT] size of buffer : %u", bufferLength);
@ -4113,7 +4119,10 @@ DWORD AudioDeviceWindowsCore::DoCaptureThread()
// ---------------------------- THREAD LOOP ---------------------------- << // ---------------------------- THREAD LOOP ---------------------------- <<
if (_ptrClientIn)
{
hr = _ptrClientIn->Stop(); hr = _ptrClientIn->Stop();
}
Exit: Exit:
if (FAILED(hr)) if (FAILED(hr))