From 877be0eb437408e40fb1188318a4382d59f11dc1 Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Thu, 12 Jan 2023 16:29:59 +0100 Subject: [PATCH] SoundPlayer: Don't silently ignore parsing failures If we failed to decode a sample we'd presumably want to tell the user, and we definitely don't want to just go into another round of decoding somewhere in the middle of a broken sample. --- .../SoundPlayer/PlaybackManager.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Userland/Applications/SoundPlayer/PlaybackManager.cpp b/Userland/Applications/SoundPlayer/PlaybackManager.cpp index bf7a00c1a4..6ff75ec624 100644 --- a/Userland/Applications/SoundPlayer/PlaybackManager.cpp +++ b/Userland/Applications/SoundPlayer/PlaybackManager.cpp @@ -114,15 +114,14 @@ void PlaybackManager::next_buffer() return; } - auto maybe_buffer = m_loader->get_more_samples(m_samples_to_load_per_buffer); - if (!maybe_buffer.is_error()) { - m_current_buffer.swap(maybe_buffer.value()); - VERIFY(m_resampler.has_value()); - m_resampler->reset(); - // FIXME: Handle OOM better. - auto resampled = MUST(FixedArray::try_create(m_resampler->resample(move(m_current_buffer)).span())); - m_current_buffer.swap(resampled); - MUST(m_connection->async_enqueue(m_current_buffer)); - } + // 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(); + m_current_buffer.swap(buffer); + VERIFY(m_resampler.has_value()); + m_resampler->reset(); + // FIXME: Handle OOM better. + auto resampled = MUST(FixedArray::try_create(m_resampler->resample(move(m_current_buffer)).span())); + m_current_buffer.swap(resampled); + MUST(m_connection->async_enqueue(m_current_buffer)); } }