diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2009-06-30 03:57:27 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2009-06-30 03:57:27 +0000 |
commit | 822d0a6e0c02e7ad19f09cd0b1d4d182fa2d8e26 (patch) | |
tree | 3205c7348a68a70fecea368c38e390440cb2dad5 | |
parent | f3ac96e4d82ce977fbef0d724b744bd9cbdddb20 (diff) | |
download | ffmpeg-822d0a6e0c02e7ad19f09cd0b1d4d182fa2d8e26.tar.gz |
Drop code that attempts to decode frames that are prefixed by junk.
Too often it ends up decoding random data into noise without detecting
it (for example after seeking of some MP3 data with oddly often occurring
startcode emulation).
Fixes issue1154.
Originally committed as revision 19302 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/mpegaudiodec.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c index a2158bcb88..221941abcc 100644 --- a/libavcodec/mpegaudiodec.c +++ b/libavcodec/mpegaudiodec.c @@ -2255,20 +2255,15 @@ 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: if(buf_size < HEADER_SIZE) return -1; header = AV_RB32(buf); if(ff_mpa_check_header(header) < 0){ - buf++; - buf_size--; - skipped++; - av_log(avctx, AV_LOG_ERROR, "Header missing skipping one byte.\n"); - goto retry; + av_log(avctx, AV_LOG_ERROR, "Header missing\n"); + return -1; } if (ff_mpegaudio_decode_header((MPADecodeHeader *)s, header) == 1) { @@ -2297,7 +2292,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 + skipped; + return buf_size; } static void flush(AVCodecContext *avctx){ |