Skip to content

Use sample number from FLAC frame header and seek fix - #962

Open
sbooth wants to merge 3 commits into
mainfrom
flac-decoder-fix
Open

Use sample number from FLAC frame header and seek fix#962
sbooth wants to merge 3 commits into
mainfrom
flac-decoder-fix

Conversation

@sbooth

@sbooth sbooth commented Jul 27, 2026

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings July 27, 2026 23:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the FLAC decoder’s internal frame-position tracking to use the sample number reported by libFLAC’s frame header, and adjusts buffering behavior around seeks to avoid dropping audio produced during FLAC__stream_decoder_seek_absolute().

Changes:

  • Simplifies the decode loop and updates _framePosition incrementally as frames are appended to the output buffer.
  • Clears internal buffers before issuing a libFLAC seek request to preserve any audio produced during the seek.
  • Sets _framePosition from frame->header.number.sample_number in the FLAC write callback (debug-asserting the expected header number type).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Sources/CSFBAudioEngine/Decoders/SFBFLACDecoder.mm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants