Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- 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 debb58de4d..47431c4968 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) { - 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)))) { - struct queued_topology *queued_topology; + queued_topology->topology = topology; + IMFTopology_AddRef(queued_topology->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); + }
- list_add_tail(&session->topologies, &queued_topology->entry); - } + if (session->presentation.topo_status == MF_TOPOSTATUS_INVALID) + { + hr = session_set_current_topology(session, topology); + 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)