[FFmpeg-cvslog] lavf: Initialize the stream info timestamps in avformat_new_stream

Martin Storsjö git at videolan.org
Sun Aug 12 13:48:49 CEST 2012


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Sat Aug 11 20:06:08 2012 +0300| [30c26c2442e4e44ac5a763c23c4b0fdd9921a7f5] | committer: Martin Storsjö

lavf: Initialize the stream info timestamps in avformat_new_stream

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ö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=30c26c2442e4e44ac5a763c23c4b0fdd9921a7f5
---

 libavformat/utils.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 64c5260..34177fb 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;
 }



More information about the ffmpeg-cvslog mailing list