summaryrefslogtreecommitdiff
path: root/libavformat/utils.c
diff options
context:
space:
mode:
authorWolfram Gloger <wmglo@dent.med.uni-muenchen.de>2007-03-21 10:48:10 +0000
committerDiego Biurrun <diego@biurrun.de>2007-03-21 10:48:10 +0000
commitdf7625ed62897debf950e842116dc800afd8b5d7 (patch)
tree73389dff21ad207fcbe6aba255fd5149218f96dd /libavformat/utils.c
parente14f79ed375dd243f81f05655be7511a29f91e40 (diff)
av_estimate_timings_from_pts() flushes the packet queue but doesn't
reset the streams' cur_dts values. This can lead to a fatal "error, non monotone timestamps ..." message later, because the out-of-date cur_dts values are used to compute some packet's dts. Fix this by calling av_read_frame_flush() and eliminate code duplication in the process. The additional hunk gives more detailed error messages. patch by Wolfram Gloger, wmglo dent.med.uni-muenchen de Originally committed as revision 8465 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r--libavformat/utils.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 417e81c5d7..8330a429f1 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1460,21 +1460,7 @@ static void av_estimate_timings_from_pts(AVFormatContext *ic, offset_t old_offse
int64_t end_time;
int64_t filesize, offset, duration;
- /* 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;
- }
- }
+ av_read_frame_flush(ic);
/* we read the first packets to get the first PTS (not fully
accurate, but it is enough now) */
@@ -2129,11 +2115,12 @@ 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"\n", 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);
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\n");
+ av_log(NULL, AV_LOG_ERROR, "error, pts < dts (%"PRId64" < %"PRId64")\n",
+ pkt->pts, pkt->dts);
return -1;
}