diff mpegvideo_enc.c @ 12463:04e68eb1aab7 libavcodec

Check rc_buffer_size value using integer arithmetic Using floating-point here can cause erroneous rejection of parameters due to rounding errors leading to a slightly too large result. This fixes the mxf regression test with gcc 4.5 on x86_32.
author mru
date Tue, 07 Sep 2010 19:54:48 +0000
parents b6cf19580e47
children 077c67a3b86f
line wrap: on
line diff
--- a/mpegvideo_enc.c	Tue Sep 07 19:15:29 2010 +0000
+++ b/mpegvideo_enc.c	Tue Sep 07 19:54:48 2010 +0000
@@ -351,7 +351,7 @@
         av_log(avctx, AV_LOG_INFO, "impossible bitrate constraints, this will fail\n");
     }
 
-    if(avctx->rc_buffer_size && avctx->bit_rate*av_q2d(avctx->time_base) > avctx->rc_buffer_size){
+    if(avctx->rc_buffer_size && avctx->bit_rate*(int64_t)avctx->time_base.num > avctx->rc_buffer_size * (int64_t)avctx->time_base.den){
         av_log(avctx, AV_LOG_ERROR, "VBV buffer too small for bitrate\n");
         return -1;
     }