Skip to content

Write FLAC STREAMINFO MD5 checksum#906

Open
PatrykMis wants to merge 1 commit into
chenxiaolong:masterfrom
PatrykMis:flac-streaminfo-md5
Open

Write FLAC STREAMINFO MD5 checksum#906
PatrykMis wants to merge 1 commit into
chenxiaolong:masterfrom
PatrykMis:flac-streaminfo-md5

Conversation

@PatrykMis

@PatrykMis PatrykMis commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

This updates the FLAC container finalization path to write the STREAMINFO MD5 checksum of the unencoded PCM audio data, as specified by FLAC.

The implementation adds a small optional hook for containers that need metadata derived from encoder input samples. FlacContainer uses it to track the exact interchannel sample count and MD5 digest of the same PCM bytes submitted to MediaCodec.

This keeps the existing crash-resilient behavior: encoded FLAC frames are still written to disk as they are produced, and the STREAMINFO patch is only a finalization step for cleanly closed recordings.

It also replaces the previous EOF presentation timestamp based duration calculation with an exact sample count derived from the PCM input, avoiding small rounding/under-counting errors in the STREAMINFO total samples field.

Signed-off-by: Patryk Miś <foss@patrykmis.com>
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.

1 participant