dont check buffer size if the decode function wont be called at all

Originally committed as revision 8090 to svn://svn.ffmpeg.org/ffmpeg/trunk
pull/126/head
Michael Niedermayer 18 years ago
parent 5dad0282b5
commit 9c856d62be
  1. 3
      libavcodec/utils.c

@ -894,6 +894,7 @@ int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples,
{ {
int ret; int ret;
if((avctx->codec->capabilities & CODEC_CAP_DELAY) || buf_size){
//FIXME remove the check below _after_ ensuring that all audio check that the available space is enough //FIXME remove the check below _after_ ensuring that all audio check that the available space is enough
if(*frame_size_ptr < AVCODEC_MAX_AUDIO_FRAME_SIZE){ if(*frame_size_ptr < AVCODEC_MAX_AUDIO_FRAME_SIZE){
av_log(avctx, AV_LOG_ERROR, "buffer smaller than AVCODEC_MAX_AUDIO_FRAME_SIZE\n"); av_log(avctx, AV_LOG_ERROR, "buffer smaller than AVCODEC_MAX_AUDIO_FRAME_SIZE\n");
@ -905,7 +906,7 @@ int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples,
av_log(avctx, AV_LOG_ERROR, "buffer %d too small\n", *frame_size_ptr); av_log(avctx, AV_LOG_ERROR, "buffer %d too small\n", *frame_size_ptr);
return -1; return -1;
} }
if((avctx->codec->capabilities & CODEC_CAP_DELAY) || buf_size){
ret = avctx->codec->decode(avctx, samples, frame_size_ptr, ret = avctx->codec->decode(avctx, samples, frame_size_ptr,
buf, buf_size); buf, buf_size);
avctx->frame_number++; avctx->frame_number++;

Loading…
Cancel
Save