From 4aafa3c38da167a74a1f9ceab4d98b9401296aa6 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Fri, 10 Apr 2020 17:06:23 +0300 Subject: [PATCH] mf: Always queue set topologies. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/mf/session.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/dlls/mf/session.c b/dlls/mf/session.c index debb58de4db..47431c49687 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -1240,6 +1240,7 @@ static HRESULT session_set_current_topology(struct media_session *session, IMFTo static void session_set_topology(struct media_session *session, DWORD flags, IMFTopology *topology) { + IMFTopology *resolved_topology = NULL; HRESULT hr = S_OK; /* Resolve unless claimed to be full. */ @@ -1247,8 +1248,6 @@ static void session_set_topology(struct media_session *session, DWORD flags, IMF { if (!(flags & MFSESSION_SETTOPOLOGY_NORESOLUTION)) { - IMFTopology *resolved_topology = NULL; - hr = session_bind_output_nodes(topology); if (SUCCEEDED(hr)) @@ -1286,27 +1285,27 @@ static void session_set_topology(struct media_session *session, DWORD flags, IMF /* With no current topology set it right away, otherwise queue. */ if (topology) { + struct queued_topology *queued_topology; + + if ((queued_topology = heap_alloc_zero(sizeof(*queued_topology)))) + { + queued_topology->topology = topology; + IMFTopology_AddRef(queued_topology->topology); + + list_add_tail(&session->topologies, &queued_topology->entry); + } + if (session->presentation.topo_status == MF_TOPOSTATUS_INVALID) { hr = session_set_current_topology(session, topology); - } - else - { - struct queued_topology *queued_topology; - - if ((queued_topology = heap_alloc_zero(sizeof(*queued_topology)))) - { - queued_topology->topology = topology; - IMFTopology_AddRef(queued_topology->topology); - - list_add_tail(&session->topologies, &queued_topology->entry); - } + session_set_topo_status(session, hr, MF_TOPOSTATUS_READY); } } - session_set_topo_status(session, hr, MF_TOPOSTATUS_READY); - LeaveCriticalSection(&session->cs); + + if (resolved_topology) + IMFTopology_Release(resolved_topology); } static HRESULT WINAPI mfsession_QueryInterface(IMFMediaSession *iface, REFIID riid, void **out)