[FFmpeg-devel] [EXTREMELY IMPORTANT] [PLEASE DO NOT IGNORE] [PATCH] avfilter/framesync: do not pick AV_TIME_BASE for time base when not needed.

Nicolas George george at nsup.org
Sun Feb 2 12:41:35 EET 2020


Paul B Mahol (12020-02-01):
> Fixes picking time base when all input time bases are same and for example
> 20833/500000.
> 
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
>  libavfilter/framesync.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavfilter/framesync.c b/libavfilter/framesync.c
> index bc95f7d904..94abb469e6 100644
> --- a/libavfilter/framesync.c
> +++ b/libavfilter/framesync.c
> @@ -144,7 +144,7 @@ int ff_framesync_configure(FFFrameSync *fs)
>                  if (fs->time_base.num) {
>                      gcd = av_gcd(fs->time_base.den, fs->in[i].time_base.den);
>                      lcm = (fs->time_base.den / gcd) * fs->in[i].time_base.den;
> -                    if (lcm < AV_TIME_BASE / 2) {
> +                    if (lcm <= AV_TIME_BASE / 2) {
>                          fs->time_base.den = lcm;
>                          fs->time_base.num = av_gcd(fs->time_base.num,
>                                                     fs->in[i].time_base.num);

Picking AV_TIME_BASE for a decimal approximation of 1/24 seems like the
right thing to do. Also, since this change only affects the case with
equality, there is no loss of precision. I'll keep the code as is,
unless there's a better reason.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200202/4c75365f/attachment.sig>


More information about the ffmpeg-devel mailing list