From 4ddcc983b40ce9904cc7136f3cb7af75299e1234 Mon Sep 17 00:00:00 2001 From: Oded Shimon Date: Mon, 4 Feb 2008 10:48:41 +0000 Subject: [PATCH] back_ptr calculation used wrong timebase when searching for back syncpoint Originally committed as revision 11856 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/nutenc.c | 6 +++++- tests/libav.regression.ref | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c index 51c7633ae7..9a17c7759f 100644 --- a/libavformat/nutenc.c +++ b/libavformat/nutenc.c @@ -476,7 +476,11 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){ ff_nut_reset_ts(nut, *nus->time_base, pkt->dts); for(i=0; inb_streams; i++){ AVStream *st= s->streams[i]; - int index= av_index_search_timestamp(st, pkt->dts, AVSEEK_FLAG_BACKWARD); + int64_t dts_tb = av_rescale_rnd(pkt->dts, + nus->time_base->num * (int64_t)nut->stream[i].time_base->den, + nus->time_base->den * (int64_t)nut->stream[i].time_base->num, + AV_ROUND_DOWN); + int index= av_index_search_timestamp(st, dts_tb, AVSEEK_FLAG_BACKWARD); if(index>=0) dummy.pos= FFMIN(dummy.pos, st->index_entries[index].pos); } if(dummy.pos == INT64_MAX) diff --git a/tests/libav.regression.ref b/tests/libav.regression.ref index fba7ed4daa..5283badfd9 100644 --- a/tests/libav.regression.ref +++ b/tests/libav.regression.ref @@ -30,7 +30,7 @@ f8ad5bd78f4d012a8ce9570aa395ac54 *./tests/data/b-libav.flv 2ba41cf880aa5cb87e8a08fdb735398d *./tests/data/b-libav.gxf 814640 ./tests/data/b-libav.gxf ./tests/data/b-libav.gxf CRC=0xa376c09e -5489961f19ae94683d134d8108d646c8 *./tests/data/b-libav.nut +868101eb2d9f8fe128f84399d450633e *./tests/data/b-libav.nut 329785 ./tests/data/b-libav.nut ./tests/data/b-libav.nut CRC=0x400c29e9 43238b15f1012aa27536c2be20bb2383 *./tests/data/b-libav.mkv