[PATCH 0/2] MR11050: quartz: Update current and elapsed positions in Stop().
From: Elizabeth Figura <zfigura@codeweavers.com> --- dlls/quartz/tests/filtergraph.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index fad2d47990c..4402f1cb1a1 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -1750,8 +1750,10 @@ static HRESULT WINAPI testseek_SetPositions(IMediaSeeking *iface, LONGLONG *curr if (winetest_debug > 1) trace("%p->SetPositions(%I64d, %#lx, %I64d, %#lx)\n", iface, *current, current_flags, *stop, stop_flags); ok(filter->state != State_Running, "Filter should be paused or stopped while seeking.\n"); - filter->seek_current = *current; - filter->seek_stop = *stop; + if (current_flags & AM_SEEKING_AbsolutePositioning) + filter->seek_current = *current; + if (stop_flags & AM_SEEKING_AbsolutePositioning) + filter->seek_stop = *stop; *current = 12340000; *stop = 43210000; return filter->seek_hr; @@ -5104,6 +5106,24 @@ static void test_graph_seeking(void) ok(hr == S_OK, "Got hr %#lx.\n", hr); ok(time == 12340000, "Got time %I64d.\n", time); + hr = IMediaControl_Run(control); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + Sleep(100); + + hr = IMediaControl_Stop(control); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IMediaSeeking_GetCurrentPosition(seeking, &time); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(time == 12340000, "Got time %I64d.\n", time); + if (winetest_interactive) /* Timing problems make this test too liable to fail. */ + { + todo_wine ok(compare_time(filter1.seek_current, 1334 * 10000, 80 * 10000), + "Expected about 1334ms, got %I64d.\n", filter1.seek_current); + todo_wine ok(compare_time(filter2.seek_current, 1334 * 10000, 80 * 10000), + "Expected about 1334ms, got %I64d.\n", filter2.seek_current); + } + hr = IMediaFilter_SetSyncSource(filter, NULL); ok(hr == S_OK, "Got hr %#lx.\n", hr); @@ -5113,12 +5133,12 @@ static void test_graph_seeking(void) Sleep(100); hr = IMediaSeeking_GetCurrentPosition(seeking, &time); ok(hr == S_OK, "Got hr %#lx.\n", hr); - todo_wine ok(!time, "Got time %I64d.\n", time); + todo_wine ok(time == 8000 * 10000, "Got time %I64d.\n", time); current = stop = 0xdeadbeef; hr = IMediaSeeking_GetPositions(seeking, ¤t, &stop); ok(hr == S_OK, "Got hr %#lx.\n", hr); - todo_wine ok(!current, "Got time %I64d.\n", current); - ok(!stop, "Got time %I64d.\n", stop); + todo_wine ok(current == 8000 * 10000, "Got time %I64d.\n", current); + ok(stop == 8000 * 10000, "Got time %I64d.\n", stop); hr = IMediaControl_Stop(control); ok(hr == S_OK, "Got hr %#lx.\n", hr); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11050
From: Conor McCarthy <cmccarthy@codeweavers.com> --- dlls/quartz/filtergraph.c | 21 ++++++++++++++------- dlls/quartz/tests/filtergraph.c | 2 +- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index efe604530db..b449ef3c32c 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -5057,6 +5057,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); @@ -5076,6 +5087,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) @@ -5135,13 +5148,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 4402f1cb1a1..dde4da0655c 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -5120,7 +5120,7 @@ static void test_graph_seeking(void) { todo_wine ok(compare_time(filter1.seek_current, 1334 * 10000, 80 * 10000), "Expected about 1334ms, got %I64d.\n", filter1.seek_current); - todo_wine ok(compare_time(filter2.seek_current, 1334 * 10000, 80 * 10000), + ok(compare_time(filter2.seek_current, 1334 * 10000, 80 * 10000), "Expected about 1334ms, got %I64d.\n", filter2.seek_current); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11050
This merge request was approved by Conor McCarthy. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11050
This merge request was approved by Elizabeth Figura. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11050
participants (4)
-
Conor McCarthy -
Conor McCarthy (@cmccarthy) -
Elizabeth Figura -
Elizabeth Figura (@zfigura)