From 82bf8c878345b6178ba32c7270a86670a92a72c2 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 7 Mar 2013 13:42:12 +0100 Subject: [PATCH 1/2] hls: Copy the time base from the chained demuxer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a variant stream isn't mpegts but e.g. raw adts, the default time base (90k) isn't correct. Signed-off-by: Martin Storsjö --- libavformat/hls.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/hls.c b/libavformat/hls.c index 464faee793..b9b1feaf3d 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -530,11 +530,13 @@ static int hls_read_header(AVFormatContext *s) /* Create new AVStreams for each stream in this variant */ for (j = 0; j < v->ctx->nb_streams; j++) { AVStream *st = avformat_new_stream(s, NULL); + AVStream *ist = v->ctx->streams[j]; if (!st) { ret = AVERROR(ENOMEM); goto fail; } st->id = i; + avpriv_set_pts_info(st, ist->pts_wrap_bits, ist->time_base.num, ist->time_base.den); avcodec_copy_context(st->codec, v->ctx->streams[j]->codec); if (v->bandwidth) av_dict_set(&st->metadata, "variant_bitrate", bitrate_str, From cdd2d73d315ecaf19ff49e64c91923275f1bda68 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 13 Aug 2012 20:37:04 +0200 Subject: [PATCH 2/2] hls: Don't check discard flags until the parent demuxer's streams actually exist MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If passing the end of one segment while initializing the chained demuxer, the parent demuxer's streams aren't set up yet, so we can't recheck the discard flags. Signed-off-by: Martin Storsjö --- libavformat/hls.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/hls.c b/libavformat/hls.c index b9b1feaf3d..213b71764b 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -427,7 +427,8 @@ reload: c->end_of_segment = 1; c->cur_seq_no = v->cur_seq_no; - if (v->ctx && v->ctx->nb_streams) { + if (v->ctx && v->ctx->nb_streams && + v->parent->nb_streams >= v->stream_offset + v->ctx->nb_streams) { v->needed = 0; for (i = v->stream_offset; i < v->stream_offset + v->ctx->nb_streams; i++) {