Commit 20a1eb3b authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mf/session: Do not drop pending commands when clearing current presentation.

Calling Start() short after SetTopology() has a good chance of getting lost, because clearing logic will drop all pending commands. This is easy to reproduce with IMFPMediaPlayer, which works reliably on Windows. Signed-off-by: 's avatarNikolay Sivov <nsivov@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent e4e319d0
......@@ -855,12 +855,22 @@ static void session_shutdown_current_topology(struct media_session *session)
}
}
static void session_clear_command_list(struct media_session *session)
{
struct session_op *op, *op2;
LIST_FOR_EACH_ENTRY_SAFE(op, op2, &session->commands, struct session_op, entry)
{
list_remove(&op->entry);
IUnknown_Release(&op->IUnknown_iface);
}
}
static void session_clear_presentation(struct media_session *session)
{
struct media_source *source, *source2;
struct media_sink *sink, *sink2;
struct topo_node *node, *node2;
struct session_op *op, *op2;
session_shutdown_current_topology(session);
......@@ -895,12 +905,6 @@ static void session_clear_presentation(struct media_session *session)
IMFMediaEventGenerator_Release(sink->event_generator);
heap_free(sink);
}
LIST_FOR_EACH_ENTRY_SAFE(op, op2, &session->commands, struct session_op, entry)
{
list_remove(&op->entry);
IUnknown_Release(&op->IUnknown_iface);
}
}
static struct topo_node *session_get_node_by_id(const struct media_session *session, TOPOID id)
......@@ -1730,6 +1734,7 @@ static ULONG WINAPI mfsession_Release(IMFMediaSession *iface)
{
session_clear_topologies(session);
session_clear_presentation(session);
session_clear_command_list(session);
if (session->presentation.current_topology)
IMFTopology_Release(session->presentation.current_topology);
if (session->event_queue)
......@@ -1847,7 +1852,6 @@ static HRESULT WINAPI mfsession_Start(IMFMediaSession *iface, const GUID *format
hr = session_submit_command(session, op);
IUnknown_Release(&op->IUnknown_iface);
return hr;
}
......@@ -1896,6 +1900,7 @@ static HRESULT WINAPI mfsession_Shutdown(IMFMediaSession *iface)
IMFPresentationClock_Release(session->clock);
session->clock = NULL;
session_clear_presentation(session);
session_clear_command_list(session);
}
LeaveCriticalSection(&session->cs);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment