#[non_exhaustive]#[repr(usize)]pub enum Slot {
Show 22 variants
RtcpSession = 500,
CongestionControl = 1_000,
FecWireImage = 1_500,
TwccSender = 2_000,
CircuitBreaker = 2_500,
Pacer = 3_000,
NackResponder = 4_000,
FecEncoder = 5_000,
TwccReceiver = 8_000,
Rfc8888 = 9_000,
ReceiverReport = 10_000,
FecDecoder = 10_300,
NackGenerator = 10_600,
SenderReport = 11_000,
IntervalPli = 12_000,
JitterBuffer = 13_000,
Custom(usize),
KeyFrameRequests = 14_000,
ExtendedReports = 10_100,
TradeoffNotifications = 14_100,
PauseResume = 14_200,
Redundancy = 10_450,
}Expand description
Where an interceptor belongs in the chain, measured by distance from the wire.
This is the chain contract’s ordering table expressed as data, so that one place decides it and a test can check a builder against it. The doc comments carry that table’s indices; the gaps are slots nothing fills yet.
Read walks the list forwards and write walks it in reverse, so a smaller slot is closer to the network in both directions.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
RtcpSession = 500
The RTCP session (RtcpSessionInterceptor): the
last thing every outbound RTCP packet passes and the first to see what arrives, so it
counts what really left and arrived and no RTCP leaves except in its compound packets.
CongestionControl = 1_000
CongestionControlInterceptor — the send history, and the ingest of returning feedback.
Both legs. Read: ingests inbound TWCC or CCFB and hands the reports to the estimator. Write: records every departing RTP packet in the send history.
Why here — wire-most. The write walk runs from the application down to the wire, so the lowest slot is the last thing a departing packet meets. Two facts depend on that. The departure instant it records is the moment the packet actually left, after the pacer held it; recording at enqueue instead would charge the pacer’s own queueing delay to the network and drive the estimate down for a delay this endpoint created. And the transport-wide sequence number the history keys on has already been assigned at 2_000, so a report naming that number can be matched to the packet that carried it.
FecWireImage = 1_500
WireImageTap — copies departing media packets, as they leave, for an FEC encoder.
Outbound only, and it changes nothing: every packet passes through untouched.
Why here — below the last thing that edits a packet. FEC protects the source packets
as they are on the wire: the receiver XORs what arrived. Slot::TwccSender at 2_000
writes the transport-wide sequence number into each departing packet, adding the header
extension when the packet had none, so an encoder that read the packet above it protects
an image the receiver never sees, and what it recovers is corrupt. The encoder itself
cannot move down here: it generates packets, and a generator has to stay above the pacer
and the TWCC sender so its repair packets are metered and numbered. So the encoder stays
at Slot::FecEncoder and reads the wire image from this tap.
TwccSender = 2_000
TwccSenderInterceptor — stamps each departing RTP packet with the transport-wide sequence
number the remote will report against.
Outbound only. Inbound packets pass through untouched.
Why here — below every generator, above the history. The write walk must reach it
before Slot::CongestionControl, or the history would key on a number that does not
exist yet. It must sit below everything that produces a packet — the NACK responder at
4_000, the FEC encoder at 5_000, every RTCP generator above them — because a packet that
never passes this slot is never numbered, and the remote cannot report on what it cannot
name. A retransmission is exactly that case.
CircuitBreaker = 2_500
CircuitBreakerInterceptor — the RTP circuit breaker of RFC 8083: stops a flow whose
receiver has gone, whose media is not arriving, or that persistently takes ten times what
TCP would.
Both legs. Write: counts every departing RTP packet, and drops the packets of a flow that has ceased transmission. Read: reads the report blocks of inbound SR and RR.
Why here — below the pacer, above the numbering. Below the pacer it counts what is actually released, retransmissions and repair packets included. Above the TWCC sender and the send history, a packet it drops is never numbered and never recorded as sent: a ceased flow does not read as loss to the congestion controller.
Pacer = 3_000
PacerInterceptor — gates departures, releasing at the estimated rate.
Outbound, with one inbound read. Write: queues RTP and releases it on a timer; RTCP
passes straight through, because feedback is only useful while it is fresh. Read: observes
Attribute::TargetBitrateChanged going past.
Why here — the meter every generated byte must cross. Everything that produces a packet sits application-ward of this slot, so retransmissions, FEC repair and generated RTCP are all metered rather than bursting past the estimate. It is above the TWCC sender so that numbering happens at release rather than at enqueue, which keeps the numbers in the order the packets actually reach the wire.
The estimate reaches it on the read leg because that is the only leg it can: the controller is wire-ward of here, so on the write leg it sees packets after this interceptor — too late to inform it.
NackResponder = 4_000
NackResponderInterceptor — answers a NACK by resending from its own buffer.
Both legs. Write: buffers each departing RTP packet against a later request. Read: watches for inbound NACK and queues the retransmissions it asks for.
Why here — the lowest of the generators. A retransmission it emits re-enters the belt at this slot and continues down, so it is still paced (3_000), numbered (2_000) and recorded (1_000). It has to be: a retransmission is new bytes on the wire, and an estimator that does not see them believes the path is carrying less than it is — then raises the rate during loss, which is the worst moment to do it.
FecEncoder = 5_000
The FEC send interceptor (FlexFec03SendInterceptor) — generates repair packets for the
media it sees leaving.
Outbound only.
Why here — a generator, so above the pacer. Its repair packets are real bytes and are metered, numbered and recorded like any other. Being above the NACK responder also means the media it protects has already been buffered for retransmission, so the two recovery mechanisms cover the same packets rather than racing to protect different ones.
What it protects is the packet as sent, and at this slot the packet is not final yet: see
Slot::FecWireImage, where the encoder reads it from.
TwccReceiver = 8_000
TwccReceiverInterceptor — reports arrival times to the remote sender’s congestion
controller.
Both legs. Read: records when each inbound packet arrived. Write: emits
TransportLayerCC on a timer.
Why here — the write leg is what pins it. It reads as a receive-side interceptor, and
moving it wire-ward looks harmless because nothing it does affects what this endpoint sends.
It does not work: it generates, and below the pacer its feedback would leave unpaced and
unrecorded by the send history. It is also an arrival recorder, so it must precede the
jitter buffer — see Slot::JitterBuffer.
Rfc8888 = 9_000
Rfc8888Interceptor — the same job as Slot::TwccReceiver in a different format.
Both legs, and pinned by the same two constraints: a generator above the pacer, an arrival recorder before the jitter buffer. It sits next to the TWCC receiver because the two are alternatives — registering both reports every packet to the remote twice, and its estimator cannot tell the two formats apart, so it reads the path as carrying double.
ReceiverReport = 10_000
ReceiverReportInterceptor — RFC 3550 reception quality, not congestion-control feedback.
Both legs. Read: accumulates loss, jitter and the extended sequence number from inbound RTP. Write: emits RR on a timer.
Why here — the same pair of constraints as the arrival recorders above. Above the pacer because it generates; before the jitter buffer because the jitter it measures must be the path’s, not this endpoint’s buffering.
FecDecoder = 10_300
The FEC receive interceptor (FlexFec03ReceiveInterceptor) — rebuilds packets the path
dropped.
Inbound only. Nothing on the write leg.
Why here — after the arrival recorders, before anything reads a sequence number. The
read walk runs wire to application. The arrival recorders (Slot::TwccReceiver,
Slot::Rfc8888, Slot::ReceiverReport) come first: they report what the path
delivered, so they have to see the repair packets this interceptor consumes, and they must
not see the packets it rebuilds. A repair packet swallowed before them is reported to the
sender as lost, and a rebuilt packet counted by them hides a loss from the sender’s
congestion controller and from fraction lost. The NACK generator comes after
(Slot::NackGenerator): this endpoint must not ask the remote to retransmit a packet it
is about to rebuild locally.
NackGenerator = 10_600
NackGeneratorInterceptor — asks the remote for what did not arrive.
Both legs. Read: detects gaps in the inbound sequence space. Write: emits NACK on a timer.
Why here — after recovery, before re-timing. After the FEC decoder (10_300), so a rebuilt packet counts as present and is not requested again. Before the jitter buffer (13_000), so it judges loss from arrival order rather than from playout order. And, being a generator, application-ward of the pacer so its NACKs are metered.
SenderReport = 11_000
SenderReportInterceptor — emits SR on a timer, describing what this endpoint has sent.
Outbound only.
Why here — generator, and nothing else constrains it. Above the pacer so its reports are metered. Nothing inbound informs it, so it has no read-side ordering requirement and its exact position among the generators does not matter.
IntervalPli = 12_000
IntervalPliInterceptor — asks the remote for a keyframe on a timer.
Outbound only.
Why here — generator, and nothing else constrains it, exactly as for
Slot::SenderReport.
JitterBuffer = 13_000
JitterBufferInterceptor — holds inbound packets to smooth arrival jitter, then releases
them in order on a timer.
Inbound only.
Why here — application-most, because it re-times what passes through it. Every arrival recorder must precede it. One placed after would read a packet’s playout instant and report it to the remote as its arrival time; the remote’s congestion controller would then see this endpoint’s own buffering depth as network delay variation — a delay signal manufactured locally and indistinguishable, at the far end, from a congested path.
Custom(usize)
Anywhere else, for an interceptor this crate knows nothing about.
The named slots are spaced so one of your own fits between any two of them
without renumbering anything: Slot::from(10_450) sits after the FEC decoder and before the
NACK generator. Reach it through From<usize> rather than by
naming the variant, so the spelling survives this gaining a richer representation.
Choosing a number. Work out which legs your interceptor uses, then apply the same rules the named slots obey:
- It produces packets — retransmissions, repair, RTCP, anything the wire has not seen yet.
Put it above
Slot::Pacer(> 3_000), or its output leaves unpaced and the send history never counts the bytes. This is the constraint people miss, because an interceptor that only reports on what it received still produces packets to report with. - It reads inbound sequence numbers or arrival times — loss detection, arrival recording,
reception statistics. Put it below
Slot::JitterBuffer(< 13_000), so it sees the order and timing the path produced rather than the order this endpoint replays. - It repairs or recovers inbound packets. Put it below anything that would otherwise ask
for them again — below
Slot::NackGenerator(< 10_600), as the FEC decoder is. - It only observes, and emits nothing. Nothing pins it; pick a slot that reads well next to its neighbours.
Both legs walk this one list — read from low to high, write from high to low — so a slot is
a position in both directions at once. An interceptor that acts on each leg is subject to
the constraints of each, and those can pull in opposite directions:
Slot::TwccReceiver is the worked example.
KeyFrameRequests = 14_000
KeyFrameRequestInterceptor — marks inbound PLI and FIR for delivery to the application,
which is the encoder that has to answer them.
Inbound only, and it only marks.
Why here — application-most. It neither holds, drops nor generates a packet, so it
constrains nothing; past every other interceptor, each of them has seen the request before
it leaves the chain. (Fork addition; see FORK.md. Declared after
Slot::Custom so that variant keeps its discriminant.)
ExtendedReports = 10_100
XrReportInterceptor — RFC 3611 report blocks about received streams (Loss RLE,
Duplicate RLE, Packet Receipt Times, Statistics Summary, VoIP Metrics).
Both legs. Read: records each remote packet’s arrival. Write: emits XR on a timer.
Why here — an arrival recorder next to the receiver report. It reports what the
path delivered, so it reads before the FEC decoder rebuilds packets and before the
jitter buffer holds them, and it generates, so it sits above the pacer. (Declared after
Slot::Custom so that variant keeps its discriminant.)
TradeoffNotifications = 14_100
TstnResponderInterceptor — answers each temporal-spatial trade-off request a local
media sender receives with a notification (RFC 5104 section 4.3.3).
Both legs. Read: sees the requests, which go on to the application. Write: emits the notifications.
Why here — application-most, next to the key-frame requests. It only generates
RTCP, so it sits above the pacer; nothing it does depends on arrival order. (Declared
after Slot::Custom so that variant keeps its discriminant.)
PauseResume = 14_200
PauseResumeInterceptor (RFC 7728): closest to the
application, so that what it holds back while a stream is paused, and the sequence
numbers it closes up afterwards, are all any other interceptor sees.
Redundancy = 10_450
RedAudioInterceptor (RFC 2198): wraps a local audio
stream’s packets in RED and takes received RED packets apart.
Both legs. Write: application-ward of the NACK responder and the FEC encoder, so
the RED packet is what they buffer and protect. Read: after the receiver report and
the FEC decoder, which count and repair the RED packets that arrived, and before the
NACK generator, which then does not ask for a packet RED recovered. (Declared after
Slot::Custom so that variant keeps its discriminant.)