Nikolay Sivov : mf/session: Do not drop pending commands when clearing current presentation.
Alexandre Julliard
julliard at winehq.org
Fri May 28 16:22:28 CDT 2021
Module: wine
Branch: master
Commit: 20a1eb3b252b404bd2ed9a11dc03312ea11fff0d
URL: https://source.winehq.org/git/wine.git/?a=commit;h=20a1eb3b252b404bd2ed9a11dc03312ea11fff0d
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Fri May 28 15:49:02 2021 +0300
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: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/mf/session.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/dlls/mf/session.c b/dlls/mf/session.c
index 925a8c93d20..41caf02d059 100644
--- a/dlls/mf/session.c
+++ b/dlls/mf/session.c
@@ -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);
More information about the wine-cvs
mailing list