avformat/segment: export inner muxer timebase
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 16 Nov 2014 01:49:12 +0000 (02:49 +0100)
committerCarl Eugen Hoyos <cehoyos@ag.or.at>
Mon, 17 Nov 2014 00:13:20 +0000 (01:13 +0100)
Fixes "Non-monotonous DTS in output stream 0:0"
Fixes Ticket4020

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ce80f9fee97160049687bbbef4eb31a68166c3ee)

libavformat/segment.c

index b627cd7..e73f33f 100644 (file)
@@ -562,6 +562,7 @@ static int seg_write_header(AVFormatContext *s)
     SegmentContext *seg = s->priv_data;
     AVFormatContext *oc = NULL;
     int ret;
+    int i;
 
     seg->segment_count = 0;
     if (!seg->write_header_trailer)
@@ -649,6 +650,13 @@ static int seg_write_header(AVFormatContext *s)
     }
     seg->is_first_pkt = 1;
 
+    av_assert0(s->nb_streams == oc->nb_streams);
+    for (i = 0; i < s->nb_streams; i++) {
+        AVStream *inner_st  = oc->streams[i];
+        AVStream *outer_st = s->streams[i];
+        avpriv_set_pts_info(outer_st, inner_st->pts_wrap_bits, inner_st->time_base.num, inner_st->time_base.den);
+    }
+
     if (oc->avoid_negative_ts > 0 && s->avoid_negative_ts < 0)
         s->avoid_negative_ts = 1;