]> git.sesse.net Git - vlc/commitdiff
avcodec: only set min/maxrate if rc-buffer-size is set
authorIlkka Ollakka <ileoo@videolan.org>
Wed, 24 Oct 2012 20:58:49 +0000 (23:58 +0300)
committerIlkka Ollakka <ileoo@videolan.org>
Wed, 24 Oct 2012 20:59:42 +0000 (23:59 +0300)
modules/codec/avcodec/encoder.c

index 73f5dd3a21a39707bf0bca04b65623bab9704607..12487413e4f6168bd5e78204eba843c4af49407a 100644 (file)
@@ -573,8 +573,11 @@ int OpenEncoder( vlc_object_t *p_this )
         else
         {
             p_context->rc_qsquish = 1.0;
-            p_context->rc_max_rate = p_enc->fmt_out.i_bitrate;
-            p_context->rc_min_rate = p_enc->fmt_out.i_bitrate;
+            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_context->rc_buffer_size = p_sys->i_rc_buffer_size;
             /* This is from ffmpeg's ffmpeg.c : */
             p_context->rc_initial_buffer_occupancy