diff --git a/ffmpeg.c b/ffmpeg.c index 2ee0011180..3f12c1f089 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -1049,7 +1049,7 @@ static int output_packet(AVInputStream *ist, int ist_index, 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)); + samples= av_fast_realloc(samples, &samples_size, FFMAX(pkt->size*sizeof(*samples), AVCODEC_MAX_AUDIO_FRAME_SIZE)); data_size= samples_size; /* XXX: could avoid copy if PCM 16 bits with same endianness as CPU */