Skip to content

(Issue #27) Fix rendering stalling on multi-segment timelines#33

Open
SimonMav wants to merge 1 commit into
supermosh:mainfrom
SimonMav:main
Open

(Issue #27) Fix rendering stalling on multi-segment timelines#33
SimonMav wants to merge 1 commit into
supermosh:mainfrom
SimonMav:main

Conversation

@SimonMav

@SimonMav SimonMav commented Jul 4, 2026

Copy link
Copy Markdown

Chunks from each clip start their timestamps at 0, so concatenating segments (or repeating one) makes the timestamps jump backwards. Chrome's VideoDecoder doesn't like that and closes the codec, which then spams "decode on a closed codec" errors and stalls the render.
Rendering would pause partway through and the console filled up with:

Uncaught InvalidStateError: Failed to execute 'decode' on 'VideoDecoder':
Cannot call 'decode' on a closed codec.

Happens whenever the timeline has more than one segment (or a segment repeated). Each clip's
chunks carry timestamps starting from 0, so once we stitch them together the
timestamps reset backwards at every boundary. The decoder rejects the
backwards jump, closes itself, and the setInterval keeps hammering decode()
on the dead codec, leading to the "pausing" and the error spam.

Fix is to renumber the timestamps into a single monotonic sequence before
feeding them to the decoder. Types (key/delta) are left untouched so the
mosh effect still works.

Chunks from each clip start their timestamps at 0, so concatenating
segments (or repeating one) makes the timestamps jump backwards. Chrome's
VideoDecoder doesn't like that and closes the codec, which then spams
"decode on a closed codec" errors and stalls the render.

Rewrite the timestamps into one increasing sequence before decoding.
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