Fix AudioDeviceWindowsCore::DoCaptureThread() crash under some rare circumstance.
BUG = TEST = Review URL: https://webrtc-codereview.appspot.com/728006 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2600 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
a11299648c
commit
1d9521eeed
@ -3568,6 +3568,16 @@ DWORD AudioDeviceWindowsCore::DoRenderThread()
|
|||||||
{
|
{
|
||||||
_Lock();
|
_Lock();
|
||||||
|
|
||||||
|
// Sanity check to ensure that essential states are not modified
|
||||||
|
// during the unlocked period.
|
||||||
|
if (_ptrRenderClient == NULL || _ptrClientOut == NULL)
|
||||||
|
{
|
||||||
|
_UnLock();
|
||||||
|
WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id,
|
||||||
|
"output state has been modified during unlocked period");
|
||||||
|
goto Exit;
|
||||||
|
}
|
||||||
|
|
||||||
// Get the number of frames of padding (queued up to play) in the endpoint buffer.
|
// Get the number of frames of padding (queued up to play) in the endpoint buffer.
|
||||||
UINT32 padding = 0;
|
UINT32 padding = 0;
|
||||||
hr = _ptrClientOut->GetCurrentPadding(&padding);
|
hr = _ptrClientOut->GetCurrentPadding(&padding);
|
||||||
@ -4016,6 +4026,16 @@ DWORD AudioDeviceWindowsCore::DoCaptureThread()
|
|||||||
|
|
||||||
_Lock();
|
_Lock();
|
||||||
|
|
||||||
|
// Sanity check to ensure that essential states are not modified
|
||||||
|
// during the unlocked period.
|
||||||
|
if (_ptrCaptureClient == NULL || _ptrClientIn == NULL)
|
||||||
|
{
|
||||||
|
_UnLock();
|
||||||
|
WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id,
|
||||||
|
"input state has been modified during unlocked period");
|
||||||
|
goto Exit;
|
||||||
|
}
|
||||||
|
|
||||||
// Find out how much capture data is available
|
// Find out how much capture data is available
|
||||||
//
|
//
|
||||||
hr = _ptrCaptureClient->GetBuffer(&pData, // packet which is ready to be read by used
|
hr = _ptrCaptureClient->GetBuffer(&pData, // packet which is ready to be read by used
|
||||||
|
Loading…
x
Reference in New Issue
Block a user