Repository navigation
fix(cli): audit audio slots at their authored playback speed - #5300
Merged
jrusso1020 merged 1 commit intoOct 24, 2026
Merged
Conversation
4 tasks done
jrusso1020
approved these changes
Oct 15, 2026
jrusso1020
left a comment
Collaborator
There was a problem hiding this comment.
Approve. The fix is correct and small, and it reuses the runtime's own duration math, so the audit can't drift from what the render does.
What I checked:
packages/cli/src/commands/validate.ts:215-219now sendsdata-media-start,data-playback-start,data-playback-rateanddata-automationout of the page, and:237passes them toresolveNaturalMediaTimelineDurationfrom core. That's the same reader the runtime uses (packages/core/src/runtime/playbackRate.ts:42), so the precedence rules carry over:data-playback-startbefore the legacydata-media-start, and aratelane before the constant rate. Before this change the audit usedduration - data-media-startand ignored both rate anddata-playback-start.- Confirmed the six "fails on main" cases by hand against the old formula: half speed, trimmed half speed, both rate-lane cases, canonical-trim-over-legacy and double speed all produce the wrong answer with
duration - mediaStart. The three controls (normal speed, normal-speed shortfall, looping) pass either way. The test exercises the real browser function throughwindow.eval, which is a good way to cover serialized page code. - The shim's
getAttributeonly answers the four attributes it forwards. I checkedpackages/parsers/src/mediaDuration.tsand those are the only ones the reader asks for. The fallback rate becomes 1 rather than the element'sdefaultPlaybackRate, which only matters if a script set that property, so it's fine. - The
mediaSeconds === nullbranch can't be reached after the existing finite-duration guard. It's harmless.
Not run locally: I couldn't run the suite cheaply in my checkout. I'm relying on green CI plus reading the code.
Scope note for readers: the PR says it doesn't touch #4049 (video tweens after source EOF), and it doesn't. The audit is still audio-only. It doesn't overlap with #5528, which carries playback rate through export discovery. The two complement each other.
— Rames
2 of 4 tasks
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.
What
Make the audio slot-fit audit in
checkandvalidatecompare the slot with playable timeline seconds after trimming and playback speed, including a rate automation lane.Why
A one-second tone at
data-playback-rate=".5"fills a two-second slot in the actual render, butcheck --strictrejects it and recommends cutting the slot to one second. At rate2, the same tone becomes silent halfway through a one-second slot, but the audit reports no shortfall. Comparing raw source length produces both errors.Related work
No overlapping audio slot/rate validation PR found in current open PR files or concept searches. #4049 and #4087 concern video animation after source EOF; this audit continues to inspect audio only.
How
Serialize the audio's timing attributes from the browser and pass them to the existing shared natural-media-duration reader on the host. This follows constant and automated playback speed and the shared trim-offset precedence. Looping and unavailable-media handling remain in the existing fit audit.
Test plan
clip_media_fitwarning reporting 0.50 seconds. Static lint, runtime errors, layout, and contrast checks are clean for both fixtures.To reproduce, generate
tone.wavwithffmpeg -f lavfi -i "sine=frequency=440:sample_rate=48000:duration=1" tone.wav. Put this inindex.htmland runhyperframes check <dir> --strict, then render with--fps 10. For the fast case, change both durations to1and the playback rate to2.