Skip to main content

Module backpressure

Module backpressure 

Source
Expand description

BoundedRing<T> — a fixed-capacity queue that drops the OLDEST item on overflow.

This is the backpressure primitive for the real-time relay’s per-connection outbound queue. The relay hands each connection an UNBOUNDED channel today (logicaffeine_system::relay), so a single slow consumer under a fast producer grows without bound — a latent OOM. A live-media queue must instead be bounded, and when it fills it should shed the STALEST frames (a late video frame is worthless; FEC and the next keyframe cover the gap), never the freshest, and never stall the whole relay. Every shed frame is counted in BoundedRing::dropped — the exact signal the congestion controller (adaptRate) reads to back off. Bounded memory, freshest-data-wins, drop-aware: the correct real-time transport policy.

Structs§

BoundedRing
A FIFO queue capped at cap items; a push into a full ring evicts the oldest.