[PATCH 0/2] MR10684: quartz: Fix WaitForCompletion behavior when default handling is canceled.
From: Akihiro Sagawa <sagawa.aki@gmail.com> --- dlls/quartz/tests/filtergraph.c | 48 +++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index a3071c0db91..09d32932676 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -5945,10 +5945,54 @@ static void test_events(void) hr = IMediaControl_Stop(media_control); ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IMediaEventEx_RestoreDefaultHandling(media_event, EC_COMPLETE); + /* Test WaitForCompletion(). */ + + hr = IMediaEventEx_CancelDefaultHandling(media_event, EC_COMPLETE); ok(hr == S_OK, "Got hr %#lx.\n", hr); - /* Test WaitForCompletion(). */ + hr = IMediaControl_Run(media_control); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IMediaEventEx_WaitForCompletion(media_event, 0, &code); + ok(hr == E_ABORT, "Got hr %#lx.\n", hr); + + hr = IMediaEventSink_Notify(media_event_sink, EC_COMPLETE, S_OK, + (LONG_PTR)&filter.IBaseFilter_iface); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + code = 0xdeadbeef; + hr = IMediaEventEx_WaitForCompletion(media_event, 0, &code); + todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); + todo_wine ok(code == EC_COMPLETE, "Got code %#lx.\n", code); + + hr = IMediaEventEx_WaitForCompletion(media_event, 0, &code); + todo_wine ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr); + + hr = IMediaEventEx_SetNotifyFlags(media_event, AM_MEDIAEVENT_NONOTIFY); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IMediaEventSink_Notify(media_event_sink, EC_COMPLETE, S_OK, + (LONG_PTR)&filter.IBaseFilter_iface); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + code = 0xdeadbeef; + hr = IMediaEventEx_WaitForCompletion(media_event, 0, &code); + todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(code == 0, "Got code %#lx.\n", code); + + code = 0xdeadbeef; + hr = IMediaEventEx_WaitForCompletion(media_event, 0, &code); + todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(code == 0, "Got code %#lx.\n", code); + + hr = IMediaEventEx_SetNotifyFlags(media_event, 0); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IMediaControl_Stop(media_control); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IMediaEventEx_RestoreDefaultHandling(media_event, EC_COMPLETE); + ok(hr == S_OK, "Got hr %#lx.\n", hr); hr = IMediaControl_Run(media_control); ok(hr == S_OK, "Got hr %#lx.\n", hr); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10684
From: Akihiro Sagawa <sagawa.aki@gmail.com> --- dlls/quartz/filtergraph.c | 21 ++++++++++++++++----- dlls/quartz/tests/filtergraph.c | 8 ++++---- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index e4194f7d8eb..79fcc425e53 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -5389,16 +5389,27 @@ static HRESULT WINAPI MediaEventSink_Notify(IMediaEventSink *iface, LONG code, EnterCriticalSection(&graph->event_cs); - if (code == EC_COMPLETE && graph->HandleEcComplete) + if (code == EC_COMPLETE) { - if (++graph->EcCompleteCount == graph->nRenderers) + if (!graph->HandleEcComplete || + ++graph->EcCompleteCount == graph->nRenderers) { + if (graph->HandleEcComplete) + { + param1 = S_OK; + param2 = 0; + graph->current_pos = graph->stream_stop; + } if (graph->media_events_disabled) + { SetEvent(graph->media_event_handle); + graph->CompletionStatus = 0; + } else - queue_media_event(graph, EC_COMPLETE, S_OK, 0); - graph->CompletionStatus = EC_COMPLETE; - graph->current_pos = graph->stream_stop; + { + queue_media_event(graph, EC_COMPLETE, param1, param2); + graph->CompletionStatus = EC_COMPLETE; + } SetEvent(graph->hEventCompletion); } } diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index 09d32932676..087c37be538 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -5962,8 +5962,8 @@ static void test_events(void) code = 0xdeadbeef; hr = IMediaEventEx_WaitForCompletion(media_event, 0, &code); - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); - todo_wine ok(code == EC_COMPLETE, "Got code %#lx.\n", code); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(code == EC_COMPLETE, "Got code %#lx.\n", code); hr = IMediaEventEx_WaitForCompletion(media_event, 0, &code); todo_wine ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr); @@ -5977,12 +5977,12 @@ static void test_events(void) code = 0xdeadbeef; hr = IMediaEventEx_WaitForCompletion(media_event, 0, &code); - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(hr == S_OK, "Got hr %#lx.\n", hr); ok(code == 0, "Got code %#lx.\n", code); code = 0xdeadbeef; hr = IMediaEventEx_WaitForCompletion(media_event, 0, &code); - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(hr == S_OK, "Got hr %#lx.\n", hr); ok(code == 0, "Got code %#lx.\n", code); hr = IMediaEventEx_SetNotifyFlags(media_event, 0); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10684
This merge request was approved by Elizabeth Figura. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10684
participants (3)
-
Akihiro Sagawa -
Akihiro Sagawa (@sgwaki) -
Elizabeth Figura (@zfigura)