[vlc-commits] avcodec: define 1/2 second buffer size by default
Ilkka Ollakka
git at videolan.org
Sat Nov 30 17:16:53 CET 2013
vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Sat Nov 30 16:47:28 2013 +0200| [0d7b2bd84be400a34785e6f44b0900d62b8507c9] | committer: 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
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0d7b2bd84be400a34785e6f44b0900d62b8507c9
---
modules/codec/avcodec/encoder.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index 85e150d..910fb13 100644
--- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c
@@ -597,11 +597,15 @@ int OpenEncoder( vlc_object_t *p_this )
else
{
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_context->rc_max_rate = p_enc->fmt_out.i_bitrate;
- p_context->rc_min_rate = p_enc->fmt_out.i_bitrate;
+ 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_min_rate = p_enc->fmt_out.i_bitrate;
p_context->rc_buffer_size = p_sys->i_rc_buffer_size;
/* This is from ffmpeg's ffmpeg.c : */
p_context->rc_initial_buffer_occupancy
More information about the vlc-commits
mailing list