X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavfilter%2Fframesync.c;h=b32a5cba6c90b9e3671b99479abe1a1dca085c0a;hb=726dbc57f8162ce82c245a2fdfef2fa074c99dc4;hp=22d3f091a3f4aa8cf9fa320fc211f8adc38c03b3;hpb=ebdc5c419aef0d9eed8c1ec57b30238194c1db0a;p=ffmpeg diff --git a/libavfilter/framesync.c b/libavfilter/framesync.c index 22d3f091a3f..b32a5cba6c9 100644 --- a/libavfilter/framesync.c +++ b/libavfilter/framesync.c @@ -117,7 +117,6 @@ static void framesync_sync_level_update(FFFrameSync *fs) int ff_framesync_configure(FFFrameSync *fs) { unsigned i; - int64_t gcd, lcm; if (!fs->opt_repeatlast || fs->opt_eof_action == EOF_ACTION_PASS) { fs->opt_repeatlast = 0; @@ -127,32 +126,23 @@ int ff_framesync_configure(FFFrameSync *fs) fs->opt_shortest = 1; fs->opt_eof_action = EOF_ACTION_ENDALL; } - if (fs->opt_shortest) { - for (i = 0; i < fs->nb_in; i++) - fs->in[i].after = EXT_STOP; - } if (!fs->opt_repeatlast) { for (i = 1; i < fs->nb_in; i++) { fs->in[i].after = EXT_NULL; fs->in[i].sync = 0; } } + if (fs->opt_shortest) { + for (i = 0; i < fs->nb_in; i++) + fs->in[i].after = EXT_STOP; + } if (!fs->time_base.num) { for (i = 0; i < fs->nb_in; i++) { if (fs->in[i].sync) { 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) { - fs->time_base.den = lcm; - fs->time_base.num = av_gcd(fs->time_base.num, - fs->in[i].time_base.num); - } else { - fs->time_base.num = 1; - fs->time_base.den = AV_TIME_BASE; - break; - } + fs->time_base = av_gcd_q(fs->time_base, fs->in[i].time_base, + AV_TIME_BASE / 2, AV_TIME_BASE_Q); } else { fs->time_base = fs->in[i].time_base; }