[vlc-commits] [Git][videolan/vlc][master] 22 commits: video_output: copy the redisplay handling in the if/else branch

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat Jun 4 10:05:43 UTC 2022



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
ac85c5a6 by Steve Lhomme at 2022-06-04T09:48:35+00:00
video_output: copy the redisplay handling in the if/else branch

This will allow some simplifications

- - - - -
027d270a by Steve Lhomme at 2022-06-04T09:48:35+00:00
video_output: simplify the return value when redisplaying the first pic

date_refresh was always VLC_TICK_MAX

- - - - -
b62e602a by Steve Lhomme at 2022-06-04T09:48:35+00:00
video_output: remove tautoligical tests

We can only reach this code with next = NULL, therefore first can only be false
and refresh has its default value "false". So this test is always true.

- - - - -
a845733d by Steve Lhomme at 2022-06-04T09:48:35+00:00
video_output: copy the redisplay return value in displayed.date code

The code is logically equivalent. It will allow some simplifications later.

- - - - -
fd445172 by Steve Lhomme at 2022-06-04T09:48:35+00:00
video_output: remove tautological tests

- We can't get in this code with next != NULL.
- We can't get in this code with first, because next is NULL, we exited earlier

- - - - -
c6b27949 by Steve Lhomme at 2022-06-04T09:48:35+00:00
video_output: set render_now on late redisplay explictly

We return with VOUT_REDISPLAY_DELAY before that.

- - - - -
526431db by Steve Lhomme at 2022-06-04T09:48:35+00:00
video_output: don't set render_now at all on late redisplay

It's already true by default.

- - - - -
76aa1d6e by Steve Lhomme at 2022-06-04T09:48:35+00:00
video_output: only use the forced flag when render_now was not true

It's most likely wrong to display a forced picture right away. But for now the
code is equivalent.

- - - - -
542da574 by Steve Lhomme at 2022-06-04T09:48:35+00:00
video_output: copy the redisplay return value in next != NULL code

To be removed next.

- - - - -
639fde42 by Steve Lhomme at 2022-06-04T09:48:35+00:00
video_output: remove global return redisplay test

It's in each section before.

- - - - -
227558c9 by Steve Lhomme at 2022-06-04T09:48:35+00:00
video_output: remove tautological always false test

next cannot be NULL here.

- - - - -
03382abf by Steve Lhomme at 2022-06-04T09:48:35+00:00
video_output: copy the RenderPicture code in displayed.date code

And always return as render_now is always true here.

- - - - -
bb19aa3e by Steve Lhomme at 2022-06-04T09:48:35+00:00
video_output: move remaining RenderPicture in the only code that get there

All other code pathes return before reaching this code.

- - - - -
bd354bcc by Steve Lhomme at 2022-06-04T09:48:35+00:00
video_output: make render_now local

- - - - -
2b3ce53a by Steve Lhomme at 2022-06-04T09:48:35+00:00
video_output: move return VLC_TICK_INVALID in the only place it's used

- - - - -
adaebe78 by Steve Lhomme at 2022-06-04T09:48:35+00:00
video_output: remove unused date_refresh in next picture handling

- - - - -
8876fd66 by Steve Lhomme at 2022-06-04T09:48:35+00:00
video_output: make date_refresh local in the only block it's used

- - - - -
7e5cac38 by Steve Lhomme at 2022-06-04T09:48:35+00:00
video_output: make refresh local in the only block it's used

And keep the comment for now.

- - - - -
ee23dd8c by Steve Lhomme at 2022-06-04T09:48:35+00:00
video_output: remove local refresh variable

We can do the actual test directly

- - - - -
2a1ad8d5 by Steve Lhomme at 2022-06-04T09:48:35+00:00
video_output: inverse the return logic in the next picture code

- - - - -
257f90ed by Steve Lhomme at 2022-06-04T09:48:35+00:00
video_output: fallback to a common return value

They all return vlc_tick_now() + VOUT_REDISPLAY_DELAY eventually.

- - - - -
744efb1b by Steve Lhomme at 2022-06-04T09:48:35+00:00
video_output: remove special case to return on first picture

We can safely go down the code, it will return the same value as we did:
- next is NULL
- sys->displayed.date is VLC_TICK_INVALID since it's the first picture

- - - - -


1 changed file:

- src/video_output/video_output.c


Changes:

=====================================
src/video_output/video_output.c
=====================================
@@ -1371,28 +1371,14 @@ static vlc_tick_t DisplayPicture(vout_thread_sys_t *vout)
 
     UpdateDeinterlaceFilter(sys);
 
-    bool render_now = true;
     const vlc_tick_t system_now = vlc_tick_now();
     const vlc_tick_t render_delay = vout_chrono_GetHigh(&sys->chrono.render) + VOUT_MWAIT_TOLERANCE;
     const bool first = !sys->displayed.current;
 
-    /* FIXME/XXX we must redisplay the last decoded picture (because
-    * of potential vout updated, or filters update or SPU update)
-    * For now a high update period is needed but it could be removed
-    * if and only if:
-    * - vout module emits events from themselves.
-    * - *and* SPU is modified to emit an event or a deadline when needed.
-    *
-    * So it will be done later.
-    */
-    bool refresh = false;
-
     picture_t *next = NULL;
     if (first)
     {
         next = PreparePicture(vout, true, false);
-        if (!next)
-            return vlc_tick_now() + VOUT_REDISPLAY_DELAY; /* Unknown deadline */
     }
     else if (!paused)
     {
@@ -1410,46 +1396,45 @@ static vlc_tick_t DisplayPicture(vout_thread_sys_t *vout)
         }
     }
 
-    vlc_tick_t date_refresh = VLC_TICK_MAX;
-
     if (next != NULL)
     {
-        const vlc_tick_t swap_next_pts =
-            vlc_clock_ConvertToSystem(sys->clock, vlc_tick_now(),
-                                        next->date, sys->rate);
-        if (likely(swap_next_pts != VLC_TICK_MAX))
-            date_refresh = swap_next_pts - render_delay;
-
-        // next frame will still need some waiting before display
-        render_now = false;
-
         if (likely(sys->displayed.current != NULL))
             picture_Release(sys->displayed.current);
         sys->displayed.current = next;
+
+        // next frame will still need some waiting before display, we don't need
+        // to render now
+        // display forced picture immediately
+        bool render_now = sys->displayed.current->b_force;
+
+        RenderPicture(vout, render_now);
+        if (!render_now)
+            /* Prepare the next picture immediately without waiting */
+            return VLC_TICK_INVALID;
     }
     else if (likely(sys->displayed.date != VLC_TICK_INVALID))
     {
         // next date we need to display again the current picture
-        date_refresh = sys->displayed.date + VOUT_REDISPLAY_DELAY - render_delay;
-        refresh = date_refresh <= system_now;
-        render_now = refresh;
-    }
-
-    if (!first && !refresh && next == NULL) {
-        // nothing changed, wait until the next deadline or a control
-        vlc_tick_t max_deadline = vlc_tick_now() + VOUT_REDISPLAY_DELAY;
-        return __MIN(date_refresh, max_deadline);
+        vlc_tick_t date_refresh = sys->displayed.date + VOUT_REDISPLAY_DELAY - render_delay;
+        /* FIXME/XXX we must redisplay the last decoded picture (because
+        * of potential vout updated, or filters update or SPU update)
+        * For now a high update period is needed but it could be removed
+        * if and only if:
+        * - vout module emits events from themselves.
+        * - *and* SPU is modified to emit an event or a deadline when needed.
+        *
+        * So it will be done later.
+        */
+        if (date_refresh > system_now) {
+            // nothing changed, wait until the next deadline or a control
+            vlc_tick_t max_deadline = vlc_tick_now() + VOUT_REDISPLAY_DELAY;
+            return __MIN(date_refresh, max_deadline);
+        }
+        RenderPicture(vout, true);
     }
 
-    /* display the picture immediately */
-    render_now |= sys->displayed.current->b_force;
-
-    RenderPicture(vout, render_now);
-    if (render_now)
-        return vlc_tick_now() + VOUT_REDISPLAY_DELAY;
-
-    /* Prepare the next picture immediately without waiting */
-    return VLC_TICK_INVALID;
+    // wait until the next deadline or a control
+    return vlc_tick_now() + VOUT_REDISPLAY_DELAY;
 }
 
 void vout_ChangePause(vout_thread_t *vout, bool is_paused, vlc_tick_t date)



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/c55033cf75e9145bb58b81a2c3ef6bd55aa98c1b...744efb1b51497d8a760bf9f05d9ffd8d4c6c5e60

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/c55033cf75e9145bb58b81a2c3ef6bd55aa98c1b...744efb1b51497d8a760bf9f05d9ffd8d4c6c5e60
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list