From: Brendan McGrath <bmcgrath@codeweavers.com> --- dlls/mf/sar.c | 7 ++++++- dlls/mf/tests/mf.c | 4 ---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/dlls/mf/sar.c b/dlls/mf/sar.c index 1b9e14d3476..4b269f8ab0d 100644 --- a/dlls/mf/sar.c +++ b/dlls/mf/sar.c @@ -427,6 +427,7 @@ static void audio_renderer_set_presentation_clock(struct audio_renderer *rendere static HRESULT WINAPI audio_renderer_sink_SetPresentationClock(IMFMediaSink *iface, IMFPresentationClock *clock) { struct audio_renderer *renderer = impl_from_IMFMediaSink(iface); + IMFPresentationTimeSource *time_source = NULL; HRESULT hr = S_OK; TRACE("%p, %p.\n", iface, clock); @@ -435,8 +436,12 @@ static HRESULT WINAPI audio_renderer_sink_SetPresentationClock(IMFMediaSink *ifa if (renderer->flags & SAR_SHUT_DOWN) hr = MF_E_SHUTDOWN; - else + else if (!clock || SUCCEEDED(hr = IMFPresentationClock_GetTimeSource(clock, &time_source))) + { + if (time_source) + IMFPresentationTimeSource_Release(time_source); audio_renderer_set_presentation_clock(renderer, clock); + } LeaveCriticalSection(&renderer->cs); diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 9e3d5afcc90..85e6bc50552 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -6342,7 +6342,6 @@ static void test_sar(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IMFMediaSink_SetPresentationClock(sink, present_clock); - todo_wine ok(hr == MF_E_CLOCK_NO_TIME_SOURCE, "Unexpected hr %#lx.\n", hr); hr = MFCreateSystemTimeSource(&time_source); @@ -6974,9 +6973,7 @@ if (time_source) SET_EXPECT(presentation_clock_GetTimeSource); hr = IMFMediaSink_SetPresentationClock(sink, clock); - todo_wine ok(hr == MF_E_CLOCK_NO_TIME_SOURCE, "Unexpected hr %#lx.\n", hr); - todo_wine CHECK_CALLED(presentation_clock_GetTimeSource); IMFPresentationTimeSource_AddRef(presentation_clock->time_source = time_source); @@ -6985,7 +6982,6 @@ if (time_source) SET_EXPECT(presentation_clock_AddClockStateSink); hr = IMFMediaSink_SetPresentationClock(sink, clock); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine CHECK_CALLED(presentation_clock_GetTimeSource); CHECK_CALLED(presentation_clock_AddClockStateSink); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10126