[vlc-devel] commit: Increase avcodec encoding output buffer size ( Rafaël Carré )

git version control git at videolan.org
Mon Dec 21 11:57:04 CET 2009


vlc | branch: master | Rafaël Carré <rafael.carre at gmail.com> | Mon Dec 21 11:54:06 2009 +0100| [cdae7653cc243584b963716065a404f1e0665d0f] | committer: Rafaël Carré 

Increase avcodec encoding output buffer size

Make some room for potential headers, You can now output VLC_CODEC_BMP
We use the same arbitrary value of 200 bytes than ffmpeg.c

Note: if we can ask FFmpeg to output RGBA (32bpp) or RGB48 (48bpp) then
the multiplier should be increased to 4 or 6 (needs to be investigated)

Pointed-out-by: ivoire

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cdae7653cc243584b963716065a404f1e0665d0f
---

 modules/codec/avcodec/encoder.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index 87ce339..bc18c37 100644
--- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c
@@ -433,7 +433,10 @@ int OpenEncoder( vlc_object_t *p_this )
                    p_enc->fmt_in.video.i_sar_num,
                    p_enc->fmt_in.video.i_sar_den, 1 << 30 );
 
-        p_sys->i_buffer_out = p_context->height * p_context->width * 3;
+        p_sys->i_buffer_out = p_context->height * p_context->width
+            * 3     /* Assume 24bpp maximum */
+            + 200;  /* some room for potential headers (such as BMP) */
+
         if( p_sys->i_buffer_out < FF_MIN_BUFFER_SIZE )
             p_sys->i_buffer_out = FF_MIN_BUFFER_SIZE;
         p_sys->p_buffer_out = malloc( p_sys->i_buffer_out );




More information about the vlc-devel mailing list