Commit 78953e62 authored by Michael Niedermayer's avatar Michael Niedermayer

avoid using local arrays outside the block where they live ...

Originally committed as revision 3536 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 80e85288
......@@ -1085,7 +1085,9 @@ static int output_packet(AVInputStream *ist, int ist_index,
int data_size, got_picture;
AVFrame picture;
void *buffer_to_free;
static int samples_size= 0;
static short *samples= NULL;
if(!pkt){
ist->pts= ist->next_pts; // needed for last packet if vsync=0
} else if (pkt->dts != AV_NOPTS_VALUE) { //FIXME seems redundant, as libavformat does this too
......@@ -1111,9 +1113,10 @@ static int output_packet(AVInputStream *ist, int ist_index,
if (ist->decoding_needed) {
switch(ist->st->codec.codec_type) {
case CODEC_TYPE_AUDIO:{
if(pkt)
samples= av_fast_realloc(samples, &samples_size, FFMAX(pkt->size, AVCODEC_MAX_AUDIO_FRAME_SIZE));
/* XXX: could avoid copy if PCM 16 bits with same
endianness as CPU */
short samples[pkt && pkt->size > AVCODEC_MAX_AUDIO_FRAME_SIZE/2 ? pkt->size : AVCODEC_MAX_AUDIO_FRAME_SIZE/2];
ret = avcodec_decode_audio(&ist->st->codec, samples, &data_size,
ptr, len);
if (ret < 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment