[vlc-devel] [PATCH 03/21] video_output: set the deadline directly when the next frame date is known

Rémi Denis-Courmont remi at remlab.net
Tue Sep 15 18:01:24 CEST 2020


Le tiistaina 15. syyskuuta 2020, 15.36.08 EEST Steve Lhomme a écrit :
> We already know the deadline from the previous frame timeout, the deadline
> for the next frame takes precedence if there is one.
> 
> date_next can never be invalid now.
> 
> We replace the test on frame_by_frame by a test on deadline not being NULL,
> as it makes more sense when setting its value.
> ---
>  src/video_output/video_output.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/src/video_output/video_output.c
> b/src/video_output/video_output.c index 906734b2cb1..32890966dd0 100644
> --- a/src/video_output/video_output.c
> +++ b/src/video_output/video_output.c
> @@ -1501,7 +1501,6 @@ static int ThreadDisplayPicture(vout_thread_sys_t
> *vout, vlc_tick_t *deadline) const vlc_tick_t render_delay =
> vout_chrono_GetHigh(&sys->render) + VOUT_MWAIT_TOLERANCE;
> 
>      bool drop_next_frame = frame_by_frame;
> -    vlc_tick_t date_next = VLC_TICK_INVALID;
> 
>      /* FIXME/XXX we must redisplay the last decoded picture (because
>       * of potential vout updated, or filters update or SPU update)
> @@ -1531,20 +1530,21 @@ static int ThreadDisplayPicture(vout_thread_sys_t
> *vout, vlc_tick_t *deadline) * the current one). */
>              paused = true;
>          }
> +        else
>          {
> -            date_next = next_system_pts - render_delay;
> +            const vlc_tick_t date_next = next_system_pts - render_delay;
>              if (date_next <= system_now)
>                  drop_next_frame = true;
> +
> +            if (deadline) {

Key strokes are cheap. You can compare with NULL, especially when it's not 
exactly obvious from the identifier that it's a pointer rather than a scalar 
value.

> +                if (*deadline == VLC_TICK_INVALID || date_next < *deadline)
> +                    *deadline = date_next;
> +            }
>          }
>      }
> 
>      bool force_refresh = !drop_next_frame && refresh;
> 
> -    if (!frame_by_frame) {
> -        if (date_next != VLC_TICK_INVALID && date_next < *deadline)
> -            *deadline = date_next;
> -    }
> -
>      if (!first && !refresh && !drop_next_frame) {
>          return VLC_EGENERIC;
>      }


-- 
Rémi Denis-Courmont
http://www.remlab.net/





More information about the vlc-devel mailing list