aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSylvain Corré <sylvain.corre@wanadoo.fr>2003-03-20 01:32:17 +0000
committerMichael Niedermayer <michaelni@gmx.at>2003-03-20 01:32:17 +0000
commitd66c7abc937069d57fb156bcecec16e406b88c7b (patch)
tree4ef3832f037d50e76c88bfde6e81a668fa1a9e65
parent57d03758491d5bdd40a096e0930bf4d0c154485c (diff)
downloadffmpeg-d66c7abc937069d57fb156bcecec16e406b88c7b.tar.gz
MacOS X stack overflow? patch by (Sylvain Corré <sylvain dot corre at wanadoo.fr>)
Originally committed as revision 1694 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--ffmpeg.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index 5925d83467..11040138d2 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -335,11 +335,21 @@ static void do_audio_out(AVFormatContext *s,
unsigned char *buf, int size)
{
uint8_t *buftmp;
- uint8_t audio_buf[2*MAX_AUDIO_PACKET_SIZE]; /* XXX: allocate it */
- uint8_t audio_out[4*MAX_AUDIO_PACKET_SIZE]; /* XXX: allocate it - yep really WMA */
+ static uint8_t *audio_buf = NULL;
+ static uint8_t *audio_out = NULL;
+
int size_out, frame_bytes, ret;
AVCodecContext *enc;
+ /* SC: dynamic allocation of buffers */
+ if (!audio_buf)
+ audio_buf = av_malloc(2*MAX_AUDIO_PACKET_SIZE);
+ if (!audio_out)
+ audio_out = av_malloc(4*MAX_AUDIO_PACKET_SIZE);
+ if (!audio_buf || !audio_out)
+ return; /* Should signal an error ! */
+
+
enc = &ost->st->codec;
if (ost->audio_resample) {