summaryrefslogtreecommitdiff
path: root/libavformat/utils.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2012-08-11 20:06:08 +0300
committerMartin Storsjö <martin@martin.st>2012-08-12 12:39:47 +0300
commit30c26c2442e4e44ac5a763c23c4b0fdd9921a7f5 (patch)
tree3354216cd495449eab92d589648e416fe7286817 /libavformat/utils.c
parent6e9bbc6525989f7dc51acc76712c6ca674053b60 (diff)
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@martin.st>
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r--libavformat/utils.c6
1 files changed, 6 insertions, 0 deletions
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;
}