avformat/utils: Use internal->avctx for bitrate in estimate_timings_from_bit_rate...
authorMichael Niedermayer <michael@niedermayer.cc>
Wed, 22 Jun 2016 11:59:19 +0000 (13:59 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 22 Jun 2016 12:16:58 +0000 (14:16 +0200)
The internal avctx bitrate is copied into codecpar after estimate_timings()

Fixes Ticket5646

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/utils.c

index e2037db..a3c6705 100644 (file)
@@ -2568,6 +2568,8 @@ static void estimate_timings_from_bit_rate(AVFormatContext *ic)
         int64_t bit_rate = 0;
         for (i = 0; i < ic->nb_streams; i++) {
             st = ic->streams[i];
+            if (st->codecpar->bit_rate <= 0 && st->internal->avctx->bit_rate > 0)
+                st->codecpar->bit_rate = st->internal->avctx->bit_rate;
             if (st->codecpar->bit_rate > 0) {
                 if (INT64_MAX - st->codecpar->bit_rate < bit_rate) {
                     bit_rate = 0;