diff options
author | Vitor Sessak <vitor1001@gmail.com> | 2011-05-07 22:48:29 +0200 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2011-05-10 07:53:19 -0400 |
commit | ecc297308ff3cb8b20359df44108ac299b22bdf1 (patch) | |
tree | aaeb1adc69c026a6e8c12314727ce8f69f268b48 /libavformat | |
parent | 23d10ce0150b4fed54131fce4c1a6e47378a88dd (diff) | |
download | ffmpeg-ecc297308ff3cb8b20359df44108ac299b22bdf1.tar.gz |
lavf/utils: fix ff_interleave_compare_dts corner case.
This should fix behavior introduced by commit
96573c0d7605672d69b42ae1dcf18764ce47c71a. Av_rescale_rnd() is not
lossless so if two timestamps are equal after being rescaled they are
not always actually identical. This patch use av_compare_ts() to get
always a correct result.
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/utils.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 425b4b3e68..7959102e0a 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2972,12 +2972,12 @@ static int ff_interleave_compare_dts(AVFormatContext *s, AVPacket *next, AVPacke { AVStream *st = s->streams[ pkt ->stream_index]; AVStream *st2= s->streams[ next->stream_index]; - int64_t a= st2->time_base.num * (int64_t)st ->time_base.den; - int64_t b= st ->time_base.num * (int64_t)st2->time_base.den; - int64_t dts1 = av_rescale_rnd(pkt->dts, b, a, AV_ROUND_DOWN); - if (dts1 == next->dts) + int comp = av_compare_ts(next->dts, st2->time_base, pkt->dts, + st->time_base); + + if (comp == 0) return pkt->stream_index < next->stream_index; - return dts1 < next->dts; + return comp > 0; } int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush){ |