From: Andre Noll Date: Sat, 22 Nov 2008 20:37:34 +0000 (+0100) Subject: Better error diagnostics for the mp3 decoder. X-Git-Tag: v0.3.3~26 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=c6fad99cade79e647ca46432e07278a7ef3fbef1 Better error diagnostics for the mp3 decoder. --- diff --git a/mp3dec.c b/mp3dec.c index 763ca37f..615a0640 100644 --- a/mp3dec.c +++ b/mp3dec.c @@ -43,15 +43,25 @@ 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 (ret < 0) { + if (pmd->stream.error != MAD_ERROR_BUFLEN && + pmd->stream.error != MAD_ERROR_LOSTSYNC) + PARA_DEBUG_LOG("header decode: %s\n", + mad_stream_errorstr(&pmd->stream)); 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); if (ret) { - if (MAD_RECOVERABLE(pmd->stream.error) || pmd->stream.error == MAD_ERROR_BUFLEN) + if (MAD_RECOVERABLE(pmd->stream.error) || + pmd->stream.error == MAD_ERROR_BUFLEN) { + PARA_DEBUG_LOG("frame decode: %s\n", + mad_stream_errorstr(&pmd->stream)); goto out; - PARA_ERROR_LOG("fatal: ret = %d, loaded = %zd\n", ret, fn->loaded); + } + PARA_ERROR_LOG("frame decode: %s\n", + mad_stream_errorstr(&pmd->stream)); return -E_MAD_FRAME_DECODE; } mad_synth_frame(&pmd->synth, &pmd->frame);