mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-30 11:14:21 +00:00
coreaudio: Use three buffers for the audioqueue, not two.
This doesn't affect latency much, but it makes the system usable if the system drops you down from the bluetooth a2dp profile (headphones) to the handsfree (I think...?) profile because the bluetooth audio device is also recording, which would be extremely common in a VoIP app, but also if you're talking in a different app while also playing audio. Fixes #8192.
This commit is contained in:
@@ -817,7 +817,7 @@ static bool PrepareAudioQueue(SDL_AudioDevice *device)
|
||||
}
|
||||
#endif
|
||||
|
||||
int numAudioBuffers = 2;
|
||||
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.
|
||||
numAudioBuffers = ((int)SDL_ceil(MINIMUM_AUDIO_BUFFER_TIME_MS / msecs) * 2);
|
||||
|
||||
Reference in New Issue
Block a user