int i, ret;
struct private_mp3dec_data *pmd = fn->private_data;
struct btr_node *btrn = fn->btrn;
- size_t loaded, used, len, iqs;
+ size_t loaded = 0, used, len, iqs;
char *inbuffer, *outbuffer;
next_buffer:
goto err;
}
fn->min_iqs += 100;
+ }
+ if (loaded == 0)
goto next_buffer;
- } else if (pmd->stream.error != MAD_ERROR_LOSTSYNC)
- PARA_DEBUG_LOG("header decode: %s\n",
- mad_stream_errorstr(&pmd->stream));
- goto next_buffer;
+ return;
}
fn->min_iqs = 0;
pmd->sample_rate = pmd->frame.header.samplerate;
pmd->channels = MAD_NCHANNELS(&pmd->frame.header);
+decode:
ret = mad_frame_decode(&pmd->frame, &pmd->stream);
if (ret != 0) {
- PARA_INFO_LOG("frame decode: %s\n", mad_stream_errorstr(&pmd->stream));
- used = used_mad_buffer_bytes(&pmd->stream, len);
ret = handle_decode_error(pmd);
- btr_consume(btrn, used);
if (ret < 0)
goto err;
- if (ret == 0)
- goto next_buffer;
+ mad_stream_sync(&pmd->stream);
+ if (pmd->stream.error == MAD_ERROR_BUFLEN)
+ return;
+ if (pmd->stream.error != MAD_ERROR_BADDATAPTR)
+ goto decode;
+ used = used_mad_buffer_bytes(&pmd->stream, len);
+ btr_consume(btrn, used);
return;
}
mad_synth_frame(&pmd->synth, &pmd->frame);