Commit 7d8583b1 authored by michael's avatar michael

Drop code that attempts to decode frames that are prefixed by junk,

it does too often end up decoding random data into noise without
detecting it. (for example after seeking of some mp3 data with oddly
often occuring startcode emulation)
fixes issue1154.


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@19302 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent c9acea42
...@@ -2255,20 +2255,15 @@ static int decode_frame(AVCodecContext * avctx, ...@@ -2255,20 +2255,15 @@ static int decode_frame(AVCodecContext * avctx,
MPADecodeContext *s = avctx->priv_data; MPADecodeContext *s = avctx->priv_data;
uint32_t header; uint32_t header;
int out_size; int out_size;
int skipped = 0;
OUT_INT *out_samples = data; OUT_INT *out_samples = data;
retry:
if(buf_size < HEADER_SIZE) if(buf_size < HEADER_SIZE)
return -1; return -1;
header = AV_RB32(buf); header = AV_RB32(buf);
if(ff_mpa_check_header(header) < 0){ if(ff_mpa_check_header(header) < 0){
buf++; av_log(avctx, AV_LOG_ERROR, "Header missing\n");
buf_size--; return -1;
skipped++;
av_log(avctx, AV_LOG_ERROR, "Header missing skipping one byte.\n");
goto retry;
} }
if (ff_mpegaudio_decode_header((MPADecodeHeader *)s, header) == 1) { if (ff_mpegaudio_decode_header((MPADecodeHeader *)s, header) == 1) {
...@@ -2297,7 +2292,7 @@ retry: ...@@ -2297,7 +2292,7 @@ retry:
}else }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 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; s->frame_size = 0;
return buf_size + skipped; return buf_size;
} }
static void flush(AVCodecContext *avctx){ static void flush(AVCodecContext *avctx){
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment