From 9257692ac15eff7b07540c1f61cebde0d8823fbd Mon Sep 17 00:00:00 2001 From: Martin Storsjö Date: Mon, 17 Nov 2014 13:31:47 +0200 Subject: lavf: Only initialize s->offset once when using avoid_negative_ts make_zero MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When given a stream starting at dts=0, it would previously consider s->offset as uninitialized and set an offset when the second packet was written, ending up writing two packets with dts=0. By initializing this field to AV_NOPTS_VALUE, we make sure that we only initialize it once, on the first packet. Signed-off-by: Martin Storsjö --- libavformat/options.c | 1 + 1 file changed, 1 insertion(+) (limited to 'libavformat/options.c') diff --git a/libavformat/options.c b/libavformat/options.c index a5646df997..ad47004651 100644 --- a/libavformat/options.c +++ b/libavformat/options.c @@ -101,6 +101,7 @@ AVFormatContext *avformat_alloc_context(void) ic = av_malloc(sizeof(AVFormatContext)); if (!ic) return ic; avformat_get_context_defaults(ic); + ic->offset = AV_NOPTS_VALUE; ic->internal = av_mallocz(sizeof(*ic->internal)); if (!ic->internal) { -- cgit v1.2.3