Repository navigation
Conversation
Quest-Claim: 357a19cfd54e0c70
Pin moq-mux to kixelated/mp4-atom#254, which stores a field-less trun run as a count, so a moof of many such runs decodes without one entry per sample. Migrate the sample resolver, the segment-start scan, and the per-track fragment rewrite to `Trun.samples`, and test that a moof of 1000 u32::MAX-sample runs decodes and resolves only up to the mdat. Swap the git pin for mp4-atom 0.17.0 once it is published. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An inherited trun run can claim u32::MAX samples in four bytes, so walking every sample for a sync flag before the resolver bounds them would trade the old per-sample allocation for a multi-billion step loop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mp4-atom now decodes a nonzero dOps family instead of refusing it, so the fMP4 importer refuses the table itself until surround Opus lands. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
Closing as superseded by moq-dev/moq#7308, as the maintainer decided on 2026-10-30. #7308 merges this branch whole: the counted (Written by Claude Opus 5.5) |
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
Parsing a moof no longer allocates per sample for
trunruns that carry no per-sample field. The counted representation lands in kixelated/mp4-atom#254, and this PR adopts it in moq-mux.Trun.entries: Vec<TrunEntry>becomesTrun.samples: TrunSamples, an enum ofInherited { count, first_flags }(a field-less run, including the first-sample-flags-only run) andExplicit(Vec<TrunEntry>).TrunSamples::iter()yieldsTrunEntryvalues in either form without allocating. AnExplicitrun's capacity is bounded by the bytes left in the box, which replaces the 4096-entry cap. The AV1, BBB, and ESDS fixtures still decode.sample::Resolver::resolve, the segment-start keyframe scan, and the per-trackfragment/keptrewrite now readtrun.samples. The resolver counts its remaining samples inu64, so 1000 runs ofu32::MAXcan't overflow a 32-bitusize.u32::MAXnon-sync samples can't spin it. Testfieldless_runs_do_not_stall_the_segment_scancovers this and hangs without the bound.trunliterals in tests and the containers benchmark usesamples: entries.into().fieldless_runs_do_not_amplify: a moof of 1000 runs, each claimingu32::MAXsamples, encodes under 16 KB. It decodes to 1000 counts, and the resolver stops at the first sample past the 6-byte mdat.dOps.Public API: breaking for
mp4_atom::Trunthrough moq-mux'smp4_atomre-export (CHANGELOG entry added). MoQ wire: none.Decisions needed
3e150f9) as a git dependency and allowskixelated/mp4-atomindeny.toml'sallow-git. A git dependency can't be published to crates.io, so this PR stays a draft until release PR kixelated/mp4-atom#247 merges. After the release, replace the pin withmp4-atom = { version = "0.17.0", ... }, revert theallow-gitentry, and mark this PR ready.mp4-atomnow decodes a nonzerodOpsfamily, the fMP4 importer refuses it explicitly (UnsupportedMappingFamily) until that quest adds the import. The refusal test now builds a valid family 1dOps.Close fix!: refuse nonempty field-less sample runs kixelated/mp4-atom#248: closed.TrunSamplesAPI shape is a proposal (see the mp4-atom PR body). Rename on Bump thiserror from 1.0.69 to 2.0.3 #254 if you prefer something else; moq-mux only usesiter(),len(),From<Vec<TrunEntry>>, theInheritedvariant, andTrunSamplesIter::default().Choices made without asking
Defaults::resolve(&Tfhd, &TrunEntry)'s signature. Callers pass&entrynow that the iterator yieldsTrunEntryby value (it isCopyin mp4-atom).fragment, theduration == Some(0)scrub only touchesExplicitruns. An inherited run takes its duration from thetfhd, whose zero default is already cleared just above.trunliterals usevec![..].into()(anExplicitrun) even when field-less. They encode to the same bytes asInherited.Testing
cargo test --all-features(384 unit + 3 doc),cargo clippy --all-targets --all-features -D warnings,cargo fmt --check: all pass.cargo clippy -p moq-mux --all-targets --all-features -D warningspasses.cargo test -p moq-mux --all-features: 1809 passed, 0 failed.cargo deny check sources banspasses.cargo bench -p moq-mux --bench containers -- cmaf-interleaved(1-byte and 4096-byte samples, 1/16 runs, 1/4 tracks), against a baseline from main. There is no consistent change: results swung both ways (−43% to +45%) with wide intervals on a host at load ~30–60. The bench's runs carry explicit fields, so they take the sameExplicitpath as before.just checkand the JS side were not run; JS has notrunconsumer.Suggested follow-ups
(Written by Claude Opus 5.5)
🤖 Generated with Claude Code