# HG changeset patch # User michael # Date 1215526057 0 # Node ID 8bce09af18e62576fb457f7940d3262d037072f1 # Parent a4fb7b8098c35c818f50eee6b216fd42c3af637a Set cur_dts to 0 only during creating new streams and not every time cur_dts happens to be AV_NOPTS_VALUE. diff -r a4fb7b8098c3 -r 8bce09af18e6 utils.c --- a/utils.c Tue Jul 08 13:24:13 2008 +0000 +++ b/utils.c Tue Jul 08 14:07:37 2008 +0000 @@ -730,10 +730,6 @@ if(pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->pts > pkt->dts) presentation_delayed = 1; - if(st->cur_dts == AV_NOPTS_VALUE){ - st->cur_dts = 0; //FIXME maybe set it to 0 during init - } - // av_log(NULL, AV_LOG_DEBUG, "IN delayed:%d pts:%"PRId64", dts:%"PRId64" cur_dts:%"PRId64" st:%d pc:%p\n", presentation_delayed, pkt->pts, pkt->dts, st->cur_dts, pkt->stream_index, pc); /* interpolate PTS and DTS if they are not present */ if(delay==0 || (delay==1 && pc)){ @@ -2263,7 +2259,11 @@ st->id = id; st->start_time = AV_NOPTS_VALUE; st->duration = AV_NOPTS_VALUE; - st->cur_dts = AV_NOPTS_VALUE; + /* we set the current DTS to 0 so that formats without any timestamps + but durations get some timestamps, formats with some unknown + timestamps have their first few packets buffered and the + timestamps corrected before they are returned to the user */ + st->cur_dts = 0; st->first_dts = AV_NOPTS_VALUE; /* default pts setting is MPEG-like */