Repository navigation
fix(moq-hls): a segment URL names one byte sequence on every edge - #8778
Conversation
An edge muxed with the catalog's live estimates: the framerate it saw when building a rendition picked the timescale, and the latest bitrate the AAC descriptor. Neither is in the tag, so two edges serving one segment URL could serve differently timed bytes. The rendition now keeps and muxes its normalized config, the one its tag hashes. A retired rendition's cut segment ended where its own edge stopped reading, under the uncut segment's URL. A cut is now named by where it ends. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 10 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
I reviewed both commits: moq-hls now muxes from the same normalized config the segment tag hashes, and a retired rendition's last cut segment gets its own URL.
- Normalized config feeds the muxer —
Rendition::video/audiostore thenormalize_*output, andmuxer()builds from it directly. A LOC or legacy video now always muxes at 90 kHz with the 30 fpsdefault_frame, and a synthesized AACesdsalways carries the default bitrates. The master playlist and DASH still read the live estimates throughrefresh.matches_video,continuesandhandoverread only decode and source fields, so normalizing the stored config does not change them. - Cut segments get distinct URLs —
Follow::listretags the retired instance's final row withsegments::cut(tag, groups.end, end). It hashesendas well asgroups_end, so edges that cut at the same group but saw a different first "theirs" group still get different URLs. - Predecessor lookup by row —
Rendition::segmentdrops the redundantrendition.tag == id.tagfilter.live.holdsalready matches on the row's tag, so the cut URL resolves to its predecessor and the uncut URL for that number returnsNone. DASH lists only the current instance's own rows underrep.tag, so the cut never shows up in a manifest. - Tests —
edges_mux_alike_across_live_estimatesandedges_name_a_retired_cut_apartcover both cases. The hand-over tests now expect the cut tag.
A small doc follow-up: the segments::Row::tag doc and the module doc in rs/moq-hls/src/export/segments.rs still describe a row's tag as its track's tag. That is no longer true for a cut row. Both lines are outside the diff, so I couldn't comment on them inline.
claude-opus-5-5 | 𝕏

Problem
moq-hlsnames a segmentseg/[{generation}.]{tag}.{n}.m4s, and the same URL on every edge must name the same bytes, since a CDN caches it and a player fails over between edges. Two cases broke that:framerate * 1000. Two edges then served differently timed segments under one URL (reproduced:video0: segment 0 names one byte sequencefailed onmain). The AAC descriptor also took the latest bitrate, so the init hash depended on when the edge built it.Approach
segments::cut(tag, groups_end, end), so each cut has its own URL. The uncut URL and another edge's cut URL returnNone.Rendition::segmentfinds a predecessor by the row it holds, so the cut stays reachable after a replacement.New tests:
edges_mux_alike_across_live_estimatesandedges_name_a_retired_cut_apart. Both fail onmain.estimate_before_first_init_reaches_aac_descriptoris removed because it asserted the old behavior.Impact
Alternatives
Follow-ups
None.
Caused by
Validation
cargo test -p moq-hls: 257 passed. The two new tests failed before the fix, at the segment-bytes and same-tag assertions.just check origin/mainandjust ci origin/mainpassed.Models
Size: S
Implementer: Claude Code, claude-opus-5-5, unknown effort
(Written by Opus 5.5)
🤖 Generated with Claude Code
Review
Rewritten by
quest reviewafter each round.Head: abd9aa7
Base: origin/main at 6bc0984
Reviewer: Codex, gpt-6.1-sol, medium effort
Session:
01a1dcbd-c2c6-71d3-b98b-672c191426d1, round 1Score: 9/10,
The normalized muxing configuration and distinct cut-segment identities address cross-edge byte consistency with no actionable defects found; builds and tests were not run, as instructed.Rounds: 1; findings 0: fixed 0, refuted 0, open 0
Findings: none