Commit 899ae42b authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

mf: Handle MESourceSeeked and MEStreamSeeked state change events.

If a session is paused then started again, or if a start position is provided we wait forever for the source to send a MESourceStarted event, when it sends a MESourceSeeked instead. This causes a deadlock in Bright Memory: Infinite as the game then waits for the Start command to complete, while the session is stuck in the SESSION_STATE_STARTING_SOURCES state. Signed-off-by: 's avatarRémi Bernon <rbernon@codeweavers.com> Signed-off-by: 's avatarNikolay Sivov <nsivov@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent b36e4cfe
...@@ -2295,6 +2295,8 @@ static enum object_state session_get_object_state_for_event(MediaEventType event ...@@ -2295,6 +2295,8 @@ static enum object_state session_get_object_state_for_event(MediaEventType event
{ {
switch (event) switch (event)
{ {
case MESourceSeeked:
case MEStreamSeeked:
case MESourceStarted: case MESourceStarted:
case MEStreamStarted: case MEStreamStarted:
case MEStreamSinkStarted: case MEStreamSinkStarted:
...@@ -2471,6 +2473,7 @@ static void session_set_source_object_state(struct media_session *session, IUnkn ...@@ -2471,6 +2473,7 @@ static void session_set_source_object_state(struct media_session *session, IUnkn
switch (event_type) switch (event_type)
{ {
case MESourceSeeked:
case MESourceStarted: case MESourceStarted:
case MESourcePaused: case MESourcePaused:
case MESourceStopped: case MESourceStopped:
...@@ -2485,6 +2488,7 @@ static void session_set_source_object_state(struct media_session *session, IUnkn ...@@ -2485,6 +2488,7 @@ static void session_set_source_object_state(struct media_session *session, IUnkn
} }
} }
break; break;
case MEStreamSeeked:
case MEStreamStarted: case MEStreamStarted:
case MEStreamPaused: case MEStreamPaused:
case MEStreamStopped: case MEStreamStopped:
...@@ -3172,6 +3176,10 @@ static HRESULT WINAPI session_events_callback_Invoke(IMFAsyncCallback *iface, IM ...@@ -3172,6 +3176,10 @@ static HRESULT WINAPI session_events_callback_Invoke(IMFAsyncCallback *iface, IM
switch (event_type) switch (event_type)
{ {
case MESourceSeeked:
case MEStreamSeeked:
FIXME("Source/stream seeking, semi-stub!\n");
/* fallthrough */
case MESourceStarted: case MESourceStarted:
case MESourcePaused: case MESourcePaused:
case MESourceStopped: case MESourceStopped:
......
...@@ -942,6 +942,44 @@ static void test_source_resolver(void) ...@@ -942,6 +942,44 @@ static void test_source_resolver(void)
video_stream = (IMFMediaStream *)var.punkVal; video_stream = (IMFMediaStream *)var.punkVal;
} }
hr = IMFMediaSource_Pause(mediasource);
ok(hr == S_OK, "Failed to pause media source, hr %#x.\n", hr);
if (get_event((IMFMediaEventGenerator *)mediasource, MESourcePaused, &var))
ok(var.vt == VT_EMPTY, "Unexpected value type.\n");
var.vt = VT_EMPTY;
hr = IMFMediaSource_Start(mediasource, descriptor, &GUID_NULL, &var);
ok(hr == S_OK, "Failed to start media source, hr %#x.\n", hr);
if (get_event((IMFMediaEventGenerator *)mediasource, MESourceStarted, &var))
ok(var.vt == VT_EMPTY, "Unexpected value type.\n");
hr = IMFMediaSource_Pause(mediasource);
ok(hr == S_OK, "Failed to pause media source, hr %#x.\n", hr);
if (get_event((IMFMediaEventGenerator *)mediasource, MESourcePaused, &var))
ok(var.vt == VT_EMPTY, "Unexpected value type.\n");
var.vt = VT_I8;
var.uhVal.QuadPart = 0;
hr = IMFMediaSource_Start(mediasource, descriptor, &GUID_NULL, &var);
ok(hr == S_OK, "Failed to start media source, hr %#x.\n", hr);
if (get_event((IMFMediaEventGenerator *)mediasource, MESourceSeeked, &var))
ok(var.vt == VT_I8, "Unexpected value type.\n");
hr = IMFMediaSource_Stop(mediasource);
ok(hr == S_OK, "Failed to pause media source, hr %#x.\n", hr);
if (get_event((IMFMediaEventGenerator *)mediasource, MESourceStopped, &var))
ok(var.vt == VT_EMPTY, "Unexpected value type.\n");
var.vt = VT_I8;
var.uhVal.QuadPart = 0;
hr = IMFMediaSource_Start(mediasource, descriptor, &GUID_NULL, &var);
ok(hr == S_OK, "Failed to start media source, hr %#x.\n", hr);
if (get_event((IMFMediaEventGenerator *)mediasource, MESourceStarted, &var))
ok(var.vt == VT_I8, "Unexpected value type.\n");
sample_count = 10; sample_count = 10;
for (i = 0; i < sample_count; ++i) for (i = 0; i < sample_count; ++i)
......
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