瀏覽代碼

audio: Feed output devices immediately, instead of waiting upfront.

This prevents the waste of an initial buffer of audio on many backends, and is
hopefully harmless on all of them.

Reference PR #12632.
Ryan C. Gordon 1 年之前
父節點
當前提交
41636959d2
共有 1 個文件被更改,包括 2 次插入 和 2 次删除
  1. 2 2
      src/audio/SDL_audio.c

+ 2 - 2
src/audio/SDL_audio.c

@@ -1256,11 +1256,11 @@ static int SDLCALL PlaybackAudioThread(void *devicep)  // thread entry point
     SDL_assert(!device->recording);
     SDL_assert(!device->recording);
     SDL_PlaybackAudioThreadSetup(device);
     SDL_PlaybackAudioThreadSetup(device);
 
 
-    do {
+    while (SDL_PlaybackAudioThreadIterate(device)) {
         if (!device->WaitDevice(device)) {
         if (!device->WaitDevice(device)) {
             SDL_AudioDeviceDisconnected(device);  // doh. (but don't break out of the loop, just be a zombie for now!)
             SDL_AudioDeviceDisconnected(device);  // doh. (but don't break out of the loop, just be a zombie for now!)
         }
         }
-    } while (SDL_PlaybackAudioThreadIterate(device));
+    }
 
 
     SDL_PlaybackAudioThreadShutdown(device);
     SDL_PlaybackAudioThreadShutdown(device);
     return 0;
     return 0;