avcodec/mpegvideo_parser: consider vbv_delay in bitrate heuristic also for mpeg2
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 20 Aug 2014 18:01:40 +0000 (20:01 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 25 Aug 2014 12:15:43 +0000 (14:15 +0200)
Fixes bitrate detection in CBR mpeg2
Fixes ticket3678

libavcodec/mpegvideo_parser.c

index 7aa3660..44bf26d 100644 (file)
@@ -145,8 +145,9 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s,
  the_end: ;
     if (avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO && bit_rate) {
         avctx->rc_max_rate = 400*bit_rate;
-    } else if (avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO && bit_rate &&
-               (bit_rate != 0x3FFFF || vbv_delay != 0xFFFF)) {
+    }
+    if (bit_rate &&
+        ((avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO && bit_rate != 0x3FFFF) || vbv_delay != 0xFFFF)) {
         avctx->bit_rate = 400*bit_rate;
     }
 }