diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-07-28 21:27:18 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-07-28 21:34:47 +0200 |
commit | be31e2232cb2a62126ccef4be428eab7703eb617 (patch) | |
tree | 686dee2fc35b28b5899cea449c9aa1f5df2cbc51 /Libraries/LibAudio | |
parent | 66db6f4f925965c33bb8b27452c3c210f0b924ce (diff) | |
download | serenity-be31e2232cb2a62126ccef4be428eab7703eb617.zip |
AudioServer+LibAudio: Make mixing queue-based instead of buffer-based.
Each client connection now sets up an ASBufferQueue, which is basically a
queue of ABuffers. This allows us to immediately start streaming the next
pending buffer whenever our current buffer runs out of samples.
This makes the majority of the skippiness go away for me. :^)
Also get rid of the old PlayBuffer API, since we don't need it anymore.
Diffstat (limited to 'Libraries/LibAudio')
-rw-r--r-- | Libraries/LibAudio/AClientConnection.cpp | 10 | ||||
-rw-r--r-- | Libraries/LibAudio/AClientConnection.h | 1 | ||||
-rw-r--r-- | Libraries/LibAudio/ASAPI.h | 1 |
3 files changed, 0 insertions, 12 deletions
diff --git a/Libraries/LibAudio/AClientConnection.cpp b/Libraries/LibAudio/AClientConnection.cpp index abe9a307c4..d77a455c51 100644 --- a/Libraries/LibAudio/AClientConnection.cpp +++ b/Libraries/LibAudio/AClientConnection.cpp @@ -17,15 +17,6 @@ void AClientConnection::handshake() set_my_client_id(response.greeting.your_client_id); } -void AClientConnection::play(const ABuffer& buffer, bool block) -{ - const_cast<ABuffer&>(buffer).shared_buffer().share_with(server_pid()); - ASAPI_ClientMessage request; - request.type = ASAPI_ClientMessage::Type::PlayBuffer; - request.play_buffer.buffer_id = buffer.shared_buffer_id(); - sync_request(request, block ? ASAPI_ServerMessage::Type::FinishedPlayingBuffer : ASAPI_ServerMessage::Type::PlayingBuffer); -} - void AClientConnection::enqueue(const ABuffer& buffer) { for (;;) { @@ -36,7 +27,6 @@ void AClientConnection::enqueue(const ABuffer& buffer) auto response = sync_request(request, ASAPI_ServerMessage::Type::EnqueueBufferResponse); if (response.success) break; - dbg() << "EnqueueBuffer failed, retrying..."; sleep(1); } } diff --git a/Libraries/LibAudio/AClientConnection.h b/Libraries/LibAudio/AClientConnection.h index 2cc224353d..1a6c00abac 100644 --- a/Libraries/LibAudio/AClientConnection.h +++ b/Libraries/LibAudio/AClientConnection.h @@ -11,6 +11,5 @@ public: AClientConnection(); virtual void handshake() override; - void play(const ABuffer&, bool block); void enqueue(const ABuffer&); }; diff --git a/Libraries/LibAudio/ASAPI.h b/Libraries/LibAudio/ASAPI.h index 0dabd28c86..47da165de6 100644 --- a/Libraries/LibAudio/ASAPI.h +++ b/Libraries/LibAudio/ASAPI.h @@ -28,7 +28,6 @@ struct ASAPI_ClientMessage { enum class Type { Invalid, Greeting, - PlayBuffer, EnqueueBuffer, }; |