mf/session: Shutdown and release presentation clock on session shutdown.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2020-11-20 16:21:16 +03:00 committed by Alexandre Julliard
parent b8e550a575
commit b3461c4864
2 changed files with 20 additions and 1 deletions

View File

@ -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);

View File

@ -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);