# HG changeset patch # User diego # Date 1241447028 0 # Node ID f9a7147cc9e6bee575b19650b2e05743cce48a51 # Parent a0517e3590fd22e0340a67961e13cd6568b9e215 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 diff -r a0517e3590fd -r f9a7147cc9e6 mpegaudiodec.c --- 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){