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);