Merge pull request #6305 from jepler/fix-audacity-mp3
Fix audacity mp3 (erroneous EOF detected)
This commit is contained in:
commit
66749accc4
@ -53,7 +53,7 @@
|
|||||||
*/
|
*/
|
||||||
STATIC bool mp3file_update_inbuf_always(audiomp3_mp3file_obj_t *self) {
|
STATIC bool mp3file_update_inbuf_always(audiomp3_mp3file_obj_t *self) {
|
||||||
// If we didn't previously reach the end of file, we can try reading now
|
// If we didn't previously reach the end of file, we can try reading now
|
||||||
if (!self->eof) {
|
if (!self->eof && self->inbuf_offset != 0) {
|
||||||
|
|
||||||
// Move the unconsumed portion of the buffer to the start
|
// Move the unconsumed portion of the buffer to the start
|
||||||
uint8_t *end_of_buffer = self->inbuf + self->inbuf_length;
|
uint8_t *end_of_buffer = self->inbuf + self->inbuf_length;
|
||||||
@ -356,6 +356,11 @@ audioio_get_buffer_result_t audiomp3_mp3file_get_buffer(audiomp3_mp3file_obj_t *
|
|||||||
return GET_BUFFER_DONE;
|
return GET_BUFFER_DONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self->samples_decoded += *buffer_length / sizeof(int16_t);
|
||||||
|
|
||||||
|
mp3file_skip_id3v2(self);
|
||||||
|
int result = mp3file_find_sync_word(self) ? GET_BUFFER_MORE_DATA : GET_BUFFER_DONE;
|
||||||
|
|
||||||
if (self->inbuf_offset >= 512) {
|
if (self->inbuf_offset >= 512) {
|
||||||
background_callback_add(
|
background_callback_add(
|
||||||
&self->inbuf_fill_cb,
|
&self->inbuf_fill_cb,
|
||||||
@ -363,8 +368,7 @@ audioio_get_buffer_result_t audiomp3_mp3file_get_buffer(audiomp3_mp3file_obj_t *
|
|||||||
self);
|
self);
|
||||||
}
|
}
|
||||||
|
|
||||||
self->samples_decoded += *buffer_length / sizeof(int16_t);
|
return result;
|
||||||
return mp3file_find_sync_word(self) ? GET_BUFFER_MORE_DATA : GET_BUFFER_DONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void audiomp3_mp3file_get_buffer_structure(audiomp3_mp3file_obj_t *self, bool single_channel_output,
|
void audiomp3_mp3file_get_buffer_structure(audiomp3_mp3file_obj_t *self, bool single_channel_output,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user