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

LibAudio: Remove an unnecessary copy of sample buffers before sending them.

I missed this earlier, but *now* we're actually using the same SharedBuffer
all the way from client-side WAV reading to server-side mixing. :^)
This commit is contained in:
Andreas Kling 2019-07-27 21:28:45 +02:00
parent b98c77229d
commit de3d1f2275
2 changed files with 3 additions and 10 deletions

View file

@ -19,17 +19,9 @@ void AClientConnection::handshake()
void AClientConnection::play(const ABuffer& buffer, bool block)
{
auto shared_buf = SharedBuffer::create_with_size(buffer.size_in_bytes());
if (!shared_buf) {
dbg() << "Failed to create a shared buffer!";
return;
}
memcpy(shared_buf->data(), buffer.data(), buffer.size_in_bytes());
shared_buf->seal();
shared_buf->share_with(server_pid());
const_cast<ABuffer&>(buffer).shared_buffer().share_with(server_pid());
ASAPI_ClientMessage request;
request.type = ASAPI_ClientMessage::Type::PlayBuffer;
request.play_buffer.buffer_id = shared_buf->shared_buffer_id();
request.play_buffer.buffer_id = buffer.shared_buffer_id();
sync_request(request, block ? ASAPI_ServerMessage::Type::FinishedPlayingBuffer : ASAPI_ServerMessage::Type::PlayingBuffer);
}