]> git.sesse.net Git - ffmpeg/commitdiff
mpegvideoenc: Fail if a buffer size is specified without a max rate.
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 18 Jan 2012 04:36:23 +0000 (05:36 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 28 Jan 2012 00:36:44 +0000 (01:36 +0100)
This combination makes not much sense.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/mpegvideo_enc.c

index fd31edc481a9a48a86c49bb63c98bd9f4e02e7fe..45dcea076b4ee6dab1608bc7e4611706fa9e1035 100644 (file)
@@ -392,10 +392,8 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
     s->obmc             = !!(s->flags  & CODEC_FLAG_OBMC);
 #endif
 
-    if (avctx->rc_max_rate && !avctx->rc_buffer_size) {
-        av_log(avctx, AV_LOG_ERROR,
-               "a vbv buffer size is needed, "
-               "for encoding with a maximum bitrate\n");
+    if ((!avctx->rc_max_rate) != (!avctx->rc_buffer_size)) {
+        av_log(avctx, AV_LOG_ERROR, "Either both buffer size and max rate or neither must be specified\n");
         return -1;
     }