From 42e118e6a92e22b43a350e9ee10fe1a3f377343b Mon Sep 17 00:00:00 2001 From: Joel Petersson Date: Tue, 2 May 2023 22:36:14 +0200 Subject: AudioServer: Dequeue all buffers when clearing a ClientAudioStream Previously we would exit the dequeuing loop after just one buffer had been dequeued due to some bogus logic. This would manifest when stopping and starting a track in SoundPlayer, where a few miliseconds of 'old' audio would play when restarting the playback. This commit makes sure we clear the entire queue. --- Userland/Services/AudioServer/Mixer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Userland/Services') diff --git a/Userland/Services/AudioServer/Mixer.h b/Userland/Services/AudioServer/Mixer.h index e13ae76b2a..f80608f6c1 100644 --- a/Userland/Services/AudioServer/Mixer.h +++ b/Userland/Services/AudioServer/Mixer.h @@ -78,7 +78,7 @@ public: ErrorOr, Audio::AudioQueue::QueueStatus> result = Audio::AudioQueue::QueueStatus::Invalid; do { result = m_buffer->dequeue(); - } while (result.is_error() && result.error() != Audio::AudioQueue::QueueStatus::Empty); + } while (!result.is_error() || result.error() != Audio::AudioQueue::QueueStatus::Empty); } void set_paused(bool paused) { m_paused = paused; } -- cgit v1.2.3