diff options
author | Luca Abeni <lucabe72@email.it> | 2007-04-26 10:49:48 +0000 |
---|---|---|
committer | Luca Abeni <lucabe72@email.it> | 2007-04-26 10:49:48 +0000 |
commit | 578688fad5391a1bda79c99fde998a20ca7f0070 (patch) | |
tree | 1ed11ba0ea43df993ad92eef738f4081ab98fa45 /libavformat/utils.c | |
parent | bca098f54da44d24be35c15777872cc628cab00b (diff) | |
download | ffmpeg-578688fad5391a1bda79c99fde998a20ca7f0070.tar.gz |
Fix reading PTSs and DTSs in libavformat, by reverting r8465.
Such commit introduced some regressions (see the "Possible bug in reading
PTS/DTS" and "[BUG] no video transcoding" threads on ffmpeg-devel).
Originally committed as revision 8826 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r-- | libavformat/utils.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 8c1594d65f..ad1e50e3e9 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1483,7 +1483,21 @@ static void av_estimate_timings_from_pts(AVFormatContext *ic, offset_t old_offse int64_t end_time; int64_t filesize, offset, duration; - av_read_frame_flush(ic); + /* free previous packet */ + if (ic->cur_st && ic->cur_st->parser) + av_free_packet(&ic->cur_pkt); + ic->cur_st = NULL; + + /* flush packet queue */ + flush_packet_queue(ic); + + for(i=0;i<ic->nb_streams;i++) { + st = ic->streams[i]; + if (st->parser) { + av_parser_close(st->parser); + st->parser= NULL; + } + } /* we read the first packets to get the first PTS (not fully accurate, but it is enough now) */ @@ -2184,12 +2198,11 @@ static int compute_pkt_fields2(AVStream *st, AVPacket *pkt){ } if(st->cur_dts && st->cur_dts != AV_NOPTS_VALUE && st->cur_dts >= pkt->dts){ - av_log(NULL, AV_LOG_ERROR, "error, non monotone timestamps %"PRId64" >= %"PRId64" st:%d\n", st->cur_dts, pkt->dts, st->index); + av_log(NULL, AV_LOG_ERROR, "error, non monotone timestamps %"PRId64" >= %"PRId64"\n", st->cur_dts, pkt->dts); return -1; } if(pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->pts < pkt->dts){ - av_log(NULL, AV_LOG_ERROR, "error, pts < dts (%"PRId64" < %"PRId64")\n", - pkt->pts, pkt->dts); + av_log(NULL, AV_LOG_ERROR, "error, pts < dts\n"); return -1; } |