quartz: Return an error code if a filter reports an incorrect state.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-07-14 19:56:25 -05:00 committed by Alexandre Julliard
parent a8a644c1b8
commit 9dd5aa17a0
2 changed files with 54 additions and 0 deletions

View File

@ -4961,6 +4961,15 @@ static HRESULT WINAPI MediaFilter_GetState(IMediaFilter *iface, DWORD timeout, F
hr = VFW_S_STATE_INTERMEDIATE;
else if (filter_hr != S_OK && filter_hr != VFW_S_STATE_INTERMEDIATE)
hr = filter_hr;
if (hr == S_OK && filter_state == State_Paused && graph->state != State_Paused)
{
async_filter = filter->filter;
hr = VFW_S_STATE_INTERMEDIATE;
}
else if (filter_state != graph->state && filter_state != State_Paused)
hr = E_FAIL;
if (filter_state != graph->state)
ERR("Filter %p reported incorrect state %u.\n", filter->filter, filter_state);
}

View File

@ -3254,6 +3254,21 @@ static void test_filter_state(void)
ok(hr == S_OK, "Got hr %#x.\n", hr);
check_filter_state(graph, State_Paused);
sink.state = State_Stopped;
hr = IMediaControl_GetState(control, 0, &state);
ok(hr == E_FAIL, "Got hr %#x.\n", hr);
ok(state == State_Paused, "Got state %u.\n", state);
sink.state = State_Running;
hr = IMediaControl_GetState(control, 0, &state);
ok(hr == E_FAIL, "Got hr %#x.\n", hr);
ok(state == State_Paused, "Got state %u.\n", state);
sink.state = State_Paused;
hr = IMediaControl_GetState(control, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(state == State_Paused, "Got state %u.\n", state);
hr = IMediaControl_Stop(control);
ok(hr == S_OK, "Got hr %#x.\n", hr);
check_filter_state(graph, State_Stopped);
@ -3262,10 +3277,40 @@ static void test_filter_state(void)
ok(hr == S_OK, "Got hr %#x.\n", hr);
check_filter_state(graph, State_Running);
sink.state = State_Stopped;
hr = IMediaControl_GetState(control, 0, &state);
ok(hr == E_FAIL, "Got hr %#x.\n", hr);
ok(state == State_Running, "Got state %u.\n", state);
sink.state = State_Paused;
hr = IMediaControl_GetState(control, 0, &state);
ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
ok(state == State_Running, "Got state %u.\n", state);
sink.state = State_Running;
hr = IMediaControl_GetState(control, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(state == State_Running, "Got state %u.\n", state);
hr = IMediaControl_Stop(control);
ok(hr == S_OK, "Got hr %#x.\n", hr);
check_filter_state(graph, State_Stopped);
sink.state = State_Running;
hr = IMediaControl_GetState(control, 0, &state);
ok(hr == E_FAIL, "Got hr %#x.\n", hr);
ok(state == State_Stopped, "Got state %u.\n", state);
sink.state = State_Paused;
hr = IMediaControl_GetState(control, 0, &state);
ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
ok(state == State_Stopped, "Got state %u.\n", state);
sink.state = State_Stopped;
hr = IMediaControl_GetState(control, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(state == State_Stopped, "Got state %u.\n", state);
hr = IMediaControl_Pause(control);
ok(hr == S_OK, "Got hr %#x.\n", hr);
check_filter_state(graph, State_Paused);