From 3321cb3f6e02954887797e67021ed48c1e108795 Mon Sep 17 00:00:00 2001 From: Baptiste Coudurier Date: Mon, 13 Apr 2009 03:55:26 +0000 Subject: [PATCH] move audio buffers declarations and free them in av_exit Originally committed as revision 18486 to svn://svn.ffmpeg.org/ffmpeg/trunk --- ffmpeg.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ffmpeg.c b/ffmpeg.c index feb1b2d760..619dda02d5 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -222,6 +222,12 @@ static unsigned int sws_flags = SWS_BICUBIC; static int64_t timer_start; +static uint8_t *audio_buf; +static uint8_t *audio_out; +static uint8_t *audio_out2; + +static short *samples; + static AVBitStreamFilterContext *video_bitstream_filters=NULL; static AVBitStreamFilterContext *audio_bitstream_filters=NULL; static AVBitStreamFilterContext *subtitle_bitstream_filters=NULL; @@ -431,6 +437,10 @@ static int av_exit(int ret) av_free(avcodec_opts[i]); av_free(avformat_opts); av_free(sws_opts); + av_free(audio_buf); + av_free(audio_out); + av_free(audio_out2); + av_free(samples); if (received_sigterm) { fprintf(stderr, @@ -532,9 +542,6 @@ static void do_audio_out(AVFormatContext *s, unsigned char *buf, int size) { uint8_t *buftmp; - static uint8_t *audio_buf = NULL; - static uint8_t *audio_out = NULL; - static uint8_t *audio_out2 = NULL; const int audio_out_size= 4*MAX_AUDIO_PACKET_SIZE; int size_out, frame_bytes, ret; @@ -1185,7 +1192,6 @@ static int output_packet(AVInputStream *ist, int ist_index, AVFrame picture; void *buffer_to_free; static unsigned int samples_size= 0; - static short *samples= NULL; AVSubtitle subtitle, *subtitle_to_free; int got_subtitle; AVPacket avpkt;