[PATCH 6/6] quartz/vmr9: Wait in Receive() while paused.
Zebediah Figura
z.figura12 at gmail.com
Thu Nov 21 18:11:27 CST 2019
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
dlls/quartz/tests/vmr7.c | 10 +++++-----
dlls/quartz/tests/vmr9.c | 10 +++++-----
dlls/quartz/vmr9.c | 15 +++++++++++++++
3 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/dlls/quartz/tests/vmr7.c b/dlls/quartz/tests/vmr7.c
index 50a1521f6e..22ddb63746 100644
--- a/dlls/quartz/tests/vmr7.c
+++ b/dlls/quartz/tests/vmr7.c
@@ -1106,7 +1106,7 @@ static void test_filter_state(IMemInputPin *input, IFilterGraph2 *graph)
hr = IMediaControl_GetState(control, 1000, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
- todo_wine ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
+ ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
hr = IMediaControl_Stop(control);
ok(hr == S_OK, "Got hr %#x.\n", hr);
@@ -1139,7 +1139,7 @@ static void test_filter_state(IMemInputPin *input, IFilterGraph2 *graph)
hr = IMediaControl_GetState(control, 1000, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
- todo_wine ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
+ ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
hr = IMediaControl_Run(control);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
@@ -1165,7 +1165,7 @@ static void test_filter_state(IMemInputPin *input, IFilterGraph2 *graph)
hr = IMediaControl_GetState(control, 1000, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
- todo_wine ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
+ ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
hr = IMediaControl_Run(control);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
@@ -1240,7 +1240,7 @@ static void test_flushing(IPin *pin, IMemInputPin *input, IFilterGraph2 *graph)
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
thread = send_frame(input);
- todo_wine ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
+ ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
hr = IMediaControl_GetState(control, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
@@ -1264,7 +1264,7 @@ static void test_flushing(IPin *pin, IMemInputPin *input, IFilterGraph2 *graph)
todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
thread = send_frame(input);
- todo_wine ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
+ ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
hr = IMediaControl_Run(control);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
diff --git a/dlls/quartz/tests/vmr9.c b/dlls/quartz/tests/vmr9.c
index 93885e184d..d0ae25a969 100644
--- a/dlls/quartz/tests/vmr9.c
+++ b/dlls/quartz/tests/vmr9.c
@@ -1110,7 +1110,7 @@ static void test_filter_state(IMemInputPin *input, IFilterGraph2 *graph)
hr = IMediaControl_GetState(control, 1000, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
- todo_wine ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
+ ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
hr = IMediaControl_Stop(control);
ok(hr == S_OK, "Got hr %#x.\n", hr);
@@ -1143,7 +1143,7 @@ static void test_filter_state(IMemInputPin *input, IFilterGraph2 *graph)
hr = IMediaControl_GetState(control, 1000, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
- todo_wine ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
+ ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
hr = IMediaControl_Run(control);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
@@ -1169,7 +1169,7 @@ static void test_filter_state(IMemInputPin *input, IFilterGraph2 *graph)
hr = IMediaControl_GetState(control, 1000, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
- todo_wine ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
+ ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
hr = IMediaControl_Run(control);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
@@ -1244,7 +1244,7 @@ static void test_flushing(IPin *pin, IMemInputPin *input, IFilterGraph2 *graph)
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
thread = send_frame(input);
- todo_wine ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
+ ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
hr = IMediaControl_GetState(control, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
@@ -1268,7 +1268,7 @@ static void test_flushing(IPin *pin, IMemInputPin *input, IFilterGraph2 *graph)
todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
thread = send_frame(input);
- todo_wine ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
+ ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
hr = IMediaControl_Run(control);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c
index 36c91c2ef7..994e309165 100644
--- a/dlls/quartz/vmr9.c
+++ b/dlls/quartz/vmr9.c
@@ -86,6 +86,8 @@ struct quartz_vmr
RECT target_rect;
LONG VideoWidth;
LONG VideoHeight;
+
+ HANDLE run_event;
};
static inline struct quartz_vmr *impl_from_BaseWindow(BaseWindow *wnd)
@@ -259,6 +261,7 @@ static DWORD VMR9_SendSampleData(struct quartz_vmr *This, VMR9PresentationInfo *
static HRESULT WINAPI VMR9_DoRenderSample(struct strmbase_renderer *iface, IMediaSample *pSample)
{
struct quartz_vmr *This = impl_from_IBaseFilter(&iface->filter.IBaseFilter_iface);
+ const HANDLE events[2] = {This->run_event, This->renderer.flush_event};
LPBYTE pbSrcStream = NULL;
long cbSrcStream = 0;
REFERENCE_TIME tStart, tStop;
@@ -318,6 +321,13 @@ static HRESULT WINAPI VMR9_DoRenderSample(struct strmbase_renderer *iface, IMedi
VMR9_SendSampleData(This, &info, pbSrcStream, cbSrcStream);
IDirect3DSurface9_Release(info.lpSurf);
+ if (This->renderer.filter.state == State_Paused)
+ {
+ LeaveCriticalSection(&This->renderer.csRenderLock);
+ WaitForMultipleObjects(2, events, FALSE, INFINITE);
+ EnterCriticalSection(&This->renderer.csRenderLock);
+ }
+
return hr;
}
@@ -428,6 +438,7 @@ static void vmr_start_stream(struct strmbase_renderer *iface)
SWP_NOZORDER|SWP_NOMOVE|SWP_DEFERERASE);
ShowWindow(This->baseControlWindow.baseWindow.hWnd, SW_SHOW);
GetClientRect(This->baseControlWindow.baseWindow.hWnd, &This->target_rect);
+ SetEvent(This->run_event);
}
static void vmr_stop_stream(struct strmbase_renderer *iface)
@@ -438,6 +449,7 @@ static void vmr_stop_stream(struct strmbase_renderer *iface)
if (This->renderer.filter.state == State_Running)
IVMRImagePresenter9_StopPresenting(This->presenter, This->cookie);
+ ResetEvent(This->run_event);
}
static HRESULT WINAPI VMR9_ShouldDrawSampleNow(struct strmbase_renderer *iface,
@@ -502,6 +514,7 @@ static void vmr_destroy(struct strmbase_renderer *iface)
filter->allocator_d3d9_dev = NULL;
}
+ CloseHandle(filter->run_event);
FreeLibrary(filter->hD3d9);
strmbase_renderer_cleanup(&filter->renderer);
CoTaskMemFree(filter);
@@ -2243,6 +2256,8 @@ static HRESULT vmr_create(IUnknown *outer, void **out, const CLSID *clsid)
if (FAILED(hr))
goto fail;
+ pVMR->run_event = CreateEventW(NULL, TRUE, FALSE, NULL);
+
*out = &pVMR->renderer.filter.IUnknown_inner;
ZeroMemory(&pVMR->source_rect, sizeof(RECT));
ZeroMemory(&pVMR->target_rect, sizeof(RECT));
--
2.24.0
More information about the wine-devel
mailing list