check for CODEC_CAP_DELAY in audio decoders too
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 14 Jul 2005 15:30:39 +0000 (15:30 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 14 Jul 2005 15:30:39 +0000 (15:30 +0000)
Originally committed as revision 4439 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/utils.c

index 5bd0012..0a0971f 100644 (file)
@@ -642,9 +642,12 @@ int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples,
     int ret;
 
     *frame_size_ptr= 0;
-    ret = avctx->codec->decode(avctx, samples, frame_size_ptr, 
-                               buf, buf_size);
-    avctx->frame_number++;
+    if((avctx->codec->capabilities & CODEC_CAP_DELAY) || buf_size){
+        ret = avctx->codec->decode(avctx, samples, frame_size_ptr, 
+                                buf, buf_size);
+        avctx->frame_number++;
+    }else
+        ret= 0;
     return ret;
 }