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

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
Zebediah Figura 2019-11-21 18:11:27 -06:00 committed by Alexandre Julliard
parent 6014c0a997
commit 19826fd6b7
3 changed files with 25 additions and 10 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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));