Browse Source

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.
Ryan C. Gordon 6 months ago
parent
commit
b6d0bc0431
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/audio/coreaudio/SDL_coreaudio.m

+ 1 - 1
src/audio/coreaudio/SDL_coreaudio.m

@@ -817,7 +817,7 @@ static bool PrepareAudioQueue(SDL_AudioDevice *device)
     }
     }
     #endif
     #endif
 
 
-    int numAudioBuffers = 2;
+    int numAudioBuffers = 3;
     const double msecs = (device->sample_frames / ((double)device->spec.freq)) * 1000.0;
     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.
     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);
         numAudioBuffers = ((int)SDL_ceil(MINIMUM_AUDIO_BUFFER_TIME_MS / msecs) * 2);