mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-07 08:29:58 +00:00
LibAudio: Don't assume that a non-full span means EOF
Especially if buffered streams are involved, not filling the span completely can also mean that we just ran out of filled buffer space and we need to refill it on the beginning of the next read call.
This commit is contained in:
parent
0cc151bc1c
commit
1caad457ef
|
@ -233,8 +233,7 @@ ErrorOr<MP3::MP3Frame, LoaderError> MP3LoaderPlugin::read_frame_data(MP3::Header
|
|||
auto& buffer = maybe_buffer.value();
|
||||
|
||||
size_t old_reservoir_size = m_bit_reservoir.size();
|
||||
if (LOADER_TRY(m_bitstream->read(buffer)).size() != buffer.size())
|
||||
return LoaderError { LoaderError::Category::IO, m_loaded_samples, "Could not find another whole frame." };
|
||||
LOADER_TRY(m_bitstream->read_entire_buffer(buffer));
|
||||
if (m_bit_reservoir.write(buffer) != header.slot_count)
|
||||
return LoaderError { LoaderError::Category::IO, m_loaded_samples, "Could not write frame into bit reservoir." };
|
||||
|
||||
|
|
Loading…
Reference in a new issue