Signed-off-by: Anton Baskanov baskanov@gmail.com --- dlls/quartz/tests/filtergraph.c | 134 ++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+)
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index e4b72958e10..c65d60d840d 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -5148,6 +5148,139 @@ static void test_autoplug_uyvy(void) ok(source_pin.ref == 1, "Got outstanding refcount %d.\n", source_pin.ref); }
+static void test_set_notify_flags(void) +{ + static const WNDCLASSA class = + { + .lpfnWndProc = DefWindowProcA, + .lpszClassName = "quartz_test_window", + }; + IFilterGraph2 *graph = create_graph(); + IMediaEventSink *media_event_sink; + IMediaControl *media_control; + IMediaEventEx *media_event; + struct testfilter filter; + LONG_PTR param1, param2; + HANDLE event; + HWND window; + HRESULT hr; + ULONG ref; + LONG code; + MSG msg; + + RegisterClassA(&class); + window = CreateWindowA("quartz_test_window", NULL, WS_OVERLAPPEDWINDOW, + 50, 50, 150, 150, NULL, NULL, NULL, NULL); + ok(!!window, "Failed to create window.\n"); + + hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&media_control); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaEventEx, (void **)&media_event); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaEventSink, (void **)&media_event_sink); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + testfilter_init(&filter, NULL, 0); + filter.IAMFilterMiscFlags_iface.lpVtbl = &testmiscflags_vtbl; + filter.misc_flags = AM_FILTER_MISC_FLAGS_IS_RENDERER; + + hr = IFilterGraph2_AddFilter(graph, &filter.IBaseFilter_iface, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaEventEx_GetEventHandle(media_event, (OAEVENT *)&event); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaEventEx_SetNotifyWindow(media_event, (OAHWND)window, WM_USER, 0); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaControl_Run(media_control); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + ok(WaitForSingleObject(event, 0) == 0, "Event should be signaled.\n"); + + while (PeekMessageA(&msg, window, WM_USER, WM_USER, PM_REMOVE)); + + hr = IMediaEventEx_SetNotifyFlags(media_event, AM_MEDIAEVENT_NONOTIFY); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + todo_wine ok(WaitForSingleObject(event, 0) == WAIT_TIMEOUT, "Event should not be signaled.\n"); + + hr = IMediaEventEx_GetEvent(media_event, &code, ¶m1, ¶m2, 50); + todo_wine ok(hr == E_ABORT, "Got hr %#x.\n", hr); + + hr = IMediaEventSink_Notify(media_event_sink, EC_STATUS, (LONG_PTR)"a", (LONG_PTR)"b"); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + todo_wine ok(WaitForSingleObject(event, 0) == WAIT_TIMEOUT, "Event should not be signaled.\n"); + + ok(!PeekMessageA(&msg, window, WM_USER, WM_USER, PM_REMOVE), "Window should not be notified.\n"); + + hr = IMediaEventEx_GetEvent(media_event, &code, ¶m1, ¶m2, 50); + todo_wine ok(hr == E_ABORT, "Got hr %#x.\n", hr); + + hr = IMediaEventSink_Notify(media_event_sink, EC_COMPLETE, S_OK, + (LONG_PTR)&filter.IBaseFilter_iface); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + ok(WaitForSingleObject(event, 0) == 0, "Event should be signaled.\n"); + + hr = IMediaControl_Stop(media_control); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + ok(WaitForSingleObject(event, 0) == 0, "Event should be signaled.\n"); + + hr = IMediaControl_Pause(media_control); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + ok(WaitForSingleObject(event, 0) == 0, "Event should be signaled.\n"); + + 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"); + + hr = IMediaEventSink_Notify(media_event_sink, EC_COMPLETE, S_OK, + (LONG_PTR)&filter.IBaseFilter_iface); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + ok(WaitForSingleObject(event, 0) == 0, "Event should be signaled.\n"); + + hr = IMediaEventEx_GetEvent(media_event, &code, ¶m1, ¶m2, 50); + todo_wine ok(hr == E_ABORT, "Got hr %#x.\n", hr); + + todo_wine ok(WaitForSingleObject(event, 0) == WAIT_TIMEOUT, "Event should not be signaled.\n"); + + hr = IMediaEventEx_SetNotifyFlags(media_event, 0); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaControl_Stop(media_control); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaControl_Run(media_control); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaEventSink_Notify(media_event_sink, EC_COMPLETE, S_OK, + (LONG_PTR)&filter.IBaseFilter_iface); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaEventEx_SetNotifyFlags(media_event, AM_MEDIAEVENT_NONOTIFY); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + todo_wine ok(WaitForSingleObject(event, 0) == WAIT_TIMEOUT, "Event should not be signaled.\n"); + + hr = IMediaControl_Stop(media_control); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + IMediaControl_Release(media_control); + IMediaEventEx_Release(media_event); + IMediaEventSink_Release(media_event_sink); + ref = IFilterGraph2_Release(graph); + ok(!ref, "Got outstanding refcount %d.\n", ref); + ok(filter.ref == 1, "Got outstanding refcount %d.\n", filter.ref); + + DestroyWindow(window); + UnregisterClassA("quartz_test_window", GetModuleHandleA(NULL)); +} + START_TEST(filtergraph) { CoInitializeEx(NULL, COINIT_MULTITHREADED); @@ -5172,6 +5305,7 @@ START_TEST(filtergraph) test_add_source_filter(); test_window_threading(); test_autoplug_uyvy(); + test_set_notify_flags();
CoUninitialize(); test_render_with_multithread();
Signed-off-by: Anton Baskanov baskanov@gmail.com --- dlls/quartz/filtergraph.c | 49 +++++++++++++++++++++++++-------- dlls/quartz/tests/filtergraph.c | 16 +++++------ 2 files changed, 46 insertions(+), 19 deletions(-)
diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index 58038829217..1ccb4f1b3d4 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -142,6 +142,17 @@ static BOOL EventsQueue_GetEvent(EventsQueue* omr, Event* evt, LONG msTimeOut) return TRUE; }
+static void EventsQueue_Clear(EventsQueue* omr) +{ + EnterCriticalSection(&omr->msg_crst); + + omr->msg_toget = 0; + omr->msg_tosave = 0; + ResetEvent(omr->msg_event); + + LeaveCriticalSection(&omr->msg_crst); +} + #define MAX_ITF_CACHE_ENTRIES 3 typedef struct _ITF_CACHE_ENTRY { const IID* riid; @@ -1748,6 +1759,9 @@ static HRESULT graph_start(struct filter_graph *graph, REFERENCE_TIME stream_sta graph->EcCompleteCount = 0; update_render_count(graph);
+ if (graph->notif.disabled) + ResetEvent(graph->evqueue.msg_event); + if (graph->defaultclock && !graph->refClock) IFilterGraph2_SetDefaultSyncSource(&graph->IFilterGraph2_iface);
@@ -4794,6 +4808,9 @@ static HRESULT WINAPI MediaEvent_GetEvent(IMediaEventEx *iface, LONG *lEventCode return S_OK; }
+ if (This->notif.disabled) + ResetEvent(This->evqueue.msg_event); + *lEventCode = 0; return E_ABORT; } @@ -4890,6 +4907,9 @@ static HRESULT WINAPI MediaEvent_SetNotifyFlags(IMediaEventEx *iface, LONG lNoNo
This->notif.disabled = lNoNotifyFlags;
+ if (lNoNotifyFlags) + EventsQueue_Clear(&This->evqueue); + return S_OK; }
@@ -5288,15 +5308,22 @@ static HRESULT WINAPI MediaEventSink_Notify(IMediaEventSink *iface, LONG EventCo TRACE("Process EC_COMPLETE notification\n"); if (++This->EcCompleteCount == This->nRenderers) { - evt.lEventCode = EC_COMPLETE; - evt.lParam1 = S_OK; - evt.lParam2 = 0; - TRACE("Send EC_COMPLETE to app\n"); - EventsQueue_PutEvent(&This->evqueue, &evt); - if (!This->notif.disabled && This->notif.hWnd) - { - TRACE("Send Window message\n"); - PostMessageW(This->notif.hWnd, This->notif.msg, 0, This->notif.instance); + if (!This->notif.disabled) + { + evt.lEventCode = EC_COMPLETE; + evt.lParam1 = S_OK; + evt.lParam2 = 0; + TRACE("Send EC_COMPLETE to app\n"); + EventsQueue_PutEvent(&This->evqueue, &evt); + if (This->notif.hWnd) + { + TRACE("Send Window message\n"); + PostMessageW(This->notif.hWnd, This->notif.msg, 0, This->notif.instance); + } + } + else + { + SetEvent(This->evqueue.msg_event); } This->CompletionStatus = EC_COMPLETE; This->got_ec_complete = 1; @@ -5307,13 +5334,13 @@ static HRESULT WINAPI MediaEventSink_Notify(IMediaEventSink *iface, LONG EventCo { /* FIXME: Not handled yet */ } - else + else if (!This->notif.disabled) { evt.lEventCode = EventCode; evt.lParam1 = EventParam1; evt.lParam2 = EventParam2; EventsQueue_PutEvent(&This->evqueue, &evt); - if (!This->notif.disabled && This->notif.hWnd) + if (This->notif.hWnd) PostMessageW(This->notif.hWnd, This->notif.msg, 0, This->notif.instance); }
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index c65d60d840d..faf12a8307e 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -5203,20 +5203,20 @@ static void test_set_notify_flags(void) hr = IMediaEventEx_SetNotifyFlags(media_event, AM_MEDIAEVENT_NONOTIFY); 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 = IMediaEventEx_GetEvent(media_event, &code, ¶m1, ¶m2, 50); - todo_wine ok(hr == E_ABORT, "Got hr %#x.\n", hr); + ok(hr == E_ABORT, "Got hr %#x.\n", hr);
hr = IMediaEventSink_Notify(media_event_sink, EC_STATUS, (LONG_PTR)"a", (LONG_PTR)"b"); 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");
ok(!PeekMessageA(&msg, window, WM_USER, WM_USER, PM_REMOVE), "Window should not be notified.\n");
hr = IMediaEventEx_GetEvent(media_event, &code, ¶m1, ¶m2, 50); - todo_wine ok(hr == E_ABORT, "Got hr %#x.\n", hr); + ok(hr == E_ABORT, "Got hr %#x.\n", hr);
hr = IMediaEventSink_Notify(media_event_sink, EC_COMPLETE, S_OK, (LONG_PTR)&filter.IBaseFilter_iface); @@ -5237,7 +5237,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); @@ -5246,9 +5246,9 @@ static void test_set_notify_flags(void) ok(WaitForSingleObject(event, 0) == 0, "Event should be signaled.\n");
hr = IMediaEventEx_GetEvent(media_event, &code, ¶m1, ¶m2, 50); - todo_wine ok(hr == E_ABORT, "Got hr %#x.\n", hr); + ok(hr == E_ABORT, "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 = IMediaEventEx_SetNotifyFlags(media_event, 0); ok(hr == S_OK, "Got hr %#x.\n", hr); @@ -5265,7 +5265,7 @@ static void test_set_notify_flags(void) hr = IMediaEventEx_SetNotifyFlags(media_event, AM_MEDIAEVENT_NONOTIFY); 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 = IMediaControl_Stop(media_control); ok(hr == S_OK, "Got hr %#x.\n", hr);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=85564
Your paranoid android.
=== wvistau64 (64 bit report) ===
Report validation errors: quartz:filtergraph crashed (c0000374)
=== w2008s64 (64 bit report) ===
Report validation errors: quartz:filtergraph crashed (c0000374)
=== w864 (64 bit report) ===
Report validation errors: quartz:filtergraph crashed (c0000374)
=== w1064v1507 (64 bit report) ===
Report validation errors: quartz:filtergraph crashed (c0000374)
=== w1064v1809 (64 bit report) ===
Report validation errors: quartz:filtergraph crashed (c0000374)
=== w1064 (64 bit report) ===
Report validation errors: quartz:filtergraph crashed (c0000374)
=== w1064_2qxl (64 bit report) ===
Report validation errors: quartz:filtergraph crashed (c0000374)
=== w10pro64 (64 bit report) ===
Report validation errors: quartz:filtergraph crashed (c0000374)
=== w10pro64_ar (64 bit report) ===
Report validation errors: quartz:filtergraph crashed (c0000374)
=== w10pro64_he (64 bit report) ===
Report validation errors: quartz:filtergraph crashed (c0000374)
=== w10pro64_ja (64 bit report) ===
Report validation errors: quartz:filtergraph crashed (c0000374)
=== w10pro64_zh_CN (64 bit report) ===
Report validation errors: quartz:filtergraph crashed (c0000374)
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=85563
Your paranoid android.
=== wvistau64 (64 bit report) ===
Report validation errors: quartz:filtergraph crashed (c0000374)
=== w2008s64 (64 bit report) ===
Report validation errors: quartz:filtergraph crashed (c0000374)
=== w864 (64 bit report) ===
Report validation errors: quartz:filtergraph crashed (c0000374)
=== w1064v1507 (64 bit report) ===
Report validation errors: quartz:filtergraph crashed (c0000374)
=== w1064v1809 (64 bit report) ===
Report validation errors: quartz:filtergraph crashed (c0000374)
=== w1064 (64 bit report) ===
Report validation errors: quartz:filtergraph crashed (c0000374)
=== w1064_2qxl (64 bit report) ===
Report validation errors: quartz:filtergraph crashed (c0000374)
=== w10pro64 (64 bit report) ===
Report validation errors: quartz:filtergraph crashed (c0000374)
=== w10pro64_ar (64 bit report) ===
Report validation errors: quartz:filtergraph crashed (c0000374)
=== w10pro64_he (64 bit report) ===
Report validation errors: quartz:filtergraph crashed (c0000374)
=== w10pro64_ja (64 bit report) ===
Report validation errors: quartz:filtergraph crashed (c0000374)
=== w10pro64_zh_CN (64 bit report) ===
Report validation errors: quartz:filtergraph crashed (c0000374)