From 30c26c2442e4e44ac5a763c23c4b0fdd9921a7f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Sat, 11 Aug 2012 20:06:08 +0300 Subject: [PATCH] lavf: Initialize the stream info timestamps in avformat_new_stream MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These are normally initialized to AV_NOPTS_VALUE at the start of avformat_find_stream_info, but if a new stream is found while this function is running (e.g. like in mpegts), the newly added AVStreams didn't have these values properly initalized, leading to avformat_find_stream_info terminating too soon (when the first timestamps are far from 0). Signed-off-by: Martin Storsjö --- libavformat/utils.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavformat/utils.c b/libavformat/utils.c index 64c5260cec..34177fbdba 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2746,6 +2746,12 @@ AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c) st->sample_aspect_ratio = (AVRational){0,1}; +#if FF_API_R_FRAME_RATE + st->info->last_dts = AV_NOPTS_VALUE; +#endif + st->info->fps_first_dts = AV_NOPTS_VALUE; + st->info->fps_last_dts = AV_NOPTS_VALUE; + s->streams[s->nb_streams++] = st; return st; }