[vlc-devel] [PATCH 17/17] video_output: restart display after filter change

Rémi Denis-Courmont remi at remlab.net
Sun Nov 22 10:50:14 CET 2020


Le perjantaina 20. marraskuuta 2020, 16.45.07 EET Steve Lhomme a écrit :
> This is done in the vout thread loop, immediately after the filter output
> change is detected, before processing pictures coming out of the filters.
> The filters are untouched (not flushed).
> 
> The new display module is created with the format coming out of the last
> filter.
> ---
>  src/video_output/video_output.c | 106 ++++++++++++++++++++++++++++----
>  1 file changed, 93 insertions(+), 13 deletions(-)
> 
> diff --git a/src/video_output/video_output.c
> b/src/video_output/video_output.c index 563a7b18122..d83c859adfb 100644
> --- a/src/video_output/video_output.c
> +++ b/src/video_output/video_output.c
> @@ -163,6 +163,7 @@ typedef struct vout_thread_sys_t
>      vout_display_cfg_t display_cfg;
>      vout_display_t *display;
>      vlc_mutex_t     display_lock;
> +    bool            display_restart; // only accessed in vout thread
> 
>      /* Video filter2 chain */
>      struct {
> @@ -942,9 +943,13 @@ typedef struct {
>      config_chain_t *cfg;
>  } vout_filter_t;
> 
> -static void ThreadChangeFilters(vout_thread_sys_t *vout)
> +static bool ThreadChangeFilters(vout_thread_sys_t *vout)
>  {
>      vout_thread_sys_t *sys = vout;
> +
> +    es_format_t prev_es_fmt;
> +    es_format_Copy(&prev_es_fmt,
> filter_chain_GetFmtOut(sys->filter.chain_interactive)); +
>      ThreadFilterFlush(vout, true);
>      ThreadDelAllFilterCallbacks(vout);
> 
> @@ -1034,20 +1039,20 @@ static void ThreadChangeFilters(vout_thread_sys_t
> *vout) vlc_array_clear(array);
>      }
> 
> -    if (!es_format_IsSimilar(p_fmt_current, &fmt_target)) {
> -        msg_Dbg(&vout->obj, "Adding a filter to compensate for format
> changes"); -        if
> (filter_chain_AppendConverter(sys->filter.chain_interactive, -             
>                            &fmt_target) != 0) {
> -            msg_Err(&vout->obj, "Failed to compensate for the format
> changes, removing all filters"); -           
> ThreadDelAllFilterCallbacks(vout);
> -            filter_chain_Reset(sys->filter.chain_static,      &fmt_target,
> vctx_target, &fmt_target); -           
> filter_chain_Reset(sys->filter.chain_interactive, &fmt_target, vctx_target,
> &fmt_target); -        }
> +    sys->filter.changed = false;
> +
> +    if (!es_format_IsSimilar(p_fmt_current, &prev_es_fmt)) {
> +        // we need a new display+converter
> +        msg_Dbg(&vout->obj, "filter output  format change detected");
> +        es_format_Clean(&fmt_target);
> +        es_format_Clean(&prev_es_fmt);
> +        return true;
>      }

That's wrong and it's what would be causing the alleged "glitch" problems. The 
display should only be restarted as a last resort. I guess one scenario is if 
you cannot build a conversion chain with the current display format, though 
I'm not sure how realistic that is.

-1

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





More information about the vlc-devel mailing list