[Ffmpeg-cvslog] r8090 - trunk/libavcodec/utils.c

michael subversion
Fri Feb 23 01:47:21 CET 2007


Author: michael
Date: Fri Feb 23 01:47:21 2007
New Revision: 8090

Modified:
   trunk/libavcodec/utils.c

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


Modified: trunk/libavcodec/utils.c
==============================================================================
--- trunk/libavcodec/utils.c	(original)
+++ trunk/libavcodec/utils.c	Fri Feb 23 01:47:21 2007
@@ -894,18 +894,19 @@
 {
     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++;




More information about the ffmpeg-cvslog mailing list