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

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.
This commit is contained in:
Joel Petersson 2023-05-02 22:36:14 +02:00 committed by Andreas Kling
parent 23bc306f99
commit 42e118e6a9

View file

@ -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; }