mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-17 16:28:06 +03:00
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.
This commit is contained in:
parent
1caad457ef
commit
877be0eb43
Notes:
sideshowbarker
2024-07-18 02:13:10 +09:00
Author: https://github.com/timschumi Commit: https://github.com/SerenityOS/serenity/commit/877be0eb43 Pull-request: https://github.com/SerenityOS/serenity/pull/16974 Reviewed-by: https://github.com/gmta ✅
@ -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));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user