quartz/videorenderer: Wait in Receive() while paused.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-11-21 18:11:26 -06:00 committed by Alexandre Julliard
parent b78dcbf269
commit 6014c0a997
2 changed files with 29 additions and 6 deletions

View File

@ -744,7 +744,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);
@ -777,7 +777,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);
@ -803,7 +803,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);
@ -868,7 +868,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);
@ -892,7 +892,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);

View File

@ -54,6 +54,8 @@ typedef struct VideoRendererImpl
LONG FullScreenMode;
DWORD saved_style;
HANDLE run_event;
} VideoRendererImpl;
static inline VideoRendererImpl *impl_from_BaseWindow(BaseWindow *iface)
@ -176,6 +178,15 @@ static HRESULT WINAPI VideoRenderer_DoRenderSample(struct strmbase_renderer *ifa
pbSrcStream, (BITMAPINFO *)bih, DIB_RGB_COLORS, SRCCOPY);
ReleaseDC(filter->baseControlWindow.baseWindow.hWnd, dc);
if (filter->renderer.filter.state == State_Paused)
{
const HANDLE events[2] = {filter->run_event, filter->renderer.flush_event};
LeaveCriticalSection(&filter->renderer.csRenderLock);
WaitForMultipleObjects(2, events, FALSE, INFINITE);
EnterCriticalSection(&filter->renderer.csRenderLock);
}
return S_OK;
}
@ -234,7 +245,7 @@ static void video_renderer_destroy(struct strmbase_renderer *iface)
BaseControlWindow_Destroy(&filter->baseControlWindow);
BaseControlVideo_Destroy(&filter->baseControlVideo);
CloseHandle(filter->run_event);
strmbase_renderer_cleanup(&filter->renderer);
CoTaskMemFree(filter);
}
@ -267,6 +278,13 @@ static HRESULT video_renderer_pin_query_interface(struct strmbase_renderer *ifac
return S_OK;
}
static void video_renderer_start_stream(struct strmbase_renderer *iface)
{
VideoRendererImpl *filter = impl_from_strmbase_renderer(iface);
SetEvent(filter->run_event);
}
static void video_renderer_stop_stream(struct strmbase_renderer *iface)
{
VideoRendererImpl *This = impl_from_strmbase_renderer(iface);
@ -276,6 +294,8 @@ static void video_renderer_stop_stream(struct strmbase_renderer *iface)
if (This->baseControlWindow.AutoShow)
/* Black it out */
RedrawWindow(This->baseControlWindow.baseWindow.hWnd, NULL, NULL, RDW_INVALIDATE|RDW_ERASE);
ResetEvent(This->run_event);
}
static void video_renderer_init_stream(struct strmbase_renderer *iface)
@ -315,6 +335,7 @@ static const struct strmbase_renderer_ops renderer_ops =
.pfnCheckMediaType = VideoRenderer_CheckMediaType,
.pfnDoRenderSample = VideoRenderer_DoRenderSample,
.renderer_init_stream = video_renderer_init_stream,
.renderer_start_stream = video_renderer_start_stream,
.renderer_stop_stream = video_renderer_stop_stream,
.pfnShouldDrawSampleNow = VideoRenderer_ShouldDrawSampleNow,
.renderer_destroy = video_renderer_destroy,
@ -722,6 +743,8 @@ HRESULT VideoRenderer_create(IUnknown *outer, void **out)
if (FAILED(hr = BaseWindowImpl_PrepareWindow(&pVideoRenderer->baseControlWindow.baseWindow)))
goto fail;
pVideoRenderer->run_event = CreateEventW(NULL, TRUE, FALSE, NULL);
*out = &pVideoRenderer->renderer.filter.IUnknown_inner;
return S_OK;