Skip to content

Commit

Permalink
Fix stream offset on audio buffer underflow
Browse files Browse the repository at this point in the history
The `read` variable is in number of samples, while the offset must be in
bytes.

PR #4045 <#4045>

Signed-off-by: Romain Vimont <rom@rom1v.com>
  • Loading branch information
shuax authored and rom1v committed May 31, 2023
1 parent 4c4a03e commit b2d8603
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/src/audio_player.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b2d8603

Please sign in to comment.