qedit/nullrenderer: Wait in Receive() while paused.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com> Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
944f91b147
commit
412db77893
|
@ -29,6 +29,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(qedit);
|
||||||
struct null_renderer
|
struct null_renderer
|
||||||
{
|
{
|
||||||
struct strmbase_renderer renderer;
|
struct strmbase_renderer renderer;
|
||||||
|
HANDLE run_event;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct null_renderer *impl_from_strmbase_renderer(struct strmbase_renderer *iface)
|
static struct null_renderer *impl_from_strmbase_renderer(struct strmbase_renderer *iface)
|
||||||
|
@ -41,7 +42,14 @@ static HRESULT WINAPI NullRenderer_DoRenderSample(struct strmbase_renderer *ifac
|
||||||
struct null_renderer *filter = impl_from_strmbase_renderer(iface);
|
struct null_renderer *filter = impl_from_strmbase_renderer(iface);
|
||||||
|
|
||||||
if (filter->renderer.filter.state == State_Paused)
|
if (filter->renderer.filter.state == State_Paused)
|
||||||
|
{
|
||||||
|
const HANDLE events[2] = {filter->run_event, filter->renderer.flush_event};
|
||||||
|
|
||||||
SetEvent(filter->renderer.state_event);
|
SetEvent(filter->renderer.state_event);
|
||||||
|
LeaveCriticalSection(&filter->renderer.csRenderLock);
|
||||||
|
WaitForMultipleObjects(2, events, FALSE, INFINITE);
|
||||||
|
EnterCriticalSection(&filter->renderer.csRenderLock);
|
||||||
|
}
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -56,14 +64,29 @@ static void null_renderer_destroy(struct strmbase_renderer *iface)
|
||||||
{
|
{
|
||||||
struct null_renderer *filter = impl_from_strmbase_renderer(iface);
|
struct null_renderer *filter = impl_from_strmbase_renderer(iface);
|
||||||
|
|
||||||
|
CloseHandle(filter->run_event);
|
||||||
strmbase_renderer_cleanup(&filter->renderer);
|
strmbase_renderer_cleanup(&filter->renderer);
|
||||||
free(filter);
|
free(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void null_renderer_start_stream(struct strmbase_renderer *iface)
|
||||||
|
{
|
||||||
|
struct null_renderer *filter = impl_from_strmbase_renderer(iface);
|
||||||
|
SetEvent(filter->run_event);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void null_renderer_stop_stream(struct strmbase_renderer *iface)
|
||||||
|
{
|
||||||
|
struct null_renderer *filter = impl_from_strmbase_renderer(iface);
|
||||||
|
ResetEvent(filter->run_event);
|
||||||
|
}
|
||||||
|
|
||||||
static const struct strmbase_renderer_ops renderer_ops =
|
static const struct strmbase_renderer_ops renderer_ops =
|
||||||
{
|
{
|
||||||
.pfnCheckMediaType = NullRenderer_CheckMediaType,
|
.pfnCheckMediaType = NullRenderer_CheckMediaType,
|
||||||
.pfnDoRenderSample = NullRenderer_DoRenderSample,
|
.pfnDoRenderSample = NullRenderer_DoRenderSample,
|
||||||
|
.renderer_start_stream = null_renderer_start_stream,
|
||||||
|
.renderer_stop_stream = null_renderer_stop_stream,
|
||||||
.renderer_destroy = null_renderer_destroy,
|
.renderer_destroy = null_renderer_destroy,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -75,6 +98,7 @@ HRESULT null_renderer_create(IUnknown *outer, IUnknown **out)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
strmbase_renderer_init(&object->renderer, outer, &CLSID_NullRenderer, L"In", &renderer_ops);
|
strmbase_renderer_init(&object->renderer, outer, &CLSID_NullRenderer, L"In", &renderer_ops);
|
||||||
|
object->run_event = CreateEventW(NULL, TRUE, FALSE, NULL);
|
||||||
|
|
||||||
TRACE("Created null renderer %p.\n", object);
|
TRACE("Created null renderer %p.\n", object);
|
||||||
*out = &object->renderer.filter.IUnknown_inner;
|
*out = &object->renderer.filter.IUnknown_inner;
|
||||||
|
|
|
@ -615,7 +615,7 @@ static void test_filter_state(IMemInputPin *input, IFilterGraph2 *graph)
|
||||||
hr = IMediaControl_GetState(control, 1000, &state);
|
hr = IMediaControl_GetState(control, 1000, &state);
|
||||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
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);
|
hr = IMediaControl_Stop(control);
|
||||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||||
|
@ -648,7 +648,7 @@ static void test_filter_state(IMemInputPin *input, IFilterGraph2 *graph)
|
||||||
hr = IMediaControl_GetState(control, 1000, &state);
|
hr = IMediaControl_GetState(control, 1000, &state);
|
||||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
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);
|
hr = IMediaControl_Run(control);
|
||||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||||
|
@ -674,7 +674,7 @@ static void test_filter_state(IMemInputPin *input, IFilterGraph2 *graph)
|
||||||
hr = IMediaControl_GetState(control, 1000, &state);
|
hr = IMediaControl_GetState(control, 1000, &state);
|
||||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
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);
|
hr = IMediaControl_Run(control);
|
||||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||||
|
@ -742,7 +742,7 @@ static void test_flushing(IPin *pin, IMemInputPin *input, IFilterGraph2 *graph)
|
||||||
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
|
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
|
||||||
|
|
||||||
thread = send_frame(input);
|
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);
|
hr = IMediaControl_GetState(control, 0, &state);
|
||||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||||
|
@ -766,7 +766,7 @@ static void test_flushing(IPin *pin, IMemInputPin *input, IFilterGraph2 *graph)
|
||||||
todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
|
todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
|
||||||
|
|
||||||
thread = send_frame(input);
|
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);
|
hr = IMediaControl_Run(control);
|
||||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||||
|
|
Loading…
Reference in New Issue