mf: Set shutdown state flag for presentation clock.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
feature/deterministic
Nikolay Sivov 2020-03-11 14:19:42 +03:00 committed by Alexandre Julliard
parent 15657f68a4
commit 5009e5da07
2 changed files with 51 additions and 8 deletions

View File

@ -239,6 +239,7 @@ struct presentation_clock
float rate;
LONGLONG frequency;
CRITICAL_SECTION cs;
BOOL is_shut_down;
};
struct quality_manager
@ -3332,16 +3333,35 @@ static ULONG WINAPI present_clock_shutdown_Release(IMFShutdown *iface)
static HRESULT WINAPI present_clock_shutdown_Shutdown(IMFShutdown *iface)
{
FIXME("%p.\n", iface);
struct presentation_clock *clock = impl_from_IMFShutdown(iface);
return E_NOTIMPL;
TRACE("%p.\n", iface);
EnterCriticalSection(&clock->cs);
clock->is_shut_down = TRUE;
LeaveCriticalSection(&clock->cs);
return S_OK;
}
static HRESULT WINAPI present_clock_shutdown_GetShutdownStatus(IMFShutdown *iface, MFSHUTDOWN_STATUS *status)
{
FIXME("%p, %p.\n", iface, status);
struct presentation_clock *clock = impl_from_IMFShutdown(iface);
HRESULT hr = S_OK;
return E_NOTIMPL;
TRACE("%p, %p.\n", iface, status);
if (!status)
return E_INVALIDARG;
EnterCriticalSection(&clock->cs);
if (clock->is_shut_down)
*status = MFSHUTDOWN_COMPLETED;
else
hr = MF_E_INVALIDREQUEST;
LeaveCriticalSection(&clock->cs);
return hr;
}
static const IMFShutdownVtbl presentclockshutdownvtbl =

View File

@ -1776,6 +1776,10 @@ static void test_presentation_clock(void)
ok(rate == 1.0f, "Unexpected rate.\n");
ok(!thin, "Unexpected thinning.\n");
hr = IMFPresentationClock_GetState(clock, 0, &state);
ok(hr == S_OK, "Failed to get clock state, hr %#x.\n", hr);
ok(state == MFCLOCK_STATE_PAUSED, "Unexpected state %d.\n", state);
hr = IMFPresentationClock_Start(clock, 0);
ok(hr == S_OK, "Failed to stop, hr %#x.\n", hr);
@ -1809,18 +1813,37 @@ static void test_presentation_clock(void)
/* Shutdown behavior. */
hr = IMFShutdown_GetShutdownStatus(shutdown, NULL);
todo_wine
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
hr = IMFShutdown_GetShutdownStatus(shutdown, &status);
ok(hr == MF_E_INVALIDREQUEST, "Unexpected hr %#x.\n", hr);
hr = IMFShutdown_Shutdown(shutdown);
todo_wine
ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr);
time_source = NULL;
hr = IMFPresentationClock_GetTimeSource(clock, &time_source);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(!!time_source, "Unexpected instance %p.\n", time_source);
IMFPresentationTimeSource_Release(time_source);
hr = IMFPresentationClock_GetTime(clock, &time);
ok(hr == S_OK, "Failed to get time, hr %#x.\n", hr);
hr = IMFShutdown_GetShutdownStatus(shutdown, &status);
todo_wine {
ok(hr == S_OK, "Failed to get status, hr %#x.\n", hr);
ok(status == MFSHUTDOWN_COMPLETED, "Unexpected status.\n");
}
hr = IMFPresentationClock_Start(clock, 0);
ok(hr == S_OK, "Failed to start the clock, hr %#x.\n", hr);
hr = IMFShutdown_GetShutdownStatus(shutdown, &status);
ok(hr == S_OK, "Failed to get status, hr %#x.\n", hr);
ok(status == MFSHUTDOWN_COMPLETED, "Unexpected status.\n");
hr = IMFShutdown_Shutdown(shutdown);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
IMFShutdown_Release(shutdown);
IMFPresentationClock_Release(clock);