From: Santino Mazza smazza@codeweavers.com
This fixes a bug when the session topology contains an invalid source, which makes the session thread to hang and stop executing commands. --- dlls/mf/session.c | 7 +++++++ dlls/mf/tests/mf.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/dlls/mf/session.c b/dlls/mf/session.c index 85baf07d05a..67a4ba31fb4 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -880,6 +880,8 @@ static void session_subscribe_sources(struct media_session *session) source->object))) { WARN("Failed to subscribe to source events, hr %#lx.\n", hr); + session_command_complete_with_event(session, MESessionStarted, hr, NULL); + return; } }
@@ -910,11 +912,16 @@ static void session_start(struct media_session *session, const GUID *time_format PropVariantCopy(&session->presentation.start_position, start_position);
session_subscribe_sources(session); + if (!(session->presentation.flags & SESSION_FLAG_SOURCES_SUBSCRIBED)) break;
LIST_FOR_EACH_ENTRY(source, &session->presentation.sources, struct media_source, entry) { if (FAILED(hr = IMFMediaSource_Start(source->source, source->pd, &GUID_NULL, start_position))) + { WARN("Failed to start media source %p, hr %#lx.\n", source->source, hr); + session_command_complete_with_event(session, MESessionStarted, hr, NULL); + return; + } }
session->state = SESSION_STATE_STARTING_SOURCES; diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 88838b4629a..76dc1a1bec9 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -2460,7 +2460,7 @@ static void test_media_session_events(void) hr = IMFMediaSession_Start(session, &GUID_NULL, &propvar); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = wait_media_event_until_blocking(session, callback, MESessionStarted, 1000, &propvar); - todo_wine ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr); + ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr); ok(propvar.vt == VT_EMPTY, "got vt %u\n", propvar.vt); ok(propvar.punkVal != (IUnknown *)topology, "got punkVal %p\n", propvar.punkVal); PropVariantClear(&propvar);