Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/session.c | 33 ++++++++++++++++++--------------- dlls/mf/tests/mf.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 15 deletions(-)
diff --git a/dlls/mf/session.c b/dlls/mf/session.c index a2a2ba6fe5..c5235e42a8 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -1401,8 +1401,8 @@ static HRESULT WINAPI mfsession_GetFullTopology(IMFMediaSession *iface, DWORD fl { struct media_session *session = impl_from_IMFMediaSession(iface); struct queued_topology *queued; - HRESULT hr = S_OK; TOPOID topo_id; + HRESULT hr;
TRACE("%p, %#x, %s, %p.\n", iface, flags, wine_dbgstr_longlong(id), topology);
@@ -1410,27 +1410,30 @@ static HRESULT WINAPI mfsession_GetFullTopology(IMFMediaSession *iface, DWORD fl
EnterCriticalSection(&session->cs);
- if (flags & MFSESSION_GETFULLTOPOLOGY_CURRENT) + if (SUCCEEDED(hr = session_is_shut_down(session))) { - if (session->presentation.topo_status != MF_TOPOSTATUS_INVALID) - *topology = session->presentation.current_topology; + if (flags & MFSESSION_GETFULLTOPOLOGY_CURRENT) + { + if (session->presentation.topo_status != MF_TOPOSTATUS_INVALID) + *topology = session->presentation.current_topology; + else + hr = MF_E_INVALIDREQUEST; + } else - hr = MF_E_INVALIDREQUEST; - } - else - { - LIST_FOR_EACH_ENTRY(queued, &session->topologies, struct queued_topology, entry) { - if (SUCCEEDED(IMFTopology_GetTopologyID(queued->topology, &topo_id)) && topo_id == id) + LIST_FOR_EACH_ENTRY(queued, &session->topologies, struct queued_topology, entry) { - *topology = queued->topology; - break; + if (SUCCEEDED(IMFTopology_GetTopologyID(queued->topology, &topo_id)) && topo_id == id) + { + *topology = queued->topology; + break; + } } } - }
- if (*topology) - IMFTopology_AddRef(*topology); + if (*topology) + IMFTopology_AddRef(*topology); + }
LeaveCriticalSection(&session->cs);
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 5f3114da32..5a690880d1 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -1027,11 +1027,14 @@ static void test_media_session(void) IMFRateSupport *rate_support; IMFAttributes *attributes; IMFMediaSession *session; + IMFTopology *topology; + PROPVARIANT propvar; IMFGetService *gs; IMFClock *clock; IUnknown *unk; HRESULT hr; float rate; + DWORD caps; BOOL thin;
hr = MFStartup(MF_VERSION, MFSTARTUP_FULL); @@ -1115,12 +1118,40 @@ todo_wine hr = IMFMediaSession_Shutdown(session); ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr);
+ hr = IMFMediaSession_ClearTopologies(session); + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + + hr = IMFMediaSession_Start(session, &GUID_NULL, NULL); + ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr); + + propvar.vt = VT_EMPTY; + hr = IMFMediaSession_Start(session, &GUID_NULL, &propvar); + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + + hr = IMFMediaSession_Pause(session); + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + + hr = IMFMediaSession_Stop(session); + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + hr = IMFMediaSession_Close(session); ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);
hr = IMFMediaSession_GetClock(session, &clock); ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);
+ hr = IMFMediaSession_GetSessionCapabilities(session, &caps); + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + + hr = IMFMediaSession_GetSessionCapabilities(session, NULL); + ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr); + + hr = IMFMediaSession_GetFullTopology(session, MFSESSION_GETFULLTOPOLOGY_CURRENT, 0, &topology); + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + + hr = IMFMediaSession_Shutdown(session); + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + IMFMediaSession_Release(session);
/* Custom topology loader, GUID is not registered. */