Nikolay Sivov : mf/session: Provide quality manager with presentation clock.
Alexandre Julliard
julliard at winehq.org
Wed Nov 11 15:31:43 CST 2020
Module: wine
Branch: master
Commit: 61ab5b24757b447fcd2eb92ca326d7e4a85f82b0
URL: https://source.winehq.org/git/wine.git/?a=commit;h=61ab5b24757b447fcd2eb92ca326d7e4a85f82b0
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Wed Nov 11 16:36:48 2020 +0300
mf/session: Provide quality manager with presentation clock.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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);
}
More information about the wine-cvs
mailing list