Bug Fix: Retry MP3 file a few times before failure
Some checks failed
Check if Cog buildable / Build Universal Cog.app (push) Has been cancelled
Some checks failed
Check if Cog buildable / Build Universal Cog.app (push) Has been cancelled
Give up after 10 tries. Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
parent
2038a140ed
commit
f7b2c481e6
1 changed files with 5 additions and 1 deletions
|
@ -146,7 +146,11 @@ static int mp3_seek_callback(uint64_t position, void *user_data) {
|
||||||
_decoder_ex.samples = (totalFrames + _startPadding + _endPadding) * _decoder_ex.info.channels;
|
_decoder_ex.samples = (totalFrames + _startPadding + _endPadding) * _decoder_ex.info.channels;
|
||||||
}
|
}
|
||||||
mp3d_sample_t *sample_ptr = NULL;
|
mp3d_sample_t *sample_ptr = NULL;
|
||||||
size_t samples = mp3dec_ex_read_frame(&_decoder_ex, &sample_ptr, &_decoder_info, MINIMP3_MAX_SAMPLES_PER_FRAME);
|
size_t samples = 0;
|
||||||
|
int retry = 10;
|
||||||
|
do {
|
||||||
|
samples = mp3dec_ex_read_frame(&_decoder_ex, &sample_ptr, &_decoder_info, MINIMP3_MAX_SAMPLES_PER_FRAME);
|
||||||
|
} while(!samples && --retry > 0);
|
||||||
if(samples && sample_ptr) {
|
if(samples && sample_ptr) {
|
||||||
samples_filled = samples / _decoder_info.channels;
|
samples_filled = samples / _decoder_info.channels;
|
||||||
memcpy(&_decoder_buffer_output[0], sample_ptr, sizeof(mp3d_sample_t) * samples);
|
memcpy(&_decoder_buffer_output[0], sample_ptr, sizeof(mp3d_sample_t) * samples);
|
||||||
|
|
Loading…
Reference in a new issue