summaryrefslogtreecommitdiff
path: root/libavfilter/framesync.c
diff options
context:
space:
mode:
authorNicolas George <george@nsup.org>2020-04-16 21:36:35 +0200
committerNicolas George <george@nsup.org>2020-05-23 15:51:45 +0200
commit2a52f19a91de33f382e00a3efa9431ec3277af42 (patch)
tree1c95b687a80104068f77da678c6eedb016cb4e0e /libavfilter/framesync.c
parent6b65c4ec54511871f345cfa76a499fa65d94c0b8 (diff)
downloadffmpeg-2a52f19a91de33f382e00a3efa9431ec3277af42.tar.gz
lavfi/framesync: use av_gcd_q().
Diffstat (limited to 'libavfilter/framesync.c')
-rw-r--r--libavfilter/framesync.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/libavfilter/framesync.c b/libavfilter/framesync.c
index bc95f7d904..b32a5cba6c 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;
@@ -142,17 +141,8 @@ int ff_framesync_configure(FFFrameSync *fs)
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;
}