1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:17:35 +00:00

LibCore: Populate the read buffer of Core::Stream::BufferedHelper

Previously, we weren't ever populating the read buffer in read(), which
was making the BufferedHelper useless, how silly :^). This introduces
a buffer refill when we have run out of buffered samples, restoring
FlacLoader performance from the new low of 200% (directly before this
commit) to the old level of ~1400%.
This commit is contained in:
kleines Filmröllchen 2022-01-14 01:14:24 +01:00 committed by Ali Mohammad Pur
parent 8a92573732
commit 7a92842017

View file

@ -522,6 +522,11 @@ public:
// Otherwise, let's try an extra read just in case there's something
// in our receive buffer.
auto stream_nread = TRY(stream().read(buffer.slice(buffer_nread)));
// Fill the internal buffer if it has run dry.
if (m_buffered_size == 0)
TRY(populate_read_buffer());
return buffer_nread + stream_nread;
}