[FFmpeg-cvslog] r25060 - trunk/libavcodec/mpegvideo_enc.c

mru subversion
Tue Sep 7 21:54:49 CEST 2010


Author: mru
Date: Tue Sep  7 21:54:48 2010
New Revision: 25060

Log:
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.

Modified:
   trunk/libavcodec/mpegvideo_enc.c

Modified: trunk/libavcodec/mpegvideo_enc.c
==============================================================================
--- trunk/libavcodec/mpegvideo_enc.c	Tue Sep  7 21:19:32 2010	(r25059)
+++ trunk/libavcodec/mpegvideo_enc.c	Tue Sep  7 21:54:48 2010	(r25060)
@@ -351,7 +351,7 @@ av_cold int MPV_encode_init(AVCodecConte
         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;
     }



More information about the ffmpeg-cvslog mailing list