Repository navigation
fix(triage): flip cam-preview source-time sign so pre-rol 8000 l maps forward - #41
Merged
Merged
Conversation
…tMs (pre-roll) maps forward
`CamPreview` and `chunk-thumbnails` both computed `sourceT = masterT − syncOffsetMs/1000`,
but the rest of the pipeline (`local/timing/cam-time.ts`, `editor/types.ts:clipRangeS`,
`jobs.ts:masterStartS = -(algoMs+userMs)/1000`) treats positive `syncOffsetMs` as
"cam started BEFORE master t=0 (pre-roll)". With the wrong sign, a video whose audio
matched ~193 s into the recording showed the preview frozen for the entire pre-roll
window and then started playing from the cam's silent prelude, off by 193 s for the
rest of the song. Flipped to `camSourceTimeS(masterT, {masterStartS: -syncOffsetMs/1000})`
so triage and arrange use the same convention as render.
Also: when the master is playing and the cam crosses sourceT=0 from below (the typical
pre-roll handoff), explicitly call `play()` again — the previous code paused on every
negative tick but never resumed, leaving the element frozen on the first post-anchor
frame.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
CamPreview.tsxandchunk-thumbnails.tshad the wrong sign on the master→source-time formula. Positivesync.offsetMs(cam started before master t=0 — typical phone pre-roll) caused the preview to pause for the entire pre-roll window, then start the video from its silent prelude, off-by-offsetfor the rest of the song. Maria-José case: 740 s audio + 938 s video, matcher returned+193 000 ms, preview frozen for 3:13 then played from time 0 — exactly matching the user's report.camSourceTimeS({masterStartS: -syncOffsetMs/1000})so triage and arrange share the same sign convention the editor and renderer already use.decideCamPreviewAction()as a pure helper (with regression test for the 193-s case) plus an explicitplay()resume when the master crossessourceT=0from below — previously the per-tickpause()left the element frozen on the first post-anchor frame.Test plan
bun run vitest --project unit— 961 pass (15 new incam-preview-sync.test.ts+cam-time+diagnostics)maria_josee.mp3+VID_20260509_104631_00_229.mp4: preview is in sync from t=0, no more 3:13 freeze🤖 Generated with Claude Code