From 071bebf235955ae0fdfcce53e0203f34ed83a193 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Mon, 20 Jan 2025 23:29:53 -0500
Subject: [PATCH] coreaudio: Add a note about why this uses 3 buffers instead
of 2.
---
src/audio/coreaudio/SDL_coreaudio.m | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/audio/coreaudio/SDL_coreaudio.m b/src/audio/coreaudio/SDL_coreaudio.m
index af54bebcce91d..cfa0616da1800 100644
--- a/src/audio/coreaudio/SDL_coreaudio.m
+++ b/src/audio/coreaudio/SDL_coreaudio.m
@@ -817,6 +817,10 @@ static bool PrepareAudioQueue(SDL_AudioDevice *device)
}
#endif
+ // we use THREE audio buffers by default, unlike most things that would
+ // choose two alternating buffers, because it helps with issues on
+ // Bluetooth headsets when recording and playing at the same time.
+ // See conversation in #8192 for details.
int numAudioBuffers = 3;
const double msecs = (device->sample_frames / ((double)device->spec.freq)) * 1000.0;
if (msecs < MINIMUM_AUDIO_BUFFER_TIME_MS) { // use more buffers if we have a VERY small sample set.