mfmediaengine: Handle shutdown state in GetBuffered().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2022-01-28 10:17:12 +03:00 committed by Alexandre Julliard
parent 318aa0f387
commit a4890ac799
2 changed files with 5 additions and 2 deletions

View File

@ -1525,8 +1525,12 @@ static HRESULT WINAPI media_engine_GetBuffered(IMFMediaEngineEx *iface, IMFMedia
return hr; return hr;
EnterCriticalSection(&engine->cs); EnterCriticalSection(&engine->cs);
if (!isnan(engine->duration))
if (engine->flags & FLAGS_ENGINE_SHUT_DOWN)
hr = MF_E_SHUTDOWN;
else if (!isnan(engine->duration))
hr = IMFMediaTimeRange_AddRange(*range, 0.0, engine->duration); hr = IMFMediaTimeRange_AddRange(*range, 0.0, engine->duration);
LeaveCriticalSection(&engine->cs); LeaveCriticalSection(&engine->cs);
return hr; return hr;

View File

@ -341,7 +341,6 @@ static void test_Shutdown(void)
ok(state == 100, "Unexpected state %d.\n", state); ok(state == 100, "Unexpected state %d.\n", state);
hr = IMFMediaEngine_GetBuffered(media_engine, &time_range); hr = IMFMediaEngine_GetBuffered(media_engine, &time_range);
todo_wine
ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);
hr = IMFMediaEngine_Load(media_engine); hr = IMFMediaEngine_Load(media_engine);