MCPcopy Create free account
hub / github.com/FastLED/FastLED / fillBuffer

Method fillBuffer

src/fl/codec/mp3.cpp.hpp:225–248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

223}
224
225bool Mp3StreamDecoderImpl::fillBuffer() {
226 // Shift remaining data to beginning of buffer
227 if (mBufferPos > 0 && mBufferFilled > mBufferPos) {
228 fl::size remaining = mBufferFilled - mBufferPos;
229 for (fl::size i = 0; i < remaining; i++) {
230 mBuffer[i] = mBuffer[mBufferPos + i];
231 }
232 mBufferFilled = remaining;
233 mBufferPos = 0;
234 } else if (mBufferPos >= mBufferFilled) {
235 mBufferPos = 0;
236 mBufferFilled = 0;
237 }
238
239 // Fill the rest of the buffer from stream
240 fl::size spaceAvailable = BUFFER_SIZE - mBufferFilled;
241 if (spaceAvailable > 0 && mStream && mStream->available(1)) {
242 fl::size bytesRead = mStream->read(mBuffer.data() + mBufferFilled, spaceAvailable);
243 mBufferFilled += bytesRead;
244 return bytesRead > 0;
245 }
246
247 return mBufferFilled > mBufferPos;
248}
249
250bool Mp3StreamDecoderImpl::findAndDecodeFrame(audio::Sample* out_sample) {
251 if (!mDecoder) {

Callers

nothing calls this directly

Calls 3

availableMethod · 0.45
readMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected