From: R��mi Bernon rbernon@codeweavers.com
Instead of waiting for completion, so that SESSION_CMD_END becomes unnecessary: when presentation ends, session_stop will simply try submitting next command from the list, without requiring a dummy pendign command. --- dlls/mf/session.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-)
diff --git a/dlls/mf/session.c b/dlls/mf/session.c index 7ec2df96759..807ea1cbf6d 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -48,7 +48,6 @@ enum session_command SESSION_CMD_STOP, SESSION_CMD_SET_RATE, /* Internally used commands. */ - SESSION_CMD_END, SESSION_CMD_QM_NOTIFY_TOPOLOGY, };
@@ -455,14 +454,6 @@ static HRESULT session_is_shut_down(struct media_session *session) return session->state == SESSION_STATE_SHUT_DOWN ? MF_E_SHUTDOWN : S_OK; }
-static void session_push_back_command(struct media_session *session, enum session_command command) -{ - struct session_op *op; - - if (SUCCEEDED(create_session_op(command, &op))) - list_add_head(&session->commands, &op->entry); -} - static HRESULT session_submit_command(struct media_session *session, struct session_op *op) { HRESULT hr; @@ -802,14 +793,7 @@ static void session_command_complete(struct media_session *session) struct session_op *op; struct list *e;
- /* Pop current command, submit next. */ - if ((e = list_head(&session->commands))) - { - op = LIST_ENTRY(e, struct session_op, entry); - list_remove(&op->entry); - IUnknown_Release(&op->IUnknown_iface); - } - + /* Submit next command. */ if ((e = list_head(&session->commands))) { op = LIST_ENTRY(e, struct session_op, entry); @@ -2381,6 +2365,8 @@ static HRESULT WINAPI session_commands_callback_Invoke(IMFAsyncCallback *iface, return S_OK; }
+ list_remove(&op->entry); + switch (op->command) { case SESSION_CMD_CLEAR_TOPOLOGIES: @@ -2415,6 +2401,8 @@ static HRESULT WINAPI session_commands_callback_Invoke(IMFAsyncCallback *iface,
LeaveCriticalSection(&session->cs);
+ IUnknown_Release(&op->IUnknown_iface); + return S_OK; }
@@ -3343,7 +3331,6 @@ static void session_raise_end_of_presentation(struct media_session *session) if (session_nodes_is_mask_set(session, MF_TOPOLOGY_MAX, SOURCE_FLAG_END_OF_PRESENTATION)) { session->presentation.flags |= SESSION_FLAG_END_OF_PRESENTATION; - session_push_back_command(session, SESSION_CMD_END); IMFMediaEventQueue_QueueEventParamVar(session->event_queue, MEEndOfPresentation, &GUID_NULL, S_OK, NULL); } }