From c8ced9f11d9194635f6ce09826736619ac42562b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kleines=20Filmr=C3=B6llchen?= Date: Mon, 5 Jul 2021 14:34:14 +0200 Subject: LibAudio: Improve latency on audio queue failures We don't know what is a good time to wait after an audio buffer fails to be processed by AudioServer. However, it seems like decreasing the wait time to 10ms after such a failure should improve latency and has not caused issues in my testing. After all, 10ms is quite some time in audio sample magnitudes. --- Userland/Libraries/LibAudio/ClientConnection.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Userland/Libraries/LibAudio') diff --git a/Userland/Libraries/LibAudio/ClientConnection.cpp b/Userland/Libraries/LibAudio/ClientConnection.cpp index 633b09c20f..b7875bc25e 100644 --- a/Userland/Libraries/LibAudio/ClientConnection.cpp +++ b/Userland/Libraries/LibAudio/ClientConnection.cpp @@ -20,7 +20,9 @@ void ClientConnection::enqueue(const Buffer& buffer) auto success = enqueue_buffer(buffer.anonymous_buffer(), buffer.id(), buffer.sample_count()); if (success) break; - usleep(100000); + // FIXME: We don't know what is a good value for this. + // For now, decrease it to enable better real-time audio. + usleep(10000); } } -- cgit v1.2.3