Commit 1b2d528b authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

quartz: Remove EC_COMPLETE from the queue when starting the graph.

Based on a patch by Anton Baskanov. Signed-off-by: 's avatarZebediah Figura <z.figura12@gmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent d293200f
...@@ -1690,6 +1690,7 @@ static void update_render_count(struct filter_graph *graph) ...@@ -1690,6 +1690,7 @@ static void update_render_count(struct filter_graph *graph)
/* Perform the paused -> running transition. The caller must hold graph->cs. */ /* Perform the paused -> running transition. The caller must hold graph->cs. */
static HRESULT graph_start(struct filter_graph *graph, REFERENCE_TIME stream_start) static HRESULT graph_start(struct filter_graph *graph, REFERENCE_TIME stream_start)
{ {
struct media_event *event, *next;
REFERENCE_TIME stream_stop; REFERENCE_TIME stream_stop;
struct filter *filter; struct filter *filter;
HRESULT hr = S_OK; HRESULT hr = S_OK;
...@@ -1697,6 +1698,17 @@ static HRESULT graph_start(struct filter_graph *graph, REFERENCE_TIME stream_sta ...@@ -1697,6 +1698,17 @@ static HRESULT graph_start(struct filter_graph *graph, REFERENCE_TIME stream_sta
graph->EcCompleteCount = 0; graph->EcCompleteCount = 0;
update_render_count(graph); 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) if (graph->defaultclock && !graph->refClock)
IFilterGraph2_SetDefaultSyncSource(&graph->IFilterGraph2_iface); IFilterGraph2_SetDefaultSyncSource(&graph->IFilterGraph2_iface);
......
...@@ -5249,7 +5249,7 @@ static void test_set_notify_flags(void) ...@@ -5249,7 +5249,7 @@ static void test_set_notify_flags(void)
hr = IMediaControl_Run(media_control); hr = IMediaControl_Run(media_control);
ok(hr == S_OK, "Got hr %#x.\n", hr); 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, hr = IMediaEventSink_Notify(media_event_sink, EC_COMPLETE, S_OK,
(LONG_PTR)&filter.IBaseFilter_iface); (LONG_PTR)&filter.IBaseFilter_iface);
...@@ -5298,9 +5298,9 @@ static void test_set_notify_flags(void) ...@@ -5298,9 +5298,9 @@ static void test_set_notify_flags(void)
DestroyWindow(window); 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, 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_complete_count = 0;
int ec_status_count = 0; int ec_status_count = 0;
...@@ -5320,7 +5320,7 @@ static void check_events_(unsigned int line, IMediaEventEx *media_event, ...@@ -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 == S_OK, "Got hr %#x.\n", hr);
} }
ok(hr == E_ABORT, "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); "Expected %d EC_COMPLETE events.\n", expected_ec_complete_count);
ok_(__FILE__, line)(ec_status_count == expected_ec_status_count, ok_(__FILE__, line)(ec_status_count == expected_ec_status_count,
"Expected %d EC_STATUS events.\n", expected_ec_status_count); "Expected %d EC_STATUS events.\n", expected_ec_status_count);
...@@ -5378,7 +5378,7 @@ static void test_events(void) ...@@ -5378,7 +5378,7 @@ static void test_events(void)
hr = IMediaEventSink_Notify(media_event_sink, EC_STATUS, (LONG_PTR)status, (LONG_PTR)status); hr = IMediaEventSink_Notify(media_event_sink, EC_STATUS, (LONG_PTR)status, (LONG_PTR)status);
ok(hr == S_OK, "Got hr %#x.\n", hr); 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); hr = IMediaControl_Pause(media_control);
ok(hr == S_OK, "Got hr %#x.\n", hr); ok(hr == S_OK, "Got hr %#x.\n", hr);
...@@ -5391,12 +5391,12 @@ static void test_events(void) ...@@ -5391,12 +5391,12 @@ static void test_events(void)
hr = IMediaEventSink_Notify(media_event_sink, EC_STATUS, (LONG_PTR)status, (LONG_PTR)status); hr = IMediaEventSink_Notify(media_event_sink, EC_STATUS, (LONG_PTR)status, (LONG_PTR)status);
ok(hr == S_OK, "Got hr %#x.\n", hr); 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); hr = IMediaControl_Run(media_control);
ok(hr == S_OK, "Got hr %#x.\n", hr); 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. /* Pausing and then running the graph clears pending EC_COMPLETE events.
* This remains true even with default handling canceled. */ * This remains true even with default handling canceled. */
...@@ -5415,7 +5415,7 @@ static void test_events(void) ...@@ -5415,7 +5415,7 @@ static void test_events(void)
hr = IMediaControl_Stop(media_control); hr = IMediaControl_Stop(media_control);
ok(hr == S_OK, "Got hr %#x.\n", hr); 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); hr = IMediaControl_Run(media_control);
ok(hr == S_OK, "Got hr %#x.\n", hr); ok(hr == S_OK, "Got hr %#x.\n", hr);
...@@ -5433,7 +5433,7 @@ static void test_events(void) ...@@ -5433,7 +5433,7 @@ static void test_events(void)
hr = IMediaControl_Run(media_control); hr = IMediaControl_Run(media_control);
ok(hr == S_OK, "Got hr %#x.\n", hr); 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); hr = IMediaEventSink_Notify(media_event_sink, EC_STATUS, (LONG_PTR)status, (LONG_PTR)status);
ok(hr == S_OK, "Got hr %#x.\n", hr); ok(hr == S_OK, "Got hr %#x.\n", hr);
...@@ -5448,7 +5448,7 @@ static void test_events(void) ...@@ -5448,7 +5448,7 @@ static void test_events(void)
hr = IMediaControl_Pause(media_control); hr = IMediaControl_Pause(media_control);
ok(hr == S_OK, "Got hr %#x.\n", hr); 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); hr = IMediaControl_Run(media_control);
ok(hr == S_OK, "Got hr %#x.\n", hr); ok(hr == S_OK, "Got hr %#x.\n", hr);
...@@ -5465,7 +5465,7 @@ static void test_events(void) ...@@ -5465,7 +5465,7 @@ static void test_events(void)
hr = IMediaControl_Run(media_control); hr = IMediaControl_Run(media_control);
ok(hr == S_OK, "Got hr %#x.\n", hr); 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. */ /* GetEvent() resets the event object if there are no events available. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment