From 41636959d2652068f2a676464b3cf3f47316a33d Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 24 Mar 2025 19:32:52 -0400 Subject: [PATCH] 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. --- src/audio/SDL_audio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index 583a159110..cf817e4f19 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -1256,11 +1256,11 @@ static int SDLCALL PlaybackAudioThread(void *devicep) // thread entry point SDL_assert(!device->recording); SDL_PlaybackAudioThreadSetup(device); - do { + while (SDL_PlaybackAudioThreadIterate(device)) { if (!device->WaitDevice(device)) { 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); return 0;