Commit 6530824a authored by Jactry Zeng's avatar Jactry Zeng Committed by Alexandre Julliard

qcap: Avoid call LeaveCriticalSection() repeatedly.

parent 2253d1a9
...@@ -604,7 +604,12 @@ static DWORD WINAPI ReadThread(LPVOID lParam) ...@@ -604,7 +604,12 @@ static DWORD WINAPI ReadThread(LPVOID lParam)
hr = V4l_Prepare(capBox); hr = V4l_Prepare(capBox);
if (FAILED(hr)) if (FAILED(hr))
goto fail; {
ERR("Stop IFilterGraph: %x\n", hr);
capBox->thread = 0;
capBox->stopped = TRUE;
return 0;
}
pOutput = CoTaskMemAlloc(capBox->width * capBox->height * capBox->bitDepth / 8); pOutput = CoTaskMemAlloc(capBox->width * capBox->height * capBox->bitDepth / 8);
capBox->curframe = 0; capBox->curframe = 0;
...@@ -641,27 +646,19 @@ static DWORD WINAPI ReadThread(LPVOID lParam) ...@@ -641,27 +646,19 @@ static DWORD WINAPI ReadThread(LPVOID lParam)
IMediaSample_Release(pSample); IMediaSample_Release(pSample);
V4l_FreeFrame(capBox); V4l_FreeFrame(capBox);
} }
LeaveCriticalSection(&capBox->CritSect);
if (FAILED(hr) && hr != VFW_E_NOT_CONNECTED) if (FAILED(hr) && hr != VFW_E_NOT_CONNECTED)
{ {
ERR("Received error: %x\n", hr); TRACE("Return %x, stop IFilterGraph\n", hr);
goto cfail; V4l_Unprepare(capBox);
capBox->thread = 0;
capBox->stopped = TRUE;
break;
} }
LeaveCriticalSection(&capBox->CritSect);
} }
LeaveCriticalSection(&capBox->CritSect);
CoTaskMemFree(pOutput);
return 0;
cfail:
CoTaskMemFree(pOutput);
V4l_Unprepare(capBox);
LeaveCriticalSection(&capBox->CritSect); LeaveCriticalSection(&capBox->CritSect);
CoTaskMemFree(pOutput);
fail:
capBox->thread = 0;
capBox->stopped = TRUE;
FIXME("Stop IFilterGraph\n");
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment