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
commit 7a92842017
Notes: sideshowbarker 2024-07-17 20:29:54 +09:00

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;
}