mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-28 13:43:45 +03:00
Piano: Increase AudioPlayerLoop resilience against scheduling weirdness
This is a temporary fix until we move AudioPlayerLoop to direct buffer enqueuing.
This commit is contained in:
parent
4941cffdd0
commit
3123753e6b
Notes:
sideshowbarker
2024-07-17 21:16:31 +09:00
Author: https://github.com/kleinesfilmroellchen Commit: https://github.com/SerenityOS/serenity/commit/3123753e6b Pull-request: https://github.com/SerenityOS/serenity/pull/14424 Reviewed-by: https://github.com/linusg Reviewed-by: https://github.com/sin-ack ✅
@ -31,12 +31,12 @@ AudioPlayerLoop::AudioPlayerLoop(TrackManager& track_manager, bool& need_to_writ
|
||||
// FIXME: I said I would never write such a hack again, but here we are.
|
||||
// This code should die as soon as possible anyways, so it doesn't matter.
|
||||
// Please don't use this as an example to write good audio code; it's just here as a temporary hack.
|
||||
Core::EventLoop::register_timer(*this, 10, true, Core::TimerShouldFireWhenNotVisible::Yes);
|
||||
Core::EventLoop::register_timer(*this, 5, true, Core::TimerShouldFireWhenNotVisible::Yes);
|
||||
}
|
||||
|
||||
void AudioPlayerLoop::timer_event(Core::TimerEvent&)
|
||||
{
|
||||
if (m_audio_client->remaining_samples() < sample_count)
|
||||
while (m_audio_client->remaining_samples() < sample_count)
|
||||
enqueue_audio();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user