mf: Release presentation clock on SAR shutdown.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
dc6af98c11
commit
2931ebd0d3
|
@ -282,6 +282,21 @@ static HRESULT WINAPI audio_renderer_sink_GetStreamSinkById(IMFMediaSink *iface,
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void audio_renderer_set_presentation_clock(struct audio_renderer *renderer, IMFPresentationClock *clock)
|
||||||
|
{
|
||||||
|
if (renderer->clock)
|
||||||
|
{
|
||||||
|
IMFPresentationClock_RemoveClockStateSink(renderer->clock, &renderer->IMFClockStateSink_iface);
|
||||||
|
IMFPresentationClock_Release(renderer->clock);
|
||||||
|
}
|
||||||
|
renderer->clock = clock;
|
||||||
|
if (renderer->clock)
|
||||||
|
{
|
||||||
|
IMFPresentationClock_AddRef(renderer->clock);
|
||||||
|
IMFPresentationClock_AddClockStateSink(renderer->clock, &renderer->IMFClockStateSink_iface);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI audio_renderer_sink_SetPresentationClock(IMFMediaSink *iface, IMFPresentationClock *clock)
|
static HRESULT WINAPI audio_renderer_sink_SetPresentationClock(IMFMediaSink *iface, IMFPresentationClock *clock)
|
||||||
{
|
{
|
||||||
struct audio_renderer *renderer = impl_from_IMFMediaSink(iface);
|
struct audio_renderer *renderer = impl_from_IMFMediaSink(iface);
|
||||||
|
@ -294,19 +309,7 @@ static HRESULT WINAPI audio_renderer_sink_SetPresentationClock(IMFMediaSink *ifa
|
||||||
if (renderer->is_shut_down)
|
if (renderer->is_shut_down)
|
||||||
hr = MF_E_SHUTDOWN;
|
hr = MF_E_SHUTDOWN;
|
||||||
else
|
else
|
||||||
{
|
audio_renderer_set_presentation_clock(renderer, clock);
|
||||||
if (renderer->clock)
|
|
||||||
{
|
|
||||||
IMFPresentationClock_RemoveClockStateSink(renderer->clock, &renderer->IMFClockStateSink_iface);
|
|
||||||
IMFPresentationClock_Release(renderer->clock);
|
|
||||||
}
|
|
||||||
renderer->clock = clock;
|
|
||||||
if (renderer->clock)
|
|
||||||
{
|
|
||||||
IMFPresentationClock_AddRef(renderer->clock);
|
|
||||||
IMFPresentationClock_AddClockStateSink(renderer->clock, &renderer->IMFClockStateSink_iface);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LeaveCriticalSection(&renderer->cs);
|
LeaveCriticalSection(&renderer->cs);
|
||||||
|
|
||||||
|
@ -353,6 +356,7 @@ static HRESULT WINAPI audio_renderer_sink_Shutdown(IMFMediaSink *iface)
|
||||||
renderer->is_shut_down = TRUE;
|
renderer->is_shut_down = TRUE;
|
||||||
IMFMediaEventQueue_Shutdown(renderer->event_queue);
|
IMFMediaEventQueue_Shutdown(renderer->event_queue);
|
||||||
IMFMediaEventQueue_Shutdown(renderer->stream_event_queue);
|
IMFMediaEventQueue_Shutdown(renderer->stream_event_queue);
|
||||||
|
audio_renderer_set_presentation_clock(renderer, NULL);
|
||||||
LeaveCriticalSection(&renderer->cs);
|
LeaveCriticalSection(&renderer->cs);
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
|
@ -2970,8 +2970,10 @@ todo_wine
|
||||||
IUnknown_Release(unk);
|
IUnknown_Release(unk);
|
||||||
|
|
||||||
/* Shutdown */
|
/* Shutdown */
|
||||||
|
EXPECT_REF(present_clock, 2);
|
||||||
hr = IMFMediaSink_Shutdown(sink);
|
hr = IMFMediaSink_Shutdown(sink);
|
||||||
ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr);
|
ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr);
|
||||||
|
EXPECT_REF(present_clock, 1);
|
||||||
|
|
||||||
hr = IMFMediaSink_Shutdown(sink);
|
hr = IMFMediaSink_Shutdown(sink);
|
||||||
ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);
|
ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);
|
||||||
|
|
Loading…
Reference in New Issue