On Sat, 12 Jan 2013 04:31:21 +0100, Luca Barbato <[email protected]> wrote:
> rc_buffer_size is not set before.
> 
> Solve the initial the rate control underflow issue reported in
> bug 222.
> 
> CC: [email protected]
> ---
>  avconv_opt.c       | 2 --
>  libavcodec/utils.c | 3 +++
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/avconv_opt.c b/avconv_opt.c
> index ce32df6..e67abef 100644
> --- a/avconv_opt.c
> +++ b/avconv_opt.c
> @@ -950,8 +950,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 23f2ac4..19c8a99 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -824,6 +824,9 @@ int attribute_align_arg avcodec_open2(AVCodecContext 
> *avctx, const AVCodec *code
>          } 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)) {
> -- 
> 1.8.0.2
> 

I'm not very happy with putting this here, but I guess it could be ok for now,
until a better place is found.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to