struct private_mp3dec_data *pmd = fn->private_data;
size_t copy = PARA_MIN(len, 4096);
- if (fn->loaded > fn->bufsize * 4 / 5)
+ if (fn->loaded + 16384 > fn->bufsize)
return 0;
mad_stream_buffer(&pmd->stream, (unsigned char *) inbuffer, copy);
pmd->stream.error = 0;
PARA_ERROR_LOG("output buffer full: %zd\n", fn->loaded);
return -E_MP3DEC_OVERRUN;
}
- if (fn->loaded <= fn->bufsize * 4 / 5)
+ if (fn->loaded + 16384 <= fn->bufsize)
goto next_frame;
out:
if (pmd->stream.next_frame) { /* we still have some data */