Jactry Zeng : qcap: Avoid call LeaveCriticalSection() repeatedly.
Alexandre Julliard
julliard at winehq.org
Thu Feb 9 15:54:27 CST 2017
Module: wine
Branch: master
Commit: 6530824ab31bf9af311f3f93e2d145b81f85de9c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6530824ab31bf9af311f3f93e2d145b81f85de9c
Author: Jactry Zeng <jzeng at codeweavers.com>
Date: Tue Feb 7 22:20:29 2017 +0800
qcap: Avoid call LeaveCriticalSection() repeatedly.
Signed-off-by: Jactry Zeng <jzeng at codeweavers.com>
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/qcap/v4l.c | 29 +++++++++++++----------------
1 file changed, 13 insertions(+), 16 deletions(-)
diff --git a/dlls/qcap/v4l.c b/dlls/qcap/v4l.c
index 54e0230..bc760bd 100644
--- a/dlls/qcap/v4l.c
+++ b/dlls/qcap/v4l.c
@@ -604,7 +604,12 @@ static DWORD WINAPI ReadThread(LPVOID lParam)
hr = V4l_Prepare(capBox);
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);
capBox->curframe = 0;
@@ -641,27 +646,19 @@ static DWORD WINAPI ReadThread(LPVOID lParam)
IMediaSample_Release(pSample);
V4l_FreeFrame(capBox);
}
- LeaveCriticalSection(&capBox->CritSect);
if (FAILED(hr) && hr != VFW_E_NOT_CONNECTED)
{
- ERR("Received error: %x\n", hr);
- goto cfail;
+ TRACE("Return %x, stop IFilterGraph\n", hr);
+ 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);
-
-fail:
- capBox->thread = 0;
- capBox->stopped = TRUE;
- FIXME("Stop IFilterGraph\n");
+ CoTaskMemFree(pOutput);
return 0;
}
More information about the wine-cvs
mailing list