summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbraveyao@webrtc.org <braveyao@webrtc.org>2014-11-03 09:58:40 +0000
committerbraveyao@webrtc.org <braveyao@webrtc.org>2014-11-03 09:58:40 +0000
commit9b1042c9f6a2d10ea222d1c3b748e2b8d321008b (patch)
treed300cb7e3e96b7ee5ae8da1b8e3a8d057b151605
parent5f53af36d2939faab5773ac63567cd777a16c953 (diff)
downloadwebrtc-9b1042c9f6a2d10ea222d1c3b748e2b8d321008b.tar.gz
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/webrtc@7590 4adac7df-926f-26a2-2b94-8c16560cd09d
-rw-r--r--modules/audio_device/win/audio_device_core_win.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/modules/audio_device/win/audio_device_core_win.cc b/modules/audio_device/win/audio_device_core_win.cc
index 3708c540..bcf1c1bb 100644
--- a/modules/audio_device/win/audio_device_core_win.cc
+++ b/modules/audio_device/win/audio_device_core_win.cc
@@ -3893,6 +3893,12 @@ DWORD AudioDeviceWindowsCore::DoCaptureThread()
// This value is fixed during the capturing session.
//
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);
EXIT_ON_ERROR(hr);
WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "[CAPT] size of buffer : %u", bufferLength);
@@ -4113,7 +4119,10 @@ DWORD AudioDeviceWindowsCore::DoCaptureThread()
// ---------------------------- THREAD LOOP ---------------------------- <<
- hr = _ptrClientIn->Stop();
+ if (_ptrClientIn)
+ {
+ hr = _ptrClientIn->Stop();
+ }
Exit:
if (FAILED(hr))