Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/session.c | 29 +++++++++++++++++++++++++++-- dlls/mf/tests/mf.c | 3 +++ 2 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/dlls/mf/session.c b/dlls/mf/session.c index a1b54b7080e..0fa6b49498d 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -303,6 +303,9 @@ struct quality_manager { IMFQualityManager IMFQualityManager_iface; LONG refcount; + + IMFPresentationClock *clock; + CRITICAL_SECTION cs; };
static inline struct media_session *impl_from_IMFMediaSession(IMFMediaSession *iface) @@ -3393,6 +3396,12 @@ HRESULT WINAPI MFCreateMediaSession(IMFAttributes *config, IMFMediaSession **ses goto failed; }
+ if (object->quality_manager && FAILED(hr = IMFQualityManager_NotifyPresentationClock(object->quality_manager, + object->clock))) + { + goto failed; + } + *session = &object->IMFMediaSession_iface;
return S_OK; @@ -4459,6 +4468,9 @@ static ULONG WINAPI standard_quality_manager_Release(IMFQualityManager *iface)
if (!refcount) { + if (manager->clock) + IMFPresentationClock_Release(manager->clock); + DeleteCriticalSection(&manager->cs); heap_free(manager); }
@@ -4475,9 +4487,21 @@ static HRESULT WINAPI standard_quality_manager_NotifyTopology(IMFQualityManager static HRESULT WINAPI standard_quality_manager_NotifyPresentationClock(IMFQualityManager *iface, IMFPresentationClock *clock) { - FIXME("%p, %p stub.\n", iface, clock); + struct quality_manager *manager = impl_from_IMFQualityManager(iface);
- return E_NOTIMPL; + TRACE("%p, %p.\n", iface, clock); + + if (!clock) + return E_POINTER; + + EnterCriticalSection(&manager->cs); + if (manager->clock) + IMFPresentationClock_Release(manager->clock); + manager->clock = clock; + IMFPresentationClock_AddRef(manager->clock); + LeaveCriticalSection(&manager->cs); + + return S_OK; }
static HRESULT WINAPI standard_quality_manager_NotifyProcessInput(IMFQualityManager *iface, IMFTopologyNode *node, @@ -4536,6 +4560,7 @@ HRESULT WINAPI MFCreateStandardQualityManager(IMFQualityManager **manager)
object->IMFQualityManager_iface.lpVtbl = &standard_quality_manager_vtbl; object->refcount = 1; + InitializeCriticalSection(&object->cs);
*manager = &object->IMFQualityManager_iface;
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index c38c817eb4b..7780bf4ea58 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -2815,6 +2815,9 @@ static void test_quality_manager(void) hr = MFCreateStandardQualityManager(&manager); ok(hr == S_OK, "Failed to create quality manager, hr %#x.\n", hr);
+ hr = IMFQualityManager_NotifyPresentationClock(manager, NULL); + ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr); + IMFQualityManager_Release(manager); }