[FFmpeg-cvslog] lavc: set the default rc_initial_buffer_occupancy

Luca Barbato git at videolan.org
Mon Nov 4 18:04:20 CET 2013


ffmpeg | branch: release/0.10 | Luca Barbato <lu_zero at gentoo.org> | Mon Jan 14 05:32:38 2013 +0100| [2da49df19e115becdddf60f8704889868ca2f56b] | committer: Luca Barbato

lavc: set the default rc_initial_buffer_occupancy

rc_buffer_size is not set before.

Solve the initial the rate control underflow issue reported in
bug 222.

CC: libav-stable at libav.org

Signed-off-by: Luca Barbato <lu_zero at gentoo.org>
(cherry picked from commit bff3607547fdbb6e32b3830a351e6a33280c1e0d)

Signed-off-by: Luca Barbato <lu_zero at gentoo.org>

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

 avconv.c           |    2 --
 libavcodec/utils.c |    3 +++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/avconv.c b/avconv.c
index 90b72fd..212d948 100644
--- a/avconv.c
+++ b/avconv.c
@@ -3664,8 +3664,6 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc)
             if (p) p++;
         }
         video_enc->rc_override_count = i;
-        if (!video_enc->rc_initial_buffer_occupancy)
-            video_enc->rc_initial_buffer_occupancy = video_enc->rc_buffer_size * 3 / 4;
         video_enc->intra_dc_precision = intra_dc_precision - 8;
 
         /* two pass mode */
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index f64bff8..7902e98 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -810,6 +810,9 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVD
         } else if (avctx->channel_layout) {
             avctx->channels = av_get_channel_layout_nb_channels(avctx->channel_layout);
         }
+
+        if (!avctx->rc_initial_buffer_occupancy)
+            avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size * 3 / 4;
     }
 
     if(avctx->codec->init && !(avctx->active_thread_type&FF_THREAD_FRAME)){



More information about the ffmpeg-cvslog mailing list