[vlc-devel] [PATCH 3/3] transcode: video: fix insertion of fps filter

Thomas Guillem thomas at gllm.fr
Tue Jan 26 14:06:50 UTC 2021



On Tue, Jan 26, 2021, at 15:01, Alexandre Janniaux wrote:
> The fps filter must be added iif. the target framerate is different from

Typo in the commit log.

I'm OK with the set, but I would wait for Steve or Francois review.

> the source framerate, not when we define the fps parameter.
> 
> We also check that fps.den > 0 to avoid divide-by-zero errors.
> 
> Probably regression from 030183d79045a1747d891572b2fe77d8cd0fd946 in
> which the target framerate was defined in the destination format.
> .
> ---
>  modules/stream_out/transcode/video.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/modules/stream_out/transcode/video.c 
> b/modules/stream_out/transcode/video.c
> index b36ed90bbf..ce657088ad 100644
> --- a/modules/stream_out/transcode/video.c
> +++ b/modules/stream_out/transcode/video.c
> @@ -297,11 +297,19 @@ static int transcode_video_filters_init( 
> sout_stream_t *p_stream,
>          src_ctx = filter_chain_GetVideoCtxOut( id->p_f_chain );
>      }
>  
> -    if( id->p_enccfg->video.fps.num > 0 )
> +    if( id->p_enccfg->video.fps.num > 0 &&
> +        id->p_enccfg->video.fps.den > 0 &&
> +      ( id->p_enccfg->video.fps.num != p_src->video.i_frame_rate ||
> +        id->p_enccfg->video.fps.den != p_src->video.i_frame_rate_base ) )
>      {
> -        filter_chain_AppendFilter( id->p_f_chain, "fps", NULL, p_src );
> +        es_format_t dst;
> +        es_format_Copy(&dst, p_src);
> +        dst.video.i_frame_rate = id->p_enccfg->video.fps.num;
> +        dst.video.i_frame_rate_base = id->p_enccfg->video.fps.den;
> +        filter_chain_AppendFilter( id->p_f_chain, "fps", NULL, &dst );
>          p_src = filter_chain_GetFmtOut( id->p_f_chain );
>          src_ctx = filter_chain_GetVideoCtxOut( id->p_f_chain );
> +        es_format_Clean(&dst);
>      }
>  
>      /* User filters */
> -- 
> 2.30.0
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list