Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitor Sessak <vitor1001@gmail.com>2011-05-08 00:48:29 +0400
committerRonald S. Bultje <rsbultje@gmail.com>2011-05-10 15:53:19 +0400
commitecc297308ff3cb8b20359df44108ac299b22bdf1 (patch)
treeaaeb1adc69c026a6e8c12314727ce8f69f268b48 /libavformat/utils.c
parent23d10ce0150b4fed54131fce4c1a6e47378a88dd (diff)
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/utils.c')
-rw-r--r--libavformat/utils.c10
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){