diff options
author | Vitor Sessak <vitor1001@gmail.com> | 2011-04-11 16:20:36 -0400 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2011-04-12 19:06:26 -0400 |
commit | 96573c0d7605672d69b42ae1dcf18764ce47c71a (patch) | |
tree | 3d2cf79760e780bf9cd175a16f2bccf72066596a /libavformat/utils.c | |
parent | 578d6861a753eb0b9d277f7ec17d1502eb2bb35a (diff) | |
download | ffmpeg-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/utils.c')
-rw-r--r-- | libavformat/utils.c | 5 |
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){ |