Commit 0d7b2bd8 authored by Ilkka Ollakka's avatar Ilkka Ollakka

avcodec: define 1/2 second buffer size by default

mpeg-based codecs seems to require this to be able to produce ~cbr
output. Should Fix #8239 and #9983
parent 4b48516d
...@@ -597,11 +597,15 @@ int OpenEncoder( vlc_object_t *p_this ) ...@@ -597,11 +597,15 @@ int OpenEncoder( vlc_object_t *p_this )
else else
{ {
p_context->rc_qsquish = 1.0; p_context->rc_qsquish = 1.0;
if( p_sys->i_rc_buffer_size ) /* Default to 1/2 second buffer for given bitrate unless defined otherwise*/
if( !p_sys->i_rc_buffer_size )
{ {
p_sys->i_rc_buffer_size = p_enc->fmt_out.i_bitrate * 8 / 2;
}
msg_Dbg( p_enc, "rc buffer size %d bits", p_sys->i_rc_buffer_size );
/* Set maxrate/minrate to bitrate to try to get CBR */
p_context->rc_max_rate = p_enc->fmt_out.i_bitrate; p_context->rc_max_rate = p_enc->fmt_out.i_bitrate;
p_context->rc_min_rate = p_enc->fmt_out.i_bitrate; p_context->rc_min_rate = p_enc->fmt_out.i_bitrate;
}
p_context->rc_buffer_size = p_sys->i_rc_buffer_size; p_context->rc_buffer_size = p_sys->i_rc_buffer_size;
/* This is from ffmpeg's ffmpeg.c : */ /* This is from ffmpeg's ffmpeg.c : */
p_context->rc_initial_buffer_occupancy p_context->rc_initial_buffer_occupancy
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment