[vlc-commits] video_output: rework the frame by frame mode picture picking

Steve Lhomme git at videolan.org
Fri Jan 29 14:54:26 UTC 2021


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Jan 21 10:32:40 2021 +0100| [8094e821e8feb5d16372b9fcae8d8d7dceecf4e5] | committer: Steve Lhomme

video_output: rework the frame by frame mode picture picking

We only update the displayed.current if there is a next picture to use.
If there was a remaining displayed.next picture we use that as the next picture.

We no longer lose the displayed.current if there is no next picture yet.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8094e821e8feb5d16372b9fcae8d8d7dceecf4e5
---

 src/video_output/video_output.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index a2d2519450..c0bcb89ba8 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1484,25 +1484,25 @@ static int ThreadDisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline)
     bool render_now;
     if (frame_by_frame)
     {
-        if (!sys->displayed.current)
+        picture_t *next;
+        if (likely(!sys->displayed.next))
         {
-            assert(!sys->displayed.next);
-            sys->displayed.current =
-                ThreadDisplayPreparePicture(vout, true, true, &paused);
-            if (!sys->displayed.current)
-                return VLC_EGENERIC; // wait with no known deadline
+            next =
+                ThreadDisplayPreparePicture(vout, !sys->displayed.current, true, &paused);
         }
-
-        if (!sys->displayed.next)
+        else
         {
-            sys->displayed.next =
-                ThreadDisplayPreparePicture(vout, false, true, &paused);
+            // remaining from normal playback
+            next = sys->displayed.next;
+            sys->displayed.next = NULL;
         }
 
-        if (likely(sys->displayed.current != NULL))
-            picture_Release(sys->displayed.current);
-        sys->displayed.current = sys->displayed.next;
-        sys->displayed.next    = NULL;
+        if (next)
+        {
+            if (likely(sys->displayed.current != NULL))
+                picture_Release(sys->displayed.current);
+            sys->displayed.current = next;
+        }
 
         if (!sys->displayed.current)
             return VLC_EGENERIC;



More information about the vlc-commits mailing list