Nikolay Sivov : evr/presenter: Notify renderer host about mixer latency.

Alexandre Julliard julliard at winehq.org
Tue Nov 10 15:30:24 CST 2020


Module: wine
Branch: master
Commit: 38d75c4294399dc7465c7c5f86c6c578962e1cdb
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=38d75c4294399dc7465c7c5f86c6c578962e1cdb

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Tue Nov 10 13:07:20 2020 +0300

evr/presenter: Notify renderer host about mixer latency.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/evr/presenter.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/dlls/evr/presenter.c b/dlls/evr/presenter.c
index 8be3dd91aa7..5bffa9af228 100644
--- a/dlls/evr/presenter.c
+++ b/dlls/evr/presenter.c
@@ -131,6 +131,13 @@ static struct video_presenter *impl_from_IMFVideoPositionMapper(IMFVideoPosition
     return CONTAINING_RECORD(iface, struct video_presenter, IMFVideoPositionMapper_iface);
 }
 
+static void video_presenter_notify_renderer(struct video_presenter *presenter,
+        LONG event, LONG_PTR param1, LONG_PTR param2)
+{
+    if (presenter->event_sink)
+        IMediaEventSink_Notify(presenter->event_sink, event, param1, param2);
+}
+
 static unsigned int get_gcd(unsigned int a, unsigned int b)
 {
     unsigned int m;
@@ -329,6 +336,9 @@ static HRESULT video_presenter_process_input(struct video_presenter *presenter)
 
     while (hr == S_OK)
     {
+        LONGLONG mixing_started, mixing_finished;
+        MFTIME systime;
+
         if (!(presenter->flags & PRESENTER_MIXER_HAS_INPUT))
             break;
 
@@ -341,6 +351,9 @@ static HRESULT video_presenter_process_input(struct video_presenter *presenter)
         memset(&buffer, 0, sizeof(buffer));
         buffer.pSample = sample;
 
+        if (presenter->clock)
+            IMFClock_GetCorrelatedTime(presenter->clock, 0, &mixing_started, &systime);
+
         if (FAILED(hr = IMFTransform_ProcessOutput(presenter->mixer, 0, 1, &buffer, &status)))
         {
             /* FIXME: failure path probably needs to handle some errors specifically */
@@ -350,6 +363,15 @@ static HRESULT video_presenter_process_input(struct video_presenter *presenter)
         }
         else
         {
+            if (presenter->clock)
+            {
+                LONGLONG latency;
+
+                IMFClock_GetCorrelatedTime(presenter->clock, 0, &mixing_finished, &systime);
+                latency = mixing_finished - mixing_started;
+                video_presenter_notify_renderer(presenter, EC_PROCESSING_LATENCY, (LONG_PTR)&latency, 0);
+            }
+
             if (buffer.pEvents)
                 IMFCollection_Release(buffer.pEvents);
 




More information about the wine-cvs mailing list