Skip to content

Fix empty edit timescale in sample tables - #459

Open
padenot wants to merge 1 commit into
masterfrom
bug-2082877-empty-edit-timescale
Open

padenot wants to merge 1 commit into
masterfrom
bug-2082877-empty-edit-timescale

Conversation

@padenot

@padenot padenot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Empty edit durations use the movie timescale, but get_indice_table applied them directly as track ticks. Convert before computing the composition offset; the file in bug 2082877 should start video at 1/60 second rather than 16 seconds. This fixes the sample-table path left unchanged by #407.

Adds regression coverage for unequal timescales, negative offsets, large values and invalid conversions, and corrects existing sample-table expectations that encoded the same bug.

Validation: cargo test --workspace (219 passed, 1 ignored), cargo fmt --all -- --check, and git diff --check. The new regression failed before the fix (960 ticks instead of 1).

Convert empty edit durations from the movie timescale to the track timescale before applying composition offsets. Reject missing timescales and unrepresentable offsets instead of ignoring the edit.

Add regression coverage for scale conversion and invalid values, and correct the bipbop sample table expectations to include its scaled empty edit.

Fixes bug 2082877.
@padenot
padenot requested a review from kinetiknz October 16, 2026 14:42
@Vanilagy

Copy link
Copy Markdown

Thanks for the swift fix!

Note that the segment_duration field is always in the movie timescale, regardless of if its empty or not, so the description might be a little misleading.

The two relevant fields, from ISO/IEC 14496-12:

segment_duration is an integer that specifies the duration of this edit segment in units of the timescale in the Movie Header Box.
media_time is an integer containing the starting time within the media of this edit segment (in media time scale units, in composition time). [...]

@padenot

padenot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

Sorry which description is a little misleading? Do we need to adjust a comment that I missed? Thanks for the report in any case.

@Vanilagy

Copy link
Copy Markdown

Oh, it was just a nit about the PR description: "Empty edit durations use the movie timescale" sounded like only the empty ones use the movie timescale, not all.

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.

2 participants