changeset 9595:f9a7147cc9e6 libavcodec

Do not scan for MP3 header after the given buffer and return skipped bytes along with consumed bytes on successful decoding. patch by Zdenek Kabelac, zdenek.kabelac gmail com
author diego
date Mon, 04 May 2009 14:23:48 +0000
parents a0517e3590fd
children 182f35c8eaed
files mpegaudiodec.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mpegaudiodec.c	Mon May 04 03:25:57 2009 +0000
+++ b/mpegaudiodec.c	Mon May 04 14:23:48 2009 +0000
@@ -2263,6 +2263,7 @@
     MPADecodeContext *s = avctx->priv_data;
     uint32_t header;
     int out_size;
+    int skipped = 0;
     OUT_INT *out_samples = data;
 
 retry:
@@ -2272,7 +2273,8 @@
     header = AV_RB32(buf);
     if(ff_mpa_check_header(header) < 0){
         buf++;
-//        buf_size--;
+        buf_size--;
+        skipped++;
         av_log(avctx, AV_LOG_ERROR, "Header missing skipping one byte.\n");
         goto retry;
     }
@@ -2303,7 +2305,7 @@
     }else
         av_log(avctx, AV_LOG_DEBUG, "Error while decoding MPEG audio frame.\n"); //FIXME return -1 / but also return the number of bytes consumed
     s->frame_size = 0;
-    return buf_size;
+    return buf_size + skipped;
 }
 
 static void flush(AVCodecContext *avctx){