Fixes a bug where music on the radio in Fallout 3 is silent.
Upon receiving EOS, the game resets the position of the stream and then calls `IMediaControl_Run()` without calling `IMediaControl_Stop()`. In wine, this results in the `got_ec_complete` variable being uncleared, and the stream position is stuck at end of stream.
From: Connor McAdams cmcadams@codeweavers.com
Signed-off-by: Connor McAdams cmcadams@codeweavers.com --- dlls/quartz/tests/filtergraph.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index b4c79b17310..ebd1695617c 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -529,6 +529,25 @@ static void test_media_event(IFilterGraph2 *graph) flaky_wine ok(current == stop, "expected %s, got %s\n", wine_dbgstr_longlong(stop), wine_dbgstr_longlong(current));
+ hr = IMediaControl_Pause(control); + ok(SUCCEEDED(hr), "Got hr %#lx.\n", hr); + hr = IMediaControl_GetState(control, 1000, &state); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(state == State_Paused, "Got state %ld.\n", state); + + /* + * Reset position back to start without a stop. This can also be done + * while the stream is still running, but it's more prone to test failures + * if done that way. + */ + current = 0; + hr = IMediaSeeking_SetPositions(seeking, ¤t, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning); + ok(SUCCEEDED(hr), "Got hr %#lx.\n", hr); + + hr = IMediaSeeking_GetCurrentPosition(seeking, ¤t); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + todo_wine ok(current != stop, "Got current position %s.\n", wine_dbgstr_longlong(current)); + hr = IMediaControl_Stop(control); ok(SUCCEEDED(hr), "Got hr %#lx.\n", hr); hr = IMediaControl_GetState(control, 1000, &state);
From: Connor McAdams cmcadams@codeweavers.com
Signed-off-by: Connor McAdams cmcadams@codeweavers.com --- dlls/quartz/filtergraph.c | 10 ++-------- dlls/quartz/tests/filtergraph.c | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index 987821f3fb1..fd5ec5bf348 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -134,7 +134,6 @@ struct filter_graph int HandleEcComplete; int HandleEcRepaint; int HandleEcClockChanged; - unsigned int got_ec_complete : 1; unsigned int media_events_disabled : 1;
CRITICAL_SECTION cs; @@ -2378,11 +2377,7 @@ static HRESULT WINAPI MediaSeeking_GetCurrentPosition(IMediaSeeking *iface, LONG
EnterCriticalSection(&graph->cs);
- if (graph->got_ec_complete) - { - ret = graph->stream_stop; - } - else if (graph->state == State_Running && !graph->needs_async_run && graph->refClock) + if (graph->state == State_Running && !graph->needs_async_run && graph->refClock) { REFERENCE_TIME time; IReferenceClock_GetTime(graph->refClock, &time); @@ -5100,7 +5095,6 @@ static HRESULT WINAPI MediaFilter_Stop(IMediaFilter *iface) graph->state = State_Stopped; graph->needs_async_run = 0; work = graph->async_run_work; - graph->got_ec_complete = 0;
/* Update the current position, probably to synchronize multiple streams. */ IMediaSeeking_SetPositions(&graph->IMediaSeeking_iface, &graph->current_pos, @@ -5399,7 +5393,7 @@ static HRESULT WINAPI MediaEventSink_Notify(IMediaEventSink *iface, LONG code, else queue_media_event(graph, EC_COMPLETE, S_OK, 0); graph->CompletionStatus = EC_COMPLETE; - graph->got_ec_complete = 1; + graph->current_pos = graph->stream_stop; SetEvent(graph->hEventCompletion); } } diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index ebd1695617c..df1f02cfd00 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -546,7 +546,7 @@ static void test_media_event(IFilterGraph2 *graph)
hr = IMediaSeeking_GetCurrentPosition(seeking, ¤t); ok(hr == S_OK, "Got hr %#lx.\n", hr); - todo_wine ok(current != stop, "Got current position %s.\n", wine_dbgstr_longlong(current)); + ok(current != stop, "Got current position %s.\n", wine_dbgstr_longlong(current));
hr = IMediaControl_Stop(control); ok(SUCCEEDED(hr), "Got hr %#lx.\n", hr);
This merge request was approved by Elizabeth Figura.