From: Conor McCarthy <cmccarthy@codeweavers.com> --- dlls/quartz/filtergraph.c | 24 ++++++++++++++++-------- dlls/quartz/tests/filtergraph.c | 1 - 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index 79fcc425e53..25116cea789 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -5061,6 +5061,17 @@ static HRESULT WINAPI MediaFilter_GetClassID(IMediaFilter *iface, CLSID * pClass return E_NOTIMPL; } +static void graph_update_positions(struct filter_graph *graph) +{ + if (graph->state == State_Running && !graph->needs_async_run && graph->refClock) + { + REFERENCE_TIME time; + IReferenceClock_GetTime(graph->refClock, &time); + graph->stream_elapsed += time - graph->stream_start; + graph->current_pos += graph->stream_elapsed; + } +} + static HRESULT WINAPI MediaFilter_Stop(IMediaFilter *iface) { struct filter_graph *graph = impl_from_IMediaFilter(iface); @@ -5080,6 +5091,8 @@ static HRESULT WINAPI MediaFilter_Stop(IMediaFilter *iface) sort_filters(graph); + graph_update_positions(graph); + if (graph->state == State_Running) { LIST_FOR_EACH_ENTRY(filter, &graph->filters, struct filter, entry) @@ -5101,7 +5114,8 @@ static HRESULT WINAPI MediaFilter_Stop(IMediaFilter *iface) graph->needs_async_run = 0; work = graph->async_run_work; - /* Update the current position, probably to synchronize multiple streams. */ + /* Update the current position, probably to synchronize multiple streams. + * TODO: on native, filters seem to be set to the position of the latest sample. */ IMediaSeeking_SetPositions(&graph->IMediaSeeking_iface, &graph->current_pos, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning); @@ -5139,13 +5153,7 @@ static HRESULT WINAPI MediaFilter_Pause(IMediaFilter *iface) if (graph->defaultclock && !graph->refClock) IFilterGraph2_SetDefaultSyncSource(&graph->IFilterGraph2_iface); - if (graph->state == State_Running && !graph->needs_async_run && graph->refClock) - { - REFERENCE_TIME time; - IReferenceClock_GetTime(graph->refClock, &time); - graph->stream_elapsed += time - graph->stream_start; - graph->current_pos += graph->stream_elapsed; - } + graph_update_positions(graph); LIST_FOR_EACH_ENTRY(filter, &graph->filters, struct filter, entry) { diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index a1fd01631d0..1468a2344e9 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -6169,7 +6169,6 @@ static void test_stopped_current_position(void) hr = IMediaSeeking_GetCurrentPosition(seeking, ¤t); ok(hr == S_OK, "Got hr %#lx.\n", hr); - todo_wine ok(compare_time(current, 2500 * 10000, 100 * 10000), "Expected about 2500ms, got %I64d.\n", current); IMediaSeeking_Release(seeking); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10885