Fix stream offset on audio buffer underflow

The `read` variable is in number of samples, while the offset must be in
bytes.

PR #4045 <https://github.com/Genymobile/scrcpy/pull/4045>

Signed-off-by: Romain Vimont <rom@rom1v.com>
This commit is contained in:
shuax 2023-05-31 03:26:33 +00:00 committed by Romain Vimont
parent 4c4a03ebe1
commit b2d860382f
1 changed files with 1 additions and 1 deletions

View File

@ -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