Nikolay Sivov : mf: Set shutdown state flag for presentation clock.

Alexandre Julliard julliard at winehq.org
Wed Mar 11 17:38:31 CDT 2020


Module: wine
Branch: master
Commit: 5009e5da07b3c2e974dc9446b3bd483b814e415c
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=5009e5da07b3c2e974dc9446b3bd483b814e415c

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Wed Mar 11 14:19:42 2020 +0300

mf: Set shutdown state flag for presentation clock.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mf/session.c  | 28 ++++++++++++++++++++++++----
 dlls/mf/tests/mf.c | 31 +++++++++++++++++++++++++++----
 2 files changed, 51 insertions(+), 8 deletions(-)

diff --git a/dlls/mf/session.c b/dlls/mf/session.c
index 29f366a34e..91fcce57ca 100644
--- a/dlls/mf/session.c
+++ b/dlls/mf/session.c
@@ -239,6 +239,7 @@ struct presentation_clock
     float rate;
     LONGLONG frequency;
     CRITICAL_SECTION cs;
+    BOOL is_shut_down;
 };
 
 struct quality_manager
@@ -3332,16 +3333,35 @@ static ULONG WINAPI present_clock_shutdown_Release(IMFShutdown *iface)
 
 static HRESULT WINAPI present_clock_shutdown_Shutdown(IMFShutdown *iface)
 {
-    FIXME("%p.\n", iface);
+    struct presentation_clock *clock = impl_from_IMFShutdown(iface);
 
-    return E_NOTIMPL;
+    TRACE("%p.\n", iface);
+
+    EnterCriticalSection(&clock->cs);
+    clock->is_shut_down = TRUE;
+    LeaveCriticalSection(&clock->cs);
+
+    return S_OK;
 }
 
 static HRESULT WINAPI present_clock_shutdown_GetShutdownStatus(IMFShutdown *iface, MFSHUTDOWN_STATUS *status)
 {
-    FIXME("%p, %p.\n", iface, status);
+    struct presentation_clock *clock = impl_from_IMFShutdown(iface);
+    HRESULT hr = S_OK;
 
-    return E_NOTIMPL;
+    TRACE("%p, %p.\n", iface, status);
+
+    if (!status)
+        return E_INVALIDARG;
+
+    EnterCriticalSection(&clock->cs);
+    if (clock->is_shut_down)
+        *status = MFSHUTDOWN_COMPLETED;
+    else
+        hr = MF_E_INVALIDREQUEST;
+    LeaveCriticalSection(&clock->cs);
+
+    return hr;
 }
 
 static const IMFShutdownVtbl presentclockshutdownvtbl =
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c
index 5742da1620..a86a8ecdbb 100644
--- a/dlls/mf/tests/mf.c
+++ b/dlls/mf/tests/mf.c
@@ -1776,6 +1776,10 @@ static void test_presentation_clock(void)
     ok(rate == 1.0f, "Unexpected rate.\n");
     ok(!thin, "Unexpected thinning.\n");
 
+    hr = IMFPresentationClock_GetState(clock, 0, &state);
+    ok(hr == S_OK, "Failed to get clock state, hr %#x.\n", hr);
+    ok(state == MFCLOCK_STATE_PAUSED, "Unexpected state %d.\n", state);
+
     hr = IMFPresentationClock_Start(clock, 0);
     ok(hr == S_OK, "Failed to stop, hr %#x.\n", hr);
 
@@ -1809,18 +1813,37 @@ static void test_presentation_clock(void)
 
     /* Shutdown behavior. */
     hr = IMFShutdown_GetShutdownStatus(shutdown, NULL);
-todo_wine
     ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
 
+    hr = IMFShutdown_GetShutdownStatus(shutdown, &status);
+    ok(hr == MF_E_INVALIDREQUEST, "Unexpected hr %#x.\n", hr);
+
     hr = IMFShutdown_Shutdown(shutdown);
-todo_wine
     ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr);
 
+    time_source = NULL;
+    hr = IMFPresentationClock_GetTimeSource(clock, &time_source);
+    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(!!time_source, "Unexpected instance %p.\n", time_source);
+    IMFPresentationTimeSource_Release(time_source);
+
+    hr = IMFPresentationClock_GetTime(clock, &time);
+    ok(hr == S_OK, "Failed to get time, hr %#x.\n", hr);
+
     hr = IMFShutdown_GetShutdownStatus(shutdown, &status);
-todo_wine {
     ok(hr == S_OK, "Failed to get status, hr %#x.\n", hr);
     ok(status == MFSHUTDOWN_COMPLETED, "Unexpected status.\n");
-}
+
+    hr = IMFPresentationClock_Start(clock, 0);
+    ok(hr == S_OK, "Failed to start the clock, hr %#x.\n", hr);
+
+    hr = IMFShutdown_GetShutdownStatus(shutdown, &status);
+    ok(hr == S_OK, "Failed to get status, hr %#x.\n", hr);
+    ok(status == MFSHUTDOWN_COMPLETED, "Unexpected status.\n");
+
+    hr = IMFShutdown_Shutdown(shutdown);
+    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
     IMFShutdown_Release(shutdown);
 
     IMFPresentationClock_Release(clock);




More information about the wine-cvs mailing list