From b2d860382fd6ccefe85c45343da622ffbed8b3fa Mon Sep 17 00:00:00 2001 From: shuax <6940583+shuax@users.noreply.github.com> Date: Wed, 31 May 2023 03:26:33 +0000 Subject: [PATCH] Fix stream offset on audio buffer underflow The `read` variable is in number of samples, while the offset must be in bytes. PR #4045 Signed-off-by: Romain Vimont --- app/src/audio_player.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/audio_player.c b/app/src/audio_player.c index a0c52c62..8f0ad7fb 100644 --- a/app/src/audio_player.c +++ b/app/src/audio_player.c @@ -107,7 +107,7 @@ sc_audio_player_sdl_callback(void *userdata, uint8_t *stream, int len_int) { // latency. LOGD("[Audio] Buffer underflow, inserting silence: %" PRIu32 " samples", silence); - memset(stream + read, 0, TO_BYTES(silence)); + memset(stream + TO_BYTES(read), 0, TO_BYTES(silence)); if (ap->received) { // Inserting additional samples immediately increases buffering