diff options
author | Zdenek Kabelac <zdenek.kabelac@gmail.com> | 2009-05-04 14:23:48 +0000 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2009-05-04 14:23:48 +0000 |
commit | e2fa5cf4c96391e82848e078e6a1e40f41c2ea2d (patch) | |
tree | 198a5200e0e5be0b4beb1c3fb81b37734fd140e2 | |
parent | c7279693ae4224419ad567b4229906f1e677e4dd (diff) | |
download | ffmpeg-e2fa5cf4c96391e82848e078e6a1e40f41c2ea2d.tar.gz |
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
Originally committed as revision 18736 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/mpegaudiodec.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c index 8584c6bf77..b4d469990c 100644 --- a/libavcodec/mpegaudiodec.c +++ b/libavcodec/mpegaudiodec.c @@ -2263,6 +2263,7 @@ static int decode_frame(AVCodecContext * avctx, MPADecodeContext *s = avctx->priv_data; uint32_t header; int out_size; + int skipped = 0; OUT_INT *out_samples = data; retry: @@ -2272,7 +2273,8 @@ retry: 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 @@ retry: }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){ |