mf: Create quality manager on session creation.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2019-09-24 12:02:00 +03:00 committed by Alexandre Julliard
parent 76a347a53e
commit c64f919b09
2 changed files with 30 additions and 0 deletions

View File

@ -70,6 +70,7 @@ struct media_session
IMFPresentationClock *clock; IMFPresentationClock *clock;
IMFRateControl *clock_rate_control; IMFRateControl *clock_rate_control;
IMFTopoLoader *topo_loader; IMFTopoLoader *topo_loader;
IMFQualityManager *quality_manager;
struct list topologies; struct list topologies;
enum session_state state; enum session_state state;
CRITICAL_SECTION cs; CRITICAL_SECTION cs;
@ -332,6 +333,8 @@ static ULONG WINAPI mfsession_Release(IMFMediaSession *iface)
IMFRateControl_Release(session->clock_rate_control); IMFRateControl_Release(session->clock_rate_control);
if (session->topo_loader) if (session->topo_loader)
IMFTopoLoader_Release(session->topo_loader); IMFTopoLoader_Release(session->topo_loader);
if (session->quality_manager)
IMFQualityManager_Release(session->quality_manager);
DeleteCriticalSection(&session->cs); DeleteCriticalSection(&session->cs);
heap_free(session); heap_free(session);
} }
@ -761,6 +764,7 @@ static const IMFRateControlVtbl session_rate_control_vtbl =
*/ */
HRESULT WINAPI MFCreateMediaSession(IMFAttributes *config, IMFMediaSession **session) HRESULT WINAPI MFCreateMediaSession(IMFAttributes *config, IMFMediaSession **session)
{ {
BOOL without_quality_manager = FALSE;
struct media_session *object; struct media_session *object;
HRESULT hr; HRESULT hr;
@ -806,11 +810,29 @@ HRESULT WINAPI MFCreateMediaSession(IMFAttributes *config, IMFMediaSession **ses
WARN("Failed to create custom topology loader, hr %#x.\n", hr); 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))) if (!object->topo_loader && FAILED(hr = MFCreateTopoLoader(&object->topo_loader)))
goto failed; goto failed;
if (!object->quality_manager && !without_quality_manager &&
FAILED(hr = MFCreateStandardQualityManager(&object->quality_manager)))
{
goto failed;
}
*session = &object->IMFMediaSession_iface; *session = &object->IMFMediaSession_iface;
return S_OK; return S_OK;

View File

@ -1055,6 +1055,14 @@ todo_wine
ok(hr == S_OK, "Failed to create media session, hr %#x.\n", hr); ok(hr == S_OK, "Failed to create media session, hr %#x.\n", hr);
IMFMediaSession_Release(session); 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); IMFAttributes_Release(attributes);
hr = MFShutdown(); hr = MFShutdown();