[FFmpeg-cvslog] Fix broken vbv_buffer_init handling in libx264.c

Jason Garrett-Glaser git
Wed Feb 9 04:00:13 CET 2011


ffmpeg | branch: master | Jason Garrett-Glaser <jason at x264.com> | Sun Feb  6 05:10:15 2011 -0800| [2c855cea85f5e43afa2365dbba76e1917fa239b3] | committer: Michael Niedermayer

Fix broken vbv_buffer_init handling in libx264.c

Due to being pants-on-head retarded, libavcodec defaults this to zero, which
results in broken output.  This didn't affect ffmpeg.c, which sets it itself,
but caused problems for other calling apps using VBV.
(cherry picked from commit f7f8120fb9a06b5d7fbf5add48a0d8464319a332)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2c855cea85f5e43afa2365dbba76e1917fa239b3
---

 libavcodec/libx264.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 84ecb2a..185287c 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -277,12 +277,11 @@ static av_cold int X264_init(AVCodecContext *avctx)
     if (avctx->level > 0)
         x4->params.i_level_idc = avctx->level;
 
-    if ((avctx->rc_buffer_size != 0) &&
+    if (avctx->rc_buffer_size && avctx->rc_initial_buffer_occupancy &&
         (avctx->rc_initial_buffer_occupancy <= avctx->rc_buffer_size)) {
         x4->params.rc.f_vbv_buffer_init =
             (float)avctx->rc_initial_buffer_occupancy / avctx->rc_buffer_size;
-    } else
-        x4->params.rc.f_vbv_buffer_init = 0.9;
+    }
 
     x4->params.rc.b_mb_tree               = !!(avctx->flags2 & CODEC_FLAG2_MBTREE);
     x4->params.rc.f_ip_factor             = 1 / fabs(avctx->i_quant_factor);




More information about the ffmpeg-cvslog mailing list