FastLED 3.10.8
Loading...
Searching...
No Matches

◆ decodeNextFrame()

bool fl::third_party::Mp3StreamDecoderImpl::decodeNextFrame ( audio::Sample * out_sample)

Definition at line 548 of file mp3.cpp.hpp.

548 {
549 if (!isReady()) {
550 mErrorMsg = "Decoder not ready";
551 mHasError = true;
552 return false;
553 }
554
555 if (mEndOfStream) {
556 return false;
557 }
558
559 while (true) {
560 const fl::size previous_position = mBufferPos;
561 if (findAndDecodeFrame(out_sample)) {
562 return true;
563 }
564
565 if (mBufferPos > previous_position) {
566 // The decoder rejected or skipped bytes. Retry the remainder before
567 // refilling so a valid frame after corruption is not discarded.
568 continue;
569 }
570
571 if (fillBuffer()) {
572 continue;
573 }
574
576 // No more bytes are available to complete the current candidate.
577 // Advance through the tail so a later sync can still be recovered.
578 ++mBufferPos;
580 continue;
581 }
582
583 mEndOfStream = true;
584 return false;
585 }
586}
bool isReady() const FL_NO_EXCEPT
Definition mp3.cpp.hpp:274
bool findAndDecodeFrame(audio::Sample *out_sample) FL_NO_EXCEPT
Definition mp3.cpp.hpp:425

References fillBuffer(), findAndDecodeFrame(), fl::FL_NO_EXCEPT, isReady(), mBufferFilled, mBufferPos, mBytesProcessed, mEndOfStream, mErrorMsg, and mHasError.

+ Here is the call graph for this function: