summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Schumacher <timschumi@gmx.de>2023-01-12 16:29:59 +0100
committerJelle Raaijmakers <jelle@gmta.nl>2023-01-12 16:52:34 +0100
commit877be0eb437408e40fb1188318a4382d59f11dc1 (patch)
treeaf819045d6741fbc4e777ed66fe4a529cd9a67c6
parent1caad457efb9edca2c6dec22508963deec67d2fe (diff)
downloadserenity-877be0eb437408e40fb1188318a4382d59f11dc1.zip
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.
-rw-r--r--Userland/Applications/SoundPlayer/PlaybackManager.cpp19
1 files 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<Audio::Sample>::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<Audio::Sample>::try_create(m_resampler->resample(move(m_current_buffer)).span()));
+ m_current_buffer.swap(resampled);
+ MUST(m_connection->async_enqueue(m_current_buffer));
}
}