mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 10:17:35 +00:00
LibAudio: Fixed stuttery playback of audio
When playing an ABuffer, the count of samples were determined by the size of the SharedBuffer. This caused small pauses of up to 512 samples during the playback, when the size of the shared buffer was rounded up to a multiple of 4096. This problem was amplified by the fact that the AResampleHelper was created every time a new chunk of audio was to be processed, causing inconsistencies in the playback of wav files.
This commit is contained in:
parent
7e97e1c5d9
commit
4c8341d080
6 changed files with 78 additions and 62 deletions
|
@ -68,6 +68,6 @@ OwnPtr<AudioServer::EnqueueBufferResponse> ASClientConnection::handle(const Audi
|
|||
if (m_queue->is_full())
|
||||
return make<AudioServer::EnqueueBufferResponse>(false);
|
||||
|
||||
m_queue->enqueue(ABuffer::create_with_shared_buffer(*shared_buffer));
|
||||
m_queue->enqueue(ABuffer::create_with_shared_buffer(*shared_buffer, message.sample_count()));
|
||||
return make<AudioServer::EnqueueBufferResponse>(true);
|
||||
}
|
||||
|
|
|
@ -8,5 +8,5 @@ endpoint AudioServer
|
|||
SetMainMixVolume(i32 volume) => ()
|
||||
|
||||
// Buffer playback
|
||||
EnqueueBuffer(i32 buffer_id) => (bool success)
|
||||
EnqueueBuffer(i32 buffer_id, int sample_count) => (bool success)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue