fix: round mux duration to the PCM sample boundary - #339
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #338.
A valid 149-frame export at
30000/1001fps finishes visual/audio rendering but fails inrequest-media-mux: its ideal duration is 238638.4 PCM samples, while the audio planner correctly produces 238638 integer samples. The producer's exact cross-product comparison rejects that required rounding before the local mux handler runs.Reuse
mediaFrameRangeSamplesto enforce the existing rounded 48 kHz boundary used by audio planning, range rendering, and downstream mux validation. Audio that differs by even one sample is still rejected. This does not change AAC encoding or the post-mux handling fixed by #298 and #317.Validation on macOS arm64, Node 24.19.0, FFmpeg 8.1.1:
node --import tsx --test packages/media-pipeline/test/*.test.ts packages/media/test/frame-range.test.ts: 15 passed.pnpm check: passed.pnpm test: 1051 passed, 22 existing environment-gated tests skipped, 0 failed.The change is limited to the producer validation and its regression tests.