From a4890ac799a01c6fddad6d210ec6f1e2489cb450 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Fri, 28 Jan 2022 10:17:12 +0300 Subject: [PATCH] mfmediaengine: Handle shutdown state in GetBuffered(). Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/mfmediaengine/main.c | 6 +++++- dlls/mfmediaengine/tests/mfmediaengine.c | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dlls/mfmediaengine/main.c b/dlls/mfmediaengine/main.c index 490d1630e95..91f1224f4b0 100644 --- a/dlls/mfmediaengine/main.c +++ b/dlls/mfmediaengine/main.c @@ -1525,8 +1525,12 @@ static HRESULT WINAPI media_engine_GetBuffered(IMFMediaEngineEx *iface, IMFMedia return hr; 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); + LeaveCriticalSection(&engine->cs); return hr; diff --git a/dlls/mfmediaengine/tests/mfmediaengine.c b/dlls/mfmediaengine/tests/mfmediaengine.c index 388af4b1877..6e201893b0c 100644 --- a/dlls/mfmediaengine/tests/mfmediaengine.c +++ b/dlls/mfmediaengine/tests/mfmediaengine.c @@ -341,7 +341,6 @@ static void test_Shutdown(void) ok(state == 100, "Unexpected state %d.\n", state); hr = IMFMediaEngine_GetBuffered(media_engine, &time_range); -todo_wine ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); hr = IMFMediaEngine_Load(media_engine);