[03/10] hls: Copy the time base from the chained demuxer

Message ID 1375038091-92151-3-git-send-email-martin@martin.st
State Committed
Commit 82bf8c878345b6178ba32c7270a86670a92a72c2
Headers show

Commit Message

Martin Storsjö July 28, 2013, 7:01 p.m.
From: Michael Niedermayer <michaelni@gmx.at>

When a variant stream isn't mpegts but e.g. raw adts, the
default time base (90k) isn't correct.
---
 libavformat/hls.c |    2 ++
 1 file changed, 2 insertions(+)

Comments

Luca Barbato July 28, 2013, 7:56 p.m. | #1
On 28/07/13 21:01, Martin Storsjö wrote:
> From: Michael Niedermayer <michaelni@gmx.at>
> 
> When a variant stream isn't mpegts but e.g. raw adts, the
> default time base (90k) isn't correct.
> ---
>  libavformat/hls.c |    2 ++
>  1 file changed, 2 insertions(+)
> 

Looks fine.

Patch

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 464faee..b9b1fea 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,