Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/session.c | 22 ++++++++++++++++++++++ dlls/mf/tests/mf.c | 8 ++++++++ 2 files changed, 30 insertions(+)
diff --git a/dlls/mf/session.c b/dlls/mf/session.c index 89128b7b6a..9042c1288a 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -70,6 +70,7 @@ struct media_session IMFPresentationClock *clock; IMFRateControl *clock_rate_control; IMFTopoLoader *topo_loader; + IMFQualityManager *quality_manager; struct list topologies; enum session_state state; CRITICAL_SECTION cs; @@ -332,6 +333,8 @@ static ULONG WINAPI mfsession_Release(IMFMediaSession *iface) IMFRateControl_Release(session->clock_rate_control); if (session->topo_loader) IMFTopoLoader_Release(session->topo_loader); + if (session->quality_manager) + IMFQualityManager_Release(session->quality_manager); DeleteCriticalSection(&session->cs); heap_free(session); } @@ -761,6 +764,7 @@ static const IMFRateControlVtbl session_rate_control_vtbl = */ HRESULT WINAPI MFCreateMediaSession(IMFAttributes *config, IMFMediaSession **session) { + BOOL without_quality_manager = FALSE; struct media_session *object; HRESULT hr;
@@ -806,11 +810,29 @@ HRESULT WINAPI MFCreateMediaSession(IMFAttributes *config, IMFMediaSession **ses WARN("Failed to create custom topology loader, hr %#x.\n", hr); } } + + if (SUCCEEDED(IMFAttributes_GetGUID(config, &MF_SESSION_QUALITY_MANAGER, &clsid))) + { + if (!(without_quality_manager = IsEqualGUID(&clsid, &GUID_NULL))) + { + if (FAILED(hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IMFQualityManager, + (void **)&object->quality_manager))) + { + WARN("Failed to create custom quality manager, hr %#x.\n", hr); + } + } + } }
if (!object->topo_loader && FAILED(hr = MFCreateTopoLoader(&object->topo_loader))) goto failed;
+ if (!object->quality_manager && !without_quality_manager && + FAILED(hr = MFCreateStandardQualityManager(&object->quality_manager))) + { + goto failed; + } + *session = &object->IMFMediaSession_iface;
return S_OK; diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 64329846cd..4eba79e120 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -1055,6 +1055,14 @@ todo_wine ok(hr == S_OK, "Failed to create media session, hr %#x.\n", hr); IMFMediaSession_Release(session);
+ /* Disabled quality manager. */ + hr = IMFAttributes_SetGUID(attributes, &MF_SESSION_QUALITY_MANAGER, &GUID_NULL); + ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr); + + hr = MFCreateMediaSession(attributes, &session); + ok(hr == S_OK, "Failed to create media session, hr %#x.\n", hr); + IMFMediaSession_Release(session); + IMFAttributes_Release(attributes);
hr = MFShutdown();