mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-04 16:46:08 +00:00
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) :^)
This commit is contained in:
parent
cbb6f8de65
commit
f7fe9e3355
Notes:
sideshowbarker
2024-07-17 01:34:21 +09:00
Author: https://github.com/kuzux
Commit: f7fe9e3355
Pull-request: https://github.com/SerenityOS/serenity/pull/17047
Reviewed-by: https://github.com/gmta
Reviewed-by: https://github.com/timschumi
1 changed files with 8 additions and 2 deletions
|
@ -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()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue