summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/av_common.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/common/av_common.c b/common/av_common.c
index 95c6947eb7..27a331927a 100644
--- a/common/av_common.c
+++ b/common/av_common.c
@@ -17,6 +17,7 @@
#include <assert.h>
#include <math.h>
+#include <limits.h>
#include <libavutil/common.h>
#include <libavutil/log.h>
@@ -104,7 +105,10 @@ AVRational mp_get_codec_timebase(struct mp_codec_params *c)
tb.den *= (r.num + r.den - 1) / r.den;
}
- av_reduce(&tb.num, &tb.den, tb.num, tb.den, 1000000);
+ av_reduce(&tb.num, &tb.den, tb.num, tb.den, INT_MAX);
+
+ if (tb.num < 1 || tb.den < 1)
+ tb = AV_TIME_BASE_Q;
return tb;
}