summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibAudio
diff options
context:
space:
mode:
authorkleines Filmröllchen <malu.bertsch@gmail.com>2021-07-05 14:34:14 +0200
committerAndreas Kling <kling@serenityos.org>2021-07-05 19:33:55 +0200
commitc8ced9f11d9194635f6ce09826736619ac42562b (patch)
treebfd8c9eef96e531b425855950e69b2c80412d28a /Userland/Libraries/LibAudio
parent96155009ddd7bba924e1d8fde2d28b7e32896750 (diff)
downloadserenity-c8ced9f11d9194635f6ce09826736619ac42562b.zip
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.
Diffstat (limited to 'Userland/Libraries/LibAudio')
-rw-r--r--Userland/Libraries/LibAudio/ClientConnection.cpp4
1 files changed, 3 insertions, 1 deletions
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);
}
}