mirror of
https://github.com/RGBCube/serenity
synced 2025-07-08 06:27:35 +00:00
Audio: Fix code smells and issues found by static analysis
This fixes all current code smells, bugs and issues reported by SonarCloud static analysis. Other issues are almost exclusively false positives. This makes much code clearer, and some minor benefits in performance or bug evasion may be gained.
This commit is contained in:
parent
a757f3f421
commit
8af97d0ce7
12 changed files with 99 additions and 77 deletions
|
@ -6,9 +6,14 @@
|
|||
|
||||
#include <LibAudio/Buffer.h>
|
||||
#include <LibAudio/ClientConnection.h>
|
||||
#include <time.h>
|
||||
|
||||
namespace Audio {
|
||||
|
||||
// FIXME: We don't know what is a good value for this.
|
||||
// Real-time audio may be improved with a lower value.
|
||||
static timespec g_enqueue_wait_time { 0, 10'000'000 };
|
||||
|
||||
ClientConnection::ClientConnection()
|
||||
: IPC::ServerConnection<AudioClientEndpoint, AudioServerEndpoint>(*this, "/tmp/portal/audio")
|
||||
{
|
||||
|
@ -20,9 +25,7 @@ void ClientConnection::enqueue(Buffer const& buffer)
|
|||
auto success = enqueue_buffer(buffer.anonymous_buffer(), buffer.id(), buffer.sample_count());
|
||||
if (success)
|
||||
break;
|
||||
// FIXME: We don't know what is a good value for this.
|
||||
// For now, decrease it to enable better real-time audio.
|
||||
usleep(10000);
|
||||
nanosleep(&g_enqueue_wait_time, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue