From: Andre Date: Sat, 4 Nov 2006 13:59:40 +0000 (+0100) Subject: fix handling of corrupt mp3 files X-Git-Tag: v0.2.15~127 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=66445ee977f7f65604f16c9b78454da7456bb865;ds=sidebyside fix handling of corrupt mp3 files When a recoverable error occured we always returned FRAME_HEADER_SIZE in mp3dec, which is clearly wrong if the error did not happen in the first frame. Fix is not to distinguish between recoverable and unrecoverable errors which even simplifies the code a bit. --- diff --git a/mp3dec.c b/mp3dec.c index fc2b9d8c..1818d4c0 100644 --- a/mp3dec.c +++ b/mp3dec.c @@ -49,7 +49,6 @@ struct private_mp3dec_data { }; /* TODO: Convert all input if possible */ -#define FRAME_HEADER_SIZE 4 static ssize_t mp3dec(char *inbuffer, size_t len, struct filter_node *fn) { int i, ret; @@ -62,11 +61,8 @@ static ssize_t mp3dec(char *inbuffer, size_t len, struct filter_node *fn) pmd->stream.error = 0; next_frame: ret = mad_header_decode(&pmd->frame.header, &pmd->stream); - if (ret < 0) { - if (!MAD_RECOVERABLE(pmd->stream.error)) - goto out; - return FRAME_HEADER_SIZE; - } + if (ret < 0) + goto out; fn->fc->samplerate = pmd->frame.header.samplerate; fn->fc->channels = MAD_NCHANNELS(&pmd->frame.header); ret = mad_frame_decode(&pmd->frame, &pmd->stream);