Skip to content

Commit

Permalink
coreaudio: Use three buffers for the audioqueue, not two.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
icculus committed Jan 20, 2025
1 parent aa10e51 commit b6d0bc0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/audio/coreaudio/SDL_coreaudio.m
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b6d0bc0

Please sign in to comment.