Fixed audio dropouts when plenty of audio is queued on Android

This commit is contained in:
Sam Lantinga
2024-11-07 19:29:51 -08:00
parent 37b49c98dc
commit 54ff1f35bd

View File

@@ -355,8 +355,9 @@ static bool BuildAAudioStream(SDL_AudioDevice *device)
SDL_UpdatedAudioDeviceFormat(device);
// Allocate a double buffered mixing buffer
hidden->num_buffers = 2;
// Allocate a triple buffered mixing buffer
// Two buffers can be in the process of being filled while the third is being read
hidden->num_buffers = 3;
hidden->mixbuf_bytes = (hidden->num_buffers * device->buffer_size);
hidden->mixbuf = (Uint8 *)SDL_aligned_alloc(SDL_GetSIMDAlignment(), hidden->mixbuf_bytes);
if (!hidden->mixbuf) {