[FFmpeg-devel] [PATCH] lame buffer shortage

Michael Niedermayer michaelni
Mon Jul 23 17:26:34 CEST 2007


Hi

On Mon, Jul 23, 2007 at 09:18:33AM +0200, Andreas ?man wrote:
> Hi
> 
> Michael Niedermayer wrote:
> >Hi
> >
> >On Sun, Jul 22, 2007 at 02:17:29PM +0200, Gabriel Bouvigne wrote:
> >>Regarding the patch itself, why not simply allocating the buffer size 
> >>recommended into lame.h ?
> >
> >patch welcome :)
> 
> ... and here it is.
> 
> 

> Index: libavcodec/libmp3lame.c
> ===================================================================
> --- libavcodec/libmp3lame.c	(revision 9778)
> +++ libavcodec/libmp3lame.c	(working copy)
> @@ -28,11 +28,11 @@
>  #include "mpegaudio.h"
>  #include <lame/lame.h>
>  
> -#define BUFFER_SIZE (2*MPA_FRAME_SIZE)
>  typedef struct Mp3AudioContext {
>      lame_global_flags *gfp;
>      int stereo;
> -    uint8_t buffer[BUFFER_SIZE];
> +    uint8_t *buffer;
> +    int buffer_size;
>      int buffer_index;
>  } Mp3AudioContext;
>  
> @@ -66,6 +66,12 @@
>  
>      avctx->frame_size = lame_get_framesize(s->gfp);
>  
> +    s->buffer_size = 7200 + avctx->frame_size + avctx->frame_size / 4;

why not
#define BUFFER_SIZE (7200 + MPA_FRAME_SIZE + MPA_FRAME_SIZE/4)
?

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I count him braver who overcomes his desires than him who conquers his
enemies for the hardest victory is over self. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070723/9762d13a/attachment.pgp>



More information about the ffmpeg-devel mailing list