From 9e6c124a871f9b0c06081b6d2f11878cf6903924 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 1 Mar 2009 03:17:24 +0000 Subject: Disable MPEG-1/2 style timestamp calculation for H264. It still randomizes the timestamps because delay is not known for the first few frames. Originally committed as revision 17674 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/utils.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index 9354b75886..ec64eb92b2 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -859,7 +859,8 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st, // 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)){ + //We skip H264 currently because delay and has_b_frames are not reliably set + if((delay==0 || (delay==1 && pc)) && st->codec->codec_id != CODEC_ID_H264){ if (presentation_delayed) { /* DTS = decompression timestamp */ /* PTS = presentation timestamp */ @@ -907,7 +908,7 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st, FFSWAP(int64_t, st->pts_buffer[i], st->pts_buffer[i+1]); if(pkt->dts == AV_NOPTS_VALUE) pkt->dts= st->pts_buffer[0]; - if(delay>1){ + if(st->codec->codec_id == CODEC_ID_H264){ //we skiped it above so we try here update_initial_timestamps(s, pkt->stream_index, pkt->dts, pkt->pts); // this should happen on the first packet } if(pkt->dts > st->cur_dts) -- cgit v1.2.3