Mercurial > libavcodec.hg
comparison utils.c @ 4578:006563b9ab27 libavcodec
dont check buffer size if the decode function wont be called at all
author | michael |
---|---|
date | Fri, 23 Feb 2007 00:47:21 +0000 |
parents | 88cf097ebe75 |
children | d15120610df2 |
comparison
equal
deleted
inserted
replaced
4577:88cf097ebe75 | 4578:006563b9ab27 |
---|---|
892 int *frame_size_ptr, | 892 int *frame_size_ptr, |
893 uint8_t *buf, int buf_size) | 893 uint8_t *buf, int buf_size) |
894 { | 894 { |
895 int ret; | 895 int ret; |
896 | 896 |
897 //FIXME remove the check below _after_ ensuring that all audio check that the available space is enough | |
898 if(*frame_size_ptr < AVCODEC_MAX_AUDIO_FRAME_SIZE){ | |
899 av_log(avctx, AV_LOG_ERROR, "buffer smaller than AVCODEC_MAX_AUDIO_FRAME_SIZE\n"); | |
900 return -1; | |
901 } | |
902 if(*frame_size_ptr < FF_MIN_BUFFER_SIZE || | |
903 *frame_size_ptr < avctx->channels * avctx->frame_size * sizeof(int16_t) || | |
904 *frame_size_ptr < buf_size){ | |
905 av_log(avctx, AV_LOG_ERROR, "buffer %d too small\n", *frame_size_ptr); | |
906 return -1; | |
907 } | |
908 if((avctx->codec->capabilities & CODEC_CAP_DELAY) || buf_size){ | 897 if((avctx->codec->capabilities & CODEC_CAP_DELAY) || buf_size){ |
898 //FIXME remove the check below _after_ ensuring that all audio check that the available space is enough | |
899 if(*frame_size_ptr < AVCODEC_MAX_AUDIO_FRAME_SIZE){ | |
900 av_log(avctx, AV_LOG_ERROR, "buffer smaller than AVCODEC_MAX_AUDIO_FRAME_SIZE\n"); | |
901 return -1; | |
902 } | |
903 if(*frame_size_ptr < FF_MIN_BUFFER_SIZE || | |
904 *frame_size_ptr < avctx->channels * avctx->frame_size * sizeof(int16_t) || | |
905 *frame_size_ptr < buf_size){ | |
906 av_log(avctx, AV_LOG_ERROR, "buffer %d too small\n", *frame_size_ptr); | |
907 return -1; | |
908 } | |
909 | |
909 ret = avctx->codec->decode(avctx, samples, frame_size_ptr, | 910 ret = avctx->codec->decode(avctx, samples, frame_size_ptr, |
910 buf, buf_size); | 911 buf, buf_size); |
911 avctx->frame_number++; | 912 avctx->frame_number++; |
912 }else{ | 913 }else{ |
913 ret= 0; | 914 ret= 0; |