aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorVitor Sessak <vitor1001@gmail.com>2011-04-11 16:20:36 -0400
committerRonald S. Bultje <rsbultje@gmail.com>2011-04-12 19:06:26 -0400
commit96573c0d7605672d69b42ae1dcf18764ce47c71a (patch)
tree3d2cf79760e780bf9cd175a16f2bccf72066596a /libavformat
parent578d6861a753eb0b9d277f7ec17d1502eb2bb35a (diff)
downloadffmpeg-96573c0d7605672d69b42ae1dcf18764ce47c71a.tar.gz
lavf/utils.c: Order packets with identical PTS by stream index.
This allows for more reproducible results when using multi-threading. Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/utils.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index f93b83f5da..6b38e66bc5 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3063,7 +3063,10 @@ static int ff_interleave_compare_dts(AVFormatContext *s, AVPacket *next, AVPacke
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;
- return av_rescale_rnd(pkt->dts, b, a, AV_ROUND_DOWN) < next->dts;
+ int64_t dts1 = av_rescale_rnd(pkt->dts, b, a, AV_ROUND_DOWN);
+ if (dts1 == next->dts)
+ return pkt->stream_index < next->stream_index;
+ return dts1 < next->dts;
}
int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush){