瀏覽代碼

pulseaudio: Just feed the device whenever it asks for any amount of data.

In practice, this seems to buffer a little upfront and then gives a pretty
consistent request flow after that of 1/4 of the requested buffer size without
variation, which is significantly better than the previous code that would
vary a little each frame.

Plus, as long as the device asks for _anything_, we won't block forever, and
if it asks for more than our expected buffer size, we'll run multiple times
to satisfy it, so this is likely more robust against dropouts in general, too.
Ryan C. Gordon 2 年之前
父節點
當前提交
61e9a9dd56
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/audio/pulseaudio/SDL_pulseaudio.c

+ 1 - 1
src/audio/pulseaudio/SDL_pulseaudio.c

@@ -402,7 +402,7 @@ static void PULSEAUDIO_WaitDevice(SDL_AudioDevice *device)
 
     PULSEAUDIO_pa_threaded_mainloop_lock(pulseaudio_threaded_mainloop);
 
-    while (!SDL_AtomicGet(&device->shutdown) && (h->bytes_requested < (device->buffer_size / 4))) {
+    while (!SDL_AtomicGet(&device->shutdown) && (h->bytes_requested == 0)) {
         /*printf("PULSEAUDIO WAIT IN WAITDEVICE!\n");*/
         PULSEAUDIO_pa_threaded_mainloop_wait(pulseaudio_threaded_mainloop);