aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-05-26 20:09:40 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-05-26 20:42:05 +0200
commitcf86fd0069eef382ff14a1e20b73e1bc2601418d (patch)
tree64d7b933eb2ef81412805eea6c94e0ef424ee8ee
parent8aa9853093400134a35f7b5bfeb0cc7bd14b0279 (diff)
downloadffmpeg-cf86fd0069eef382ff14a1e20b73e1bc2601418d.tar.gz
avformat/matroskaenc: Avoid floats in default duration calculation
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/matroskaenc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index c4c58f4d09..aa9d119128 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -926,10 +926,10 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
put_ebml_uint(pb, MATROSKA_ID_TRACKTYPE, MATROSKA_TRACK_TYPE_VIDEO);
if( st->avg_frame_rate.num > 0 && st->avg_frame_rate.den > 0
- && 1.0/av_q2d(st->avg_frame_rate) > av_q2d(codec->time_base))
- put_ebml_uint(pb, MATROSKA_ID_TRACKDEFAULTDURATION, 1E9 / av_q2d(st->avg_frame_rate));
+ && av_cmp_q(av_inv_q(st->avg_frame_rate), codec->time_base) > 0)
+ put_ebml_uint(pb, MATROSKA_ID_TRACKDEFAULTDURATION, 1000000000LL * st->avg_frame_rate.den / st->avg_frame_rate.num);
else
- put_ebml_uint(pb, MATROSKA_ID_TRACKDEFAULTDURATION, av_q2d(codec->time_base)*1E9);
+ put_ebml_uint(pb, MATROSKA_ID_TRACKDEFAULTDURATION, 1000000000LL * codec->time_base.num / codec->time_base.den);
if (!native_id &&
ff_codec_get_tag(ff_codec_movvideo_tags, codec->codec_id) &&