You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(moq-net): cache compressed frame payloads, decode at delivery
Compressible tracks (TrackInfo.compress) are Deflate-coded on the lite-05+
wire. The model previously inflated every frame on ingress and re-deflated it
per egress connection, so a relay burned CPU decompressing and recompressing
identical bytes for each downstream peer, and its in-RAM byte count tracked the
decompressed size rather than what it actually stores and sends.
Cache the bytes verbatim instead. The lite subscriber stores frames in the
codec they arrived in, recorded on the new Frame::compression field. This is
distinct from the compress egress hint: an origin marks a track compress but
writes plaintext, so its cached frames stay None. Egress then:
- forwards verbatim when the cached codec matches the wire codec (the common
relay to modern-peer path: no inflate or deflate), and
- recodes only when they differ: an origin compressing its plaintext, or a
compression-incapable peer (old lite draft, IETF moq-transport, or an
in-process consumer) that needs plaintext.
FrameConsumer::read_all decodes against Frame::compression, so application
consumers (the moq-json catalog reader, etc.) and the IETF / old-lite egress
paths keep getting plaintext unchanged. read_chunk streams the stored bytes
verbatim for the relay passthrough. The wire format is unchanged.
The model's natural byte count now equals the compressed/wire count, which is
what usage billing should meter. The old-client-decompress path undercounts
egress (counts compressed, sends decompressed), an accepted tradeoff over
overcounting.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
0 commit comments