[vlc-devel] [PATCH v2 10/18] video_output: rework the first frame prepare

Steve Lhomme robux4 at ycbcr.xyz
Wed Sep 16 13:14:36 CEST 2020


The goal of this piece of code is to make sure we use
ThreadDisplayPreparePicture with a displayed.current. It doesn't matter if it's
the first or not. It won't be the first after a flush, for example. We don't
need a temporary variable which is more confusing.

ThreadDisplayPreparePicture with reuse will either use the picture remaining in
the static filter chain, reuse the kept decoded+prepared picture if there is
one, or get a picture from the decoder and prepare it. This picture is then
set in displayed.current, since it was NULL.
---
 src/video_output/video_output.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 28f9201ea40..299ee1e0728 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1488,9 +1488,12 @@ static int ThreadDisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline)
     if (deadline)
         *deadline = INFINITE_DEADLINE;
 
-    if (first)
-        if (ThreadDisplayPreparePicture(vout, true, frame_by_frame, &paused)) /* FIXME not sure it is ok */
-            return VLC_EGENERIC;
+    if (!sys->displayed.current)
+    {
+        ThreadDisplayPreparePicture(vout, true, frame_by_frame, &paused);
+        if (sys->displayed.current == NULL)
+            return VLC_EGENERIC; // wait with no known deadline
+    }
 
     if (!paused || frame_by_frame)
         while (!sys->displayed.next
-- 
2.26.2



More information about the vlc-devel mailing list