]> git.sesse.net Git - vlc/commitdiff
vdpau/chroma: skip forward to current picture if forced (fixes #11410)
authorRémi Denis-Courmont <remi@remlab.net>
Mon, 15 Sep 2014 16:16:18 +0000 (19:16 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Mon, 15 Sep 2014 16:38:57 +0000 (19:38 +0300)
VDPAU introduces a delay of one field (one picture if not deinterlacing).
This is normally not an issue as the PTS is preserved. But it does not
work if there is only one picture not followed by another one.

modules/hw/vdpau/chroma.c

index ed573184c793955e33805a2af543a40120007d47..a4df8e639590cc5dd1f59fa70b3dbaf91cb3ea31 100644 (file)
@@ -462,11 +462,32 @@ static picture_t *VideoRender(filter_t *filter, picture_t *src)
         picture_Release(src);
     }
     else
+    {
         sys->history[MAX_PAST + MAX_FUTURE].field = NULL;
+        sys->history[MAX_PAST + MAX_FUTURE].force = false;
+    }
 
     vlc_vdp_video_field_t *f = sys->history[MAX_PAST].field;
     if (f == NULL)
-        goto skip;
+    {   /* There is no present field, probably just starting playback. */
+        if (!sys->history[MAX_PAST + MAX_FUTURE].force)
+            goto skip;
+
+        /* If the picture is forced, ignore deinterlacing and fast forward. */
+        /* FIXME: Remove the forced hack pictures in video output core and
+         * allow the last field of a video to be rendered properly. */
+        while (sys->history[MAX_PAST].field == NULL)
+        {
+            f = sys->history[0].field;
+            if (f != NULL)
+                f->destroy(f);
+
+            memmove(sys->history, sys->history + 1,
+                    sizeof (sys->history[0]) * (MAX_PAST + MAX_FUTURE));
+            sys->history[MAX_PAST + MAX_FUTURE].field = NULL;
+        }
+        f = sys->history[MAX_PAST].field;
+    }
 
     /* Get a VLC picture for a VDPAU output surface */
     dst = filter_NewPicture(filter);