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

AudioServer: Let ASMixer notify ASClientConnection about finished buffers.

Instead of posting a message directly from ASMixer, notify the client via
ASClientConnection::did_finish_playing_buffer().
This commit is contained in:
Andreas Kling 2019-07-27 21:15:33 +02:00
parent dbebf10131
commit 6a0319697c
3 changed files with 17 additions and 13 deletions

View file

@ -1,7 +1,6 @@
#include <AK/BufferStream.h>
#include <AudioServer/ASClientConnection.h>
#include <AudioServer/ASMixer.h>
#include <LibAudio/ASAPI.h>
#include <LibCore/CThread.h>
#include <limits>
@ -78,12 +77,8 @@ void ASMixer::mix()
// clear it later
if (buffer.pos == sample_count) {
if (buffer.m_client) {
ASAPI_ServerMessage reply;
reply.type = ASAPI_ServerMessage::Type::FinishedPlayingBuffer;
reply.playing_buffer.buffer_id = buffer.buffer->shared_buffer_id();
buffer.m_client->post_message(reply);
}
if (buffer.m_client)
buffer.m_client->did_finish_playing_buffer({}, buffer.buffer->shared_buffer_id());
buffer.done = true;
}
}