aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-06-06 19:44:05 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-06-06 19:44:05 +0000
commit23854cadeceb28053643cbc707e75feebbd94b61 (patch)
treec0c9845228aeefe84b42d44b2cee32cb8aa032f1
parentfdce4f3132f52f5ea550637694f70e037e8a8c3d (diff)
downloadffmpeg-23854cadeceb28053643cbc707e75feebbd94b61.tar.gz
sanity checks
Originally committed as revision 3202 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/mpegvideo.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index e28d9b309b..bd2de7cd0f 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -929,6 +929,16 @@ int MPV_encode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_INFO, "Warning min_rate > 0 but min_rate != max_rate isnt recommanded!\n");
}
+ if(avctx->rc_min_rate && avctx->rc_min_rate > avctx->bit_rate){
+ av_log(avctx, AV_LOG_INFO, "bitrate below min bitrate\n");
+ return -1;
+ }
+
+ if(avctx->rc_max_rate && avctx->rc_max_rate < avctx->bit_rate){
+ av_log(avctx, AV_LOG_INFO, "bitrate above max bitrate\n");
+ return -1;
+ }
+
if( s->avctx->rc_max_rate && s->avctx->rc_min_rate == s->avctx->rc_max_rate
&& (s->codec_id == CODEC_ID_MPEG1VIDEO || s->codec_id == CODEC_ID_MPEG2VIDEO)
&& 90000LL * (avctx->rc_buffer_size-1) > s->avctx->rc_max_rate*0xFFFFLL){