Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/session.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/dlls/mf/session.c b/dlls/mf/session.c index 8d9325abc53..76c39631bd9 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -502,7 +502,7 @@ static HRESULT session_submit_simple_command(struct media_session *session, enum return hr; }
-static void session_clear_topologies(struct media_session *session) +static void session_clear_queued_topologies(struct media_session *session) { struct queued_topology *ptr, *next;
@@ -1055,10 +1055,24 @@ static void session_close(struct media_session *session) break; }
+ session_clear_queued_topologies(session); if (FAILED(hr)) session_set_closed(session, hr); }
+static void session_clear_topologies(struct media_session *session) +{ + HRESULT hr = S_OK; + + if (session->state == SESSION_STATE_CLOSED) + hr = MF_E_INVALIDREQUEST; + else + session_clear_queued_topologies(session); + IMFMediaEventQueue_QueueEventParamVar(session->event_queue, MESessionTopologiesCleared, + &GUID_NULL, hr, NULL); + session_command_complete(session); +} + static struct media_source *session_get_media_source(struct media_session *session, IMFMediaSource *source) { struct media_source *cur; @@ -1561,7 +1575,7 @@ static void session_set_topology(struct media_session *session, DWORD flags, IMF } else if (topology && flags & MFSESSION_SETTOPOLOGY_IMMEDIATE) { - session_clear_topologies(session); + session_clear_queued_topologies(session); session_clear_presentation(session); }
@@ -1636,7 +1650,7 @@ static ULONG WINAPI mfsession_Release(IMFMediaSession *iface)
if (!refcount) { - session_clear_topologies(session); + session_clear_queued_topologies(session); session_clear_presentation(session); session_clear_command_list(session); if (session->presentation.current_topology) @@ -2079,9 +2093,6 @@ static HRESULT WINAPI session_commands_callback_Invoke(IMFAsyncCallback *iface, { case SESSION_CMD_CLEAR_TOPOLOGIES: session_clear_topologies(session); - IMFMediaEventQueue_QueueEventParamVar(session->event_queue, MESessionTopologiesCleared, &GUID_NULL, - S_OK, NULL); - session_command_complete(session); break; case SESSION_CMD_SET_TOPOLOGY: session_set_topology(session, op->u.set_topology.flags, op->u.set_topology.topology);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/session.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/dlls/mf/session.c b/dlls/mf/session.c index 76c39631bd9..4e70aba410a 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -903,9 +903,12 @@ static void session_set_started(struct media_session *session) session_command_complete(session); }
-static void session_set_paused(struct media_session *session, HRESULT status) +static void session_set_paused(struct media_session *session, unsigned int state, HRESULT status) { - session->state = SESSION_STATE_PAUSED; + /* Failed event status could indicate a failure during normal transition to paused state, + or an attempt to pause from invalid initial state. To finalize failed transition in the former case, + state is still forced to PAUSED, otherwise previous state is retained. */ + if (state != ~0u) session->state = state; if (SUCCEEDED(status)) session_set_caps(session, session->caps & ~MFSESSIONCAP_PAUSE); IMFMediaEventQueue_QueueEventParamVar(session->event_queue, MESessionPaused, &GUID_NULL, status, NULL); @@ -923,6 +926,7 @@ static void session_set_closed(struct media_session *session, HRESULT status)
static void session_pause(struct media_session *session) { + unsigned int state = ~0u; HRESULT hr;
switch (session->state) @@ -932,14 +936,19 @@ static void session_pause(struct media_session *session) /* Transition in two steps - pause the clock, wait for sinks, then pause sources. */ if (SUCCEEDED(hr = IMFPresentationClock_Pause(session->clock))) session->state = SESSION_STATE_PAUSING_SINKS; + state = SESSION_STATE_PAUSED;
break; + + case SESSION_STATE_STOPPED: + hr = MF_E_SESSION_PAUSEWHILESTOPPED; + break; default: hr = MF_E_INVALIDREQUEST; }
if (FAILED(hr)) - session_set_paused(session, hr); + session_set_paused(session, state, hr); }
static void session_clear_end_of_presentation(struct media_session *session) @@ -2502,7 +2511,7 @@ static void session_set_source_object_state(struct media_session *session, IUnkn if (!session_is_source_nodes_state(session, OBJ_STATE_PAUSED)) break;
- session_set_paused(session, S_OK); + session_set_paused(session, SESSION_STATE_PAUSED, S_OK); break; case SESSION_STATE_STOPPING_SOURCES: if (!session_is_source_nodes_state(session, OBJ_STATE_STOPPED)) @@ -2578,7 +2587,7 @@ static void session_set_sink_stream_state(struct media_session *session, IMFStre }
if (FAILED(hr)) - session_set_paused(session, hr); + session_set_paused(session, SESSION_STATE_PAUSED, hr);
break; case SESSION_STATE_STOPPING_SINKS:
From: Rémi Bernon rbernon@codeweavers.com
Seek is not implemented but not completing the command makes pending or later queued commands to not be executed.
This partially fixes Guilty Gear Strive being stuck on character selection screen.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/session.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-)
diff --git a/dlls/mf/session.c b/dlls/mf/session.c index 4e70aba410a..8b0d3cbf681 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -806,6 +806,26 @@ static struct topo_node *session_get_node_by_id(const struct media_session *sess return NULL; }
+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); + } + + if ((e = list_head(&session->commands))) + { + op = LIST_ENTRY(e, struct session_op, entry); + MFPutWorkItem(MFASYNC_CALLBACK_QUEUE_STANDARD, &session->commands_callback, &op->IUnknown_iface); + } +} + static void session_start(struct media_session *session, const GUID *time_format, const PROPVARIANT *start_position) { struct media_source *source; @@ -840,6 +860,7 @@ static void session_start(struct media_session *session, const GUID *time_format break; case SESSION_STATE_STARTED: FIXME("Seeking is not implemented.\n"); + session_command_complete(session); break; case SESSION_STATE_CLOSED: IMFMediaEventQueue_QueueEventParamVar(session->event_queue, MESessionStarted, &GUID_NULL, @@ -850,26 +871,6 @@ static void session_start(struct media_session *session, const GUID *time_format } }
-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); - } - - if ((e = list_head(&session->commands))) - { - op = LIST_ENTRY(e, struct session_op, entry); - MFPutWorkItem(MFASYNC_CALLBACK_QUEUE_STANDARD, &session->commands_callback, &op->IUnknown_iface); - } -} - static void session_set_started(struct media_session *session) { struct media_source *source;
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/session.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/dlls/mf/session.c b/dlls/mf/session.c index 8b0d3cbf681..de82d687aba 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -865,6 +865,7 @@ static void session_start(struct media_session *session, const GUID *time_format case SESSION_STATE_CLOSED: IMFMediaEventQueue_QueueEventParamVar(session->event_queue, MESessionStarted, &GUID_NULL, MF_E_INVALIDREQUEST, NULL); + session_command_complete(session); break; default: ;
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/session.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/dlls/mf/session.c b/dlls/mf/session.c index de82d687aba..826c31ce121 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -862,13 +862,11 @@ static void session_start(struct media_session *session, const GUID *time_format FIXME("Seeking is not implemented.\n"); session_command_complete(session); break; - case SESSION_STATE_CLOSED: + default: IMFMediaEventQueue_QueueEventParamVar(session->event_queue, MESessionStarted, &GUID_NULL, MF_E_INVALIDREQUEST, NULL); session_command_complete(session); break; - default: - ; } }