summaryrefslogtreecommitdiff
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2007-02-23 00:47:21 +0000
committerMichael Niedermayer <michaelni@gmx.at>2007-02-23 00:47:21 +0000
commit9c856d62be91f9bf4c4c671ce5cea1feef4936c7 (patch)
treeb6c8abbd3b1dd8da3b88a92a57160781ece52e53 /libavcodec/utils.c
parent5dad0282b5a1576884fd86ec65b57de2f1b4df28 (diff)
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
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 8855934802..1e5db81885 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -894,18 +894,19 @@ int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples,
{
int ret;
- //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){
- av_log(avctx, AV_LOG_ERROR, "buffer smaller than AVCODEC_MAX_AUDIO_FRAME_SIZE\n");
- return -1;
- }
- if(*frame_size_ptr < FF_MIN_BUFFER_SIZE ||
- *frame_size_ptr < avctx->channels * avctx->frame_size * sizeof(int16_t) ||
- *frame_size_ptr < buf_size){
- av_log(avctx, AV_LOG_ERROR, "buffer %d too small\n", *frame_size_ptr);
- return -1;
- }
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
+ if(*frame_size_ptr < AVCODEC_MAX_AUDIO_FRAME_SIZE){
+ av_log(avctx, AV_LOG_ERROR, "buffer smaller than AVCODEC_MAX_AUDIO_FRAME_SIZE\n");
+ return -1;
+ }
+ if(*frame_size_ptr < FF_MIN_BUFFER_SIZE ||
+ *frame_size_ptr < avctx->channels * avctx->frame_size * sizeof(int16_t) ||
+ *frame_size_ptr < buf_size){
+ av_log(avctx, AV_LOG_ERROR, "buffer %d too small\n", *frame_size_ptr);
+ return -1;
+ }
+
ret = avctx->codec->decode(avctx, samples, frame_size_ptr,
buf, buf_size);
avctx->frame_number++;