diff options
author | Arda Cinar <kuzux92@gmail.com> | 2023-01-16 22:48:37 +0300 |
---|---|---|
committer | Jelle Raaijmakers <jelle@gmta.nl> | 2023-01-18 10:44:19 +0100 |
commit | f7fe9e33557d2d28e5f533988af3abd3f653e294 (patch) | |
tree | f7c53a97297cf5af0d4b2c72277f80b6da3c7578 /Userland | |
parent | cbb6f8de656607c8e077739a299e99790c0b131b (diff) | |
download | serenity-f7fe9e33557d2d28e5f533988af3abd3f653e294.zip |
SoundPlayer: Log loader errors and otherwise ignore them for now
Playback can resume after encountering loader errors (though not
always). Ideally, these should be visible to the user and the loader
state should be reset after encountering such errors. This patch
also has the side effect of not crashing on seek when playing MP3 files
(However, it still does not seek to the correct location) :^)
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Applications/SoundPlayer/PlaybackManager.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Userland/Applications/SoundPlayer/PlaybackManager.cpp b/Userland/Applications/SoundPlayer/PlaybackManager.cpp index 6ff75ec624..89aa11fc48 100644 --- a/Userland/Applications/SoundPlayer/PlaybackManager.cpp +++ b/Userland/Applications/SoundPlayer/PlaybackManager.cpp @@ -114,10 +114,16 @@ void PlaybackManager::next_buffer() return; } - // FIXME: This should handle parsing failures gracefully and show them to the user. - auto buffer = m_loader->get_more_samples(m_samples_to_load_per_buffer).release_value(); + auto buffer_or_error = m_loader->get_more_samples(m_samples_to_load_per_buffer); + if (buffer_or_error.is_error()) { + // FIXME: These errors should be shown to the user instead of being logged and then ignored + dbgln("Error while loading samples: {}", buffer_or_error.error().description); + return; + } + auto buffer = buffer_or_error.release_value(); m_current_buffer.swap(buffer); VERIFY(m_resampler.has_value()); + m_resampler->reset(); // FIXME: Handle OOM better. auto resampled = MUST(FixedArray<Audio::Sample>::try_create(m_resampler->resample(move(m_current_buffer)).span())); |