feat(spf): complete the moqt-20 publisher cutover (Phase 5)

Merged
MM
3mo ago
+1260-148

Finishes the publisher side of the moq-transport draft-20 migration begun on mmcc/moq (#41). The merge that brought the codec cutover into mmcc/moq-publisher is the base of this branch; this PR adds the three publisher behaviors the relay's draft-20 upstream join needs.

Changes

  • In-progress-group replay (track-publisher.ts). The actor retains the current group's frames (keyframe + deltas, bound or not, reset on each keyframe) and, on bind, replays them from object 0 under the new alias before continuing live. A subscription joining mid-group — the relay's relative-group 1 upstream join — now decodes instantly instead of waiting a full keyframe interval, and no subgroup stream ever begins partway through a group (the peer drops those). Group-per-frame tracks (catalog, audio) keep using replayLastGroupOnBind; the two paths are mutually exclusive.

  • LARGEST_OBJECT in SUBSCRIBE_OK (§10.2.17). The actor tracks the largest (group, object) it has written on its snapshot; setup-track-publishers passes a getLargestObject reader into registerTrack, and the session reports LARGEST_OBJECT in SUBSCRIBE_OK once content exists, omitting it before. Read at subscribe time, so no snapshot churn. The sandbox loopback relay's SUBSCRIBE_OK parser now skips the parameter block by parity instead of asserting it is empty.

  • Inbound FILL_PARAMETERS (§5.1.3.1). #openAndResetFill opens a uni stream, writes a FETCH_HEADER carrying the initiating Request ID, and resets it — the honest minimum for an origin that serves no fills (a reset is the fill-failure signal; a FIN would falsely claim an empty range). Wired on both the inbound SUBSCRIBE and REQUEST_UPDATE paths, gated on Forward State 1, with FILL_PARAMETERS pulled out of the update's unsupported-parameter set. encodeFetchHeader added to object-stream.ts.

Behavior change

The in-progress-group replay supersedes the old "join at the next keyframe" behavior, so four track-publisher and behavior tests that documented the old join were rewritten. Added actor coverage for Largest Object tracking and session coverage for LARGEST_OBJECT in SUBSCRIBE_OK and the fill open-and-reset.

Verification

All SPF test projects pass (node 353, browser 130). Typecheck, lint, and format clean. Not yet verified live against the relay fleet.

🤖 Generated with Claude Code


Summary by cubic

Completes the publisher side of the moq-transport draft-20 cutover: mid-group subscribers now replay the in-progress group from object 0, SUBSCRIBE_OK carries LARGEST_OBJECT once content exists, and inbound FILL_PARAMETERS is answered with an open-and-reset fill stream. Also adds configurable per-track publisher priorities.

Behavior changes

  • Mid-group subscribers get the full in-progress group replayed from object 0 on bind instead of joining at the next keyframe.
  • SUBSCRIBE_OK includes LARGEST_OBJECT (§10.2.17) once content exists, read from the actor's snapshot at subscribe time.
  • Inbound FILL_PARAMETERS opens a fill fetch stream with the Request ID and resets it — a FIN would falsely claim an empty range. The header survives via writer commit(); without commit(), nonempty fills are rejected with NOT_SUPPORTED, and lingering fills abort when the subscription cancels or ends. Streams open only for nonempty fill ranges (§5.1.3).
  • Track priorities are configurable per track and flow onto subgroup headers and upload send order.

Verification

  • All SPF test projects pass (node 353, browser 130), including a cross-engine A/V alignment test under delayed delivery.
  • Live against relay.mux.dev: the relay's upstream SUBSCRIBE from object 0 opened the first subgroup stream ~1 ms after bind, and the rebind's SUBSCRIBE_OK carried LARGEST_OBJECT without the relay dropping the session.
  • The relay never forwards FILL_PARAMETERS upstream, so open-and-reset stays unit-test-only.
  • Not yet run against sjc.relay.mux.global (needs put+get tokens).