mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-28 10:14:14 +00:00
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.
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user