diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index 131e022b0ba..a8c6cc3391c 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -1690,6 +1690,7 @@ static void update_render_count(struct filter_graph *graph) /* Perform the paused -> running transition. The caller must hold graph->cs. */ static HRESULT graph_start(struct filter_graph *graph, REFERENCE_TIME stream_start) { + struct media_event *event, *next; REFERENCE_TIME stream_stop; struct filter *filter; HRESULT hr = S_OK; @@ -1697,6 +1698,17 @@ static HRESULT graph_start(struct filter_graph *graph, REFERENCE_TIME stream_sta graph->EcCompleteCount = 0; update_render_count(graph); + LIST_FOR_EACH_ENTRY_SAFE(event, next, &graph->media_events, struct media_event, entry) + { + if (event->code == EC_COMPLETE) + { + list_remove(&event->entry); + free(event); + } + } + if (list_empty(&graph->media_events)) + ResetEvent(graph->media_event_handle); + if (graph->defaultclock && !graph->refClock) IFilterGraph2_SetDefaultSyncSource(&graph->IFilterGraph2_iface); diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index 81b13255382..4822b65a7a6 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -5249,7 +5249,7 @@ static void test_set_notify_flags(void) hr = IMediaControl_Run(media_control); ok(hr == S_OK, "Got hr %#x.\n", hr); - todo_wine ok(WaitForSingleObject(event, 0) == WAIT_TIMEOUT, "Event should not be signaled.\n"); + ok(WaitForSingleObject(event, 0) == WAIT_TIMEOUT, "Event should not be signaled.\n"); hr = IMediaEventSink_Notify(media_event_sink, EC_COMPLETE, S_OK, (LONG_PTR)&filter.IBaseFilter_iface); @@ -5298,9 +5298,9 @@ static void test_set_notify_flags(void) DestroyWindow(window); } -#define check_events(a, b, c, d) check_events_(__LINE__, a, b, c, d) +#define check_events(a, b, c) check_events_(__LINE__, a, b, c) static void check_events_(unsigned int line, IMediaEventEx *media_event, - int expected_ec_complete_count, int expected_ec_status_count, BOOL todo) + int expected_ec_complete_count, int expected_ec_status_count) { int ec_complete_count = 0; int ec_status_count = 0; @@ -5320,7 +5320,7 @@ static void check_events_(unsigned int line, IMediaEventEx *media_event, ok(hr == S_OK, "Got hr %#x.\n", hr); } ok(hr == E_ABORT, "Got hr %#x.\n", hr); - todo_wine_if(todo) ok_(__FILE__, line)(ec_complete_count == expected_ec_complete_count, + ok_(__FILE__, line)(ec_complete_count == expected_ec_complete_count, "Expected %d EC_COMPLETE events.\n", expected_ec_complete_count); ok_(__FILE__, line)(ec_status_count == expected_ec_status_count, "Expected %d EC_STATUS events.\n", expected_ec_status_count); @@ -5378,7 +5378,7 @@ static void test_events(void) hr = IMediaEventSink_Notify(media_event_sink, EC_STATUS, (LONG_PTR)status, (LONG_PTR)status); ok(hr == S_OK, "Got hr %#x.\n", hr); - check_events(media_event, 0, 2, FALSE); + check_events(media_event, 0, 2); hr = IMediaControl_Pause(media_control); ok(hr == S_OK, "Got hr %#x.\n", hr); @@ -5391,12 +5391,12 @@ static void test_events(void) hr = IMediaEventSink_Notify(media_event_sink, EC_STATUS, (LONG_PTR)status, (LONG_PTR)status); ok(hr == S_OK, "Got hr %#x.\n", hr); - check_events(media_event, 0, 2, FALSE); + check_events(media_event, 0, 2); hr = IMediaControl_Run(media_control); ok(hr == S_OK, "Got hr %#x.\n", hr); - check_events(media_event, 0, 0, FALSE); + check_events(media_event, 0, 0); /* Pausing and then running the graph clears pending EC_COMPLETE events. * This remains true even with default handling canceled. */ @@ -5415,7 +5415,7 @@ static void test_events(void) hr = IMediaControl_Stop(media_control); ok(hr == S_OK, "Got hr %#x.\n", hr); - check_events(media_event, 1, 2, FALSE); + check_events(media_event, 1, 2); hr = IMediaControl_Run(media_control); ok(hr == S_OK, "Got hr %#x.\n", hr); @@ -5433,7 +5433,7 @@ static void test_events(void) hr = IMediaControl_Run(media_control); ok(hr == S_OK, "Got hr %#x.\n", hr); - check_events(media_event, 0, 2, TRUE); + check_events(media_event, 0, 2); hr = IMediaEventSink_Notify(media_event_sink, EC_STATUS, (LONG_PTR)status, (LONG_PTR)status); ok(hr == S_OK, "Got hr %#x.\n", hr); @@ -5448,7 +5448,7 @@ static void test_events(void) hr = IMediaControl_Pause(media_control); ok(hr == S_OK, "Got hr %#x.\n", hr); - check_events(media_event, 1, 2, FALSE); + check_events(media_event, 1, 2); hr = IMediaControl_Run(media_control); ok(hr == S_OK, "Got hr %#x.\n", hr); @@ -5465,7 +5465,7 @@ static void test_events(void) hr = IMediaControl_Run(media_control); ok(hr == S_OK, "Got hr %#x.\n", hr); - check_events(media_event, 0, 2, TRUE); + check_events(media_event, 0, 2); /* GetEvent() resets the event object if there are no events available. */