Commit 3be4903
feat(moq-net): make payload compression per-hop, per-frame (drafts#39)
Implements the moq-lite half of moq-dev/drafts#39: the publisher only signals
*whether* a track is worth compressing, while the algorithm is negotiated per hop
and recorded per frame. A single frame can opt out — e.g. a small JSON merge-patch
delta that DEFLATE would only enlarge — instead of bloating it.
Wire (moq-lite-05-wip):
- TRACK_INFO `Publisher Compression` becomes a boolean hint (>1 reserved, decodes
as true so it stays additive). It names no algorithm.
- New SETUP `Compression` parameter (id 0x3): each endpoint advertises the
algorithms it can decompress, packed varints, none(0) omitted. moq-net advertises
[deflate]. Per hop, per direction; never forwarded by a relay.
- New per-frame `Compression` field in FRAME, present iff the track is hinted,
after the timestamp delta and before the length. Names the codec actually used
(none/deflate); it doubles as the group's end-of-frames sentinel when no
timestamp precedes it.
Behavior:
- The publisher reads the peer's advertised algorithms (PeerSetup) before serving a
compress-hinted track. It forwards an already-DEFLATE cached frame verbatim when
the peer can inflate it (relay passthrough, no inflate/deflate), and otherwise
picks per frame whether DEFLATE actually shrinks the payload, sending `none` when
it wouldn't (or the peer can't inflate). Empty payloads always use `none`.
- The subscriber decodes the per-frame field and caches each frame in that codec,
so the cache holds compressed bytes (billing counts the wire size) and inflates
only at delivery.
No datagram path exists in moq-net yet, so that part of the draft is N/A here. The
IETF moqt compression extension (moq-compression) is left for a follow-up; the IETF
path keeps sending verbatim, which is spec-compliant "extension not negotiated".
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 5c0a615 commit 3be4903
8 files changed
Lines changed: 337 additions & 123 deletions
File tree
- rs
- moq-native/tests
- moq-net/src
- lite
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
355 | 355 | | |
356 | 356 | | |
357 | 357 | | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
363 | 363 | | |
364 | 364 | | |
365 | 365 | | |
| |||
378 | 378 | | |
379 | 379 | | |
380 | 380 | | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
381 | 384 | | |
382 | 385 | | |
383 | 386 | | |
| |||
388 | 391 | | |
389 | 392 | | |
390 | 393 | | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
391 | 403 | | |
392 | 404 | | |
393 | 405 | | |
| |||
462 | 474 | | |
463 | 475 | | |
464 | 476 | | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
465 | 486 | | |
466 | 487 | | |
467 | 488 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| 164 | + | |
| 165 | + | |
164 | 166 | | |
165 | 167 | | |
166 | 168 | | |
| |||
0 commit comments