From b3461c48649b6b3ae290fec92c7c2f67f884aae9 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Fri, 20 Nov 2020 16:21:16 +0300 Subject: [PATCH] mf/session: Shutdown and release presentation clock on session shutdown. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/mf/session.c | 3 +++ dlls/mf/tests/mf.c | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/dlls/mf/session.c b/dlls/mf/session.c index dffd5113ff9..4821ed5c90a 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -1792,6 +1792,9 @@ static HRESULT WINAPI mfsession_Shutdown(IMFMediaSession *iface) IMFMediaEventQueue_Shutdown(session->event_queue); if (session->quality_manager) IMFQualityManager_Shutdown(session->quality_manager); + MFShutdownObject((IUnknown *)session->clock); + IMFPresentationClock_Release(session->clock); + session->clock = NULL; } LeaveCriticalSection(&session->cs); diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 2a671225a11..27e859fa82d 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -1188,13 +1188,14 @@ static void test_media_session(void) IMFAttributes *attributes; IMFMediaSession *session; IMFTopology *topology; + IMFShutdown *shutdown; PROPVARIANT propvar; + DWORD status, caps; IMFGetService *gs; IMFClock *clock; IUnknown *unk; HRESULT hr; float rate; - DWORD caps; BOOL thin; hr = MFStartup(MF_VERSION, MFSTARTUP_FULL); @@ -1275,9 +1276,24 @@ todo_wine hr = MFCreateMediaSession(NULL, &session); ok(hr == S_OK, "Failed to create media session, hr %#x.\n", hr); + hr = IMFMediaSession_GetClock(session, &clock); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IMFClock_QueryInterface(clock, &IID_IMFShutdown, (void **)&shutdown); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IMFShutdown_GetShutdownStatus(shutdown, &status); + ok(hr == MF_E_INVALIDREQUEST, "Unexpected hr %#x.\n", hr); + hr = IMFMediaSession_Shutdown(session); ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr); + hr = IMFShutdown_GetShutdownStatus(shutdown, &status); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(status == MFSHUTDOWN_COMPLETED, "Unexpected shutdown status %u.\n", status); + + IMFShutdown_Release(shutdown); + hr = IMFMediaSession_ClearTopologies(session); ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);