diff options
author | Joel Petersson <joel.anders.petersson@gmail.com> | 2023-05-02 22:36:14 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-05-03 10:01:14 +0200 |
commit | 42e118e6a92e22b43a350e9ee10fe1a3f377343b (patch) | |
tree | 8023d35f42c91665cf1b3429a6d5d37c5c9ea2ba /Userland/Services | |
parent | 23bc306f9918e5852c9a736cd5820e033dff2f13 (diff) | |
download | serenity-42e118e6a92e22b43a350e9ee10fe1a3f377343b.zip |
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.
Diffstat (limited to 'Userland/Services')
-rw-r--r-- | Userland/Services/AudioServer/Mixer.h | 2 |
1 files changed, 1 insertions, 1 deletions
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<Array<Audio::Sample, Audio::AUDIO_BUFFER_SIZE>, 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; } |