1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 12:37:44 +00:00

LibAudio: Sleep less when the audio buffer is full

When using `aplay` to play audio files with a sample rate of 96000,
there were occasional one-second gaps in playback. This is
because the Audio::ClientConnection sleeps for a full second when
the audio buffer is full.

One second is too long to sleep, especially for high-bitrate files.
Changing the sleep to a more reasonable value like 100 ms ensures
we attempt to enqueue again before the audio buffer runs empty.
This commit is contained in:
Nick Miller 2021-06-12 11:54:46 -07:00 committed by Ali Mohammad Pur
parent dec9ed066d
commit 34a3d08e65

View file

@ -20,7 +20,7 @@ void ClientConnection::enqueue(const Buffer& buffer)
auto success = enqueue_buffer(buffer.anonymous_buffer(), buffer.id(), buffer.sample_count());
if (success)
break;
sleep(1);
sleep(.1);
}
}