Commit 3a78408
committed
feat(catalog): retrieve the catalog via SUBSCRIBE + joining FETCH (MSF-01 §5)
MSF-01 §5 requires subscribers to obtain the catalog with a SUBSCRIBE paired
with a relative Joining FETCH at offset 0. We previously subscribed with
AbsoluteStart{0,0} and never issued a fetch, which depended on relay-side
history replay and replayed every superseded group when that replay existed.
Adds a catalog bootstrap coordinator that implements the mandated pattern with
a diagnosed fallback ladder (standalone fetch bounded by the subscription's
Largest Location, then legacy retrieval), exactly-once application with
location dedup, and group-aware delta enforcement on every rung so a delta is
never applied without its own group's base. `catalogBootstrap` selects the
mode: auto (default), joining-fetch, strict, or subscribe for the legacy wire
behavior. An MSF-01/CMSF-01 catalog acquired through a fallback rung is
rejected unless the compatibility mode is chosen explicitly.
Transport:
- Save the Largest Location communicated in SUBSCRIBE_OK / PUBLISH / a d18
Forward-0→1 REQUEST_UPDATE_OK; resolve incoming joining fetches against that
saved snapshot only, with no caller-supplied anchor.
- Enforce the joining-fetch eligibility matrix per draft and initiator, and
apply PUBLISH acceptance parameters (FORWARD, filter, timeouts) on both ends.
- Carry the joining Request ID at its negotiated width; draft-18 defines it as
vi64, so stop narrowing it to the QUIC varint range.
WebTransport adapter:
- Expose request ownership before emission so a zero-latency response cannot
beat registration, plus an opt-in terminal drain so a subscription's late
objects are delivered rather than discarded at PUBLISH_DONE.
- Own publisher terminalization: transfer ownership synchronously before any
await, then account for the §5.1.1 reset requirement. A reset that cannot be
proven (a rejected or unsettled abort) forbids PUBLISH_DONE, so every
cancellation path fails closed through one wrapper, and each phase of the
failed-update transaction is bounded. Local failures close with
INTERNAL_ERROR rather than blaming the peer.
- closeSubgroup keeps the stream registered until its FIN settles (the
publishDone gate must still count it), propagates a failed FIN instead of
suppressing it, and shares one in-flight FIN among concurrent callers.
- A draft-14/16 acceptance whose control write fails now rolls back and closes
the session instead of leaving a subscription the peer never learned about.
Player:
- Route catalog objects through the coordinator with fail-closed parking,
staged recovery for retriable terminals, and connection-scoped ownership.
- Validate the GOAWAY New Session URI before creating a migration candidate;
reject non-URLs, non-https schemes, and fragments, and never silently fall
back to the current URL.
Broadcast example:
- Stop sending PUBLISH_DONE(TRACK_ENDED) on the catalog at startup. That
terminates the subscription and states the track is no longer published,
which forecloses delta updates and leaves later viewers without a catalog on
relays that treat an ended upstream track as final.
- Make each broadcast a generation-owned startup transaction: resources are
owned at creation, cancellation reaches in-progress work, and a superseded
attempt cannot touch its replacement's state.
- Publish media through bounded queues with codec-safe overflow (video drops
dependents until the next keyframe and restarts at object 0; audio drops
oldest), publishing independent audio chunks concurrently so the encoder's
output rate is actually sustained.
- Treat catalog publication as a protocol transaction: build before accepting,
and reach an explicit terminal outcome on any failure after acceptance.
- Bind wire behavior to the negotiated draft: select the LOC property profile
per draft and set draft-18's mandatory FIRST_OBJECT bit on every subgroup
this publisher opens.1 parent f6637b4 commit 3a78408
36 files changed
Lines changed: 13920 additions & 706 deletions
File tree
- examples
- broadcast
- node-relay/src
- player
- packages
- player/src
- transport/src/session
- webtransport/src
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
0 commit comments