[vlc-devel] [PATCH] video_output: wait half the extra time we have without getting the display_lock

Rémi Denis-Courmont remi at remlab.net
Fri Feb 19 15:06:18 UTC 2021


Le perjantaina 19. helmikuuta 2021, 13.16.44 EET Steve Lhomme a écrit :
> Since f1bf7ce5b4480a3d38d54c7ae1d1564f0670d83f we start the rendering much
> earlier than before, so we have more time to do things if necessary.
> 
> The problem is that for almost all the duration of the call display_lock is
> held. So it's blocking all other UI related events from being handled. Even
> if we are going to spend most of the time waiting until we can do the
> display.
> 
> This patch waits a bit before locking the display_lock when we estimate we
> will have so extra time before doing the display/swap.
> 
> Fixes #25479
> ---
>  src/video_output/video_output.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/src/video_output/video_output.c
> b/src/video_output/video_output.c index d04d3f4d111..c176c274334 100644
> --- a/src/video_output/video_output.c
> +++ b/src/video_output/video_output.c
> @@ -1119,6 +1119,23 @@ static int
> ThreadDisplayRenderPicture(vout_thread_sys_t *vout, bool render_now) if
> (filtered->date != sys->displayed.current->date)
>          msg_Warn(&vout->obj, "Unsupported timestamp modifications done by
> chain_interactive");
> 
> +    if (!render_now)

You really should put a comment in the code that this is a hopefully temporary 
work-around (as well as in the commit log like Thomas already asked).

> +    {
> +        vlc_tick_t now = vlc_tick_now();
> +        vlc_tick_t system_pts = vlc_clock_ConvertToSystem(sys->clock, now,
> filtered->date, sys->rate); +        if (unlikely(system_pts != INT64_MAX))
> +        {
> +            const vlc_tick_t late = now - system_pts;
> +            if (unlikely(late <= 0))
> +            {
> +                // wait half the extra time we have without the
> display_lock +                vlc_tick_t max_time_to_render =
> sys->render.avg;
> +                vlc_clock_Wait(sys->clock, now , filtered->date -
> max_time_to_render / 2, sys->rate, +                           
> VOUT_REDISPLAY_DELAY);
> +            }
> +        }
> +    }
> +
>      vout_display_t *vd = sys->display;
> 
>      vlc_mutex_lock(&sys->display_lock);


-- 
Реми Дёни-Курмон
http://www.remlab.net/





More information about the vlc-devel mailing list