Expand description
RTC Interceptor - Sans-IO interceptor framework for RTP/RTCP processing.
This crate provides a composable interceptor framework built on top of the
sansio::Protocol trait. Interceptors can process, modify, or generate
RTP/RTCP packets as they flow through the pipeline.
§Available Interceptors
§RTCP
| Interceptor | Description |
|---|---|
RtcpSessionInterceptor | The endpoint’s RTCP session: one CNAME and reporting identity, SR / RR / SDES / BYE, the timing of RFC 3550 6.3 and RFC 4585 3.5, every outbound RTCP packet in a compound packet (RFC 8108, RFC 5506) |
SenderReportInterceptor | Sender Reports (SR) for local streams on a fixed timer, for a chain built without the session |
ReceiverReportInterceptor | Receiver Reports (RR) on a fixed timer, for a chain built without the session |
KeyFrameRequestInterceptor | Delivers inbound PLI and FIR (each FIR command once) to the application |
§NACK (Negative Acknowledgement)
| Interceptor | Description |
|---|---|
NackGeneratorInterceptor | Detects missing RTP packets and generates NACK requests (RFC 4585) |
NackResponderInterceptor | Buffers sent packets and retransmits on NACK, with optional RTX support (RFC 4588) |
§TWCC (Transport Wide Congestion Control)
| Interceptor | Description |
|---|---|
TwccSenderInterceptor | Adds transport-wide sequence numbers to outgoing RTP packets |
TwccReceiverInterceptor | Tracks incoming packets and generates TransportLayerCC feedback |
§Congestion control
| Interceptor | Description |
|---|---|
PacerInterceptor | Releases outgoing packets at a target rate rather than in bursts |
Rfc8888Interceptor | Reports per-packet arrival times back to the sender (RFC 8888) |
§Utility
| Interceptor | Description |
|---|---|
NoopInterceptor | Ends the inbound RTCP path; the last interceptor in a chain |
§Design
A chain is a flat list of interceptors driven over a shared belt. Each one can:
- transform a packet passing through, or swallow it to drop or delay it
- emit packets it generated or was holding, which rejoin the belt and carry on
- act on timeouts, for periodic work like report generation
- track stream statistics and state
All interceptors work with TaggedPacket — an RTP or RTCP packet with transport metadata,
carrying Attributes that say what happened to it on the way. No interceptor holds a
reference to another; Registry assembles the list and walks it. Registry::build appends
NoopInterceptor last, so inbound RTCP stops before the application — control traffic the
interceptors act on is not media the caller asked for. An interceptor that wants a particular
packet delivered anyway attaches Attribute::DeliverToApplication to it.
§Direction
A chain is a flat list ordered by distance from the wire: the first interceptor is closest to the network, the last closest to the application. Direction is a property of the walk, not of the structure:
read (network → application) forward: first → … → last
write (application → network) reverse: last → … → firstEach interceptor is fed from a shared belt and its output is collected back onto it, so what a interceptor emits is seen by every interceptor still ahead of it in the walk. A retransmission emitted mid-chain still gets paced, numbered and recorded, because there is no way out of the chain except through the interceptors that follow.
One list serves both directions, so “closest to the wire” means one thing rather than opposite things per direction — which is why the send history and the FEC decoder sit next to each other, one being the last thing on the way out and the other the first on the way in.
§Quick Start
use rtci_interceptor::{
NackGeneratorBuilder, NackResponderBuilder, ReceiverReportBuilder,
Registry, SenderReportBuilder, Slot, TwccReceiverBuilder, TwccSenderBuilder,
};
use std::time::Duration;
// The slot decides the position, not the order of these calls; they are listed
// wire-to-application here only because that reads the way the chain runs — forwards on the
// read path, and in reverse on the write path.
let chain = Registry::new()
.with(Slot::TwccSender, TwccSenderBuilder::new().build())
.with(Slot::NackResponder, NackResponderBuilder::new().build())
.with(Slot::NackGenerator, NackGeneratorBuilder::new().build())
.with(Slot::TwccReceiver, TwccReceiverBuilder::new().build())
.with(Slot::ReceiverReport, ReceiverReportBuilder::new().build())
.with(Slot::SenderReport, SenderReportBuilder::new().with_interval(Duration::from_secs(1)).build())
.build();
// `build` appends [`NoopInterceptor`] last, so inbound RTCP — control traffic the interceptors
// above act on — stops there rather than arriving mixed in with the application's media. To
// receive some of it, add an interceptor that marks those packets `DeliverToApplication`.§One chain type
Registry::build returns a single concrete type whatever it was built from, so a struct can
hold one without a type parameter and two connections with different chains share a collection:
use rtci_interceptor::{Slot, NackGeneratorBuilder, Registry, SenderReportBuilder};
let chain = if nack_enabled {
Registry::new().with(Slot::NackGenerator, NackGeneratorBuilder::new().build()).build()
} else {
Registry::new().with(Slot::SenderReport, SenderReportBuilder::new().build()).build()
};The cost is one virtual call per interceptor per packet, which is nothing beside SRTP.
§Stream Binding
Before interceptors can process packets for a stream, the stream must be bound:
use rtci_interceptor::{Slot, Interceptor, RTCPFeedback, RTPHeaderExtension, Registry, StreamInfo};
let mut chain = Registry::new().build();
// Create stream info with NACK and TWCC support
let stream_info = StreamInfo {
ssrc: 0x12345678,
clock_rate: 90000,
mime_type: "video/VP8".to_string(),
payload_type: 96,
rtcp_feedback: vec![RTCPFeedback {
typ: "nack".to_string(),
parameter: String::new(),
}],
rtp_header_extensions: vec![RTPHeaderExtension {
uri: "http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01".to_string(),
id: 5,
}],
..Default::default()
};
// Bind for outgoing streams (sender side)
chain.bind_local_stream(&stream_info);
// Bind for incoming streams (receiver side)
chain.bind_remote_stream(&stream_info);§Writing your own
Implement sansio::Protocol and Interceptor, then add it wherever it belongs in the
list. What handle_* takes in, poll_* gives back — so even a pass-through needs a queue,
because the queue is what the next interceptor is fed from:
use rtci_interceptor::{Slot, Interceptor, Registry, StreamInfo, TaggedPacket};
use sansio::Protocol;
use std::collections::VecDeque;
use std::time::Instant;
/// Counts packets on their way out.
#[derive(Default)]
struct Counter {
sent: u64,
read_queue: VecDeque<TaggedPacket>,
write_queue: VecDeque<TaggedPacket>,
}
impl Protocol<TaggedPacket, TaggedPacket, ()> for Counter {
type Rout = TaggedPacket;
type Wout = TaggedPacket;
type Eout = ();
type Error = shared::error::Error;
type Time = Instant;
fn handle_read(&mut self, msg: TaggedPacket) -> Result<(), Self::Error> {
self.read_queue.push_back(msg);
Ok(())
}
fn poll_read(&mut self) -> Option<Self::Rout> {
self.read_queue.pop_front()
}
fn handle_write(&mut self, msg: TaggedPacket) -> Result<(), Self::Error> {
self.sent += 1;
self.write_queue.push_back(msg); // queueing nothing would swallow it
Ok(())
}
fn poll_write(&mut self) -> Option<Self::Wout> {
self.write_queue.pop_front()
}
}
impl Interceptor for Counter {
fn bind_local_stream(&mut self, _info: &StreamInfo) {}
fn unbind_local_stream(&mut self, _info: &StreamInfo) {}
fn bind_remote_stream(&mut self, _info: &StreamInfo) {}
fn unbind_remote_stream(&mut self, _info: &StreamInfo) {}
}
let chain = Registry::new().with(Slot::NackGenerator, Counter::default()).build();Queue nothing to drop or delay a packet, and queue delayed or generated ones whenever they are
ready — from handle_timeout, say. They leave through
poll_* and continue through every interceptor ahead.
Structs§
- AbsSend
Time Interceptor - Stamps the abs-send-time header extension on every packet of a local stream that
negotiated it (see the
gcc::rembmodule’s source documentation): 6.18 fixed-point seconds of the instant the packet passes, which is as it leaves the pacer when the interceptor sits below it (the default set puts it atSlot::Custom(1_900)). - Acknowledgement
- One packet’s fate, as reported by the receiver.
- Adaptive
Jitter Buffer Builder - Builder for
JitterBufferInterceptor. - Adaptive
Jitter Buffer Interceptor - Receiver-side jitter buffer interceptor.
- Adaptive
Threshold - A threshold that follows the trend it is judging.
- Arrival
Group - A run of packets that departed together, and when they turned up.
- Arrival
Group Accumulator - Collects acknowledgements into bursts and emits the gradient between consecutive bursts.
- Attributed
Packet - A packet together with what the interceptors have learned about it.
- BitArray
- A 128-bit mask, indexed from the most significant bit.
- CcFeedback
Recorder - Records packet arrivals per stream and builds feedback reports from them.
- Circuit
Breaker Builder - Builder for
CircuitBreakerInterceptor. - Circuit
Breaker Handle - The application’s view of the circuit breaker, and the only way a ceased flow restarts.
- Circuit
Breaker Interceptor - The RTP circuit breaker of RFC 8083: stops a flow whose receiver has gone, whose media is not arriving, or that is persistently taking far more than its share.
- Congestion
Control Builder - Builder for
CongestionControlInterceptor. - Congestion
Control Handle - The application’s end of the congestion controller: the estimate, pulled when the encoder wants it, and the limits only the application knows.
- Congestion
Control Interceptor - Records every departing packet, resolves the remote’s feedback against it, and drives a
BandwidthEstimator. - Constant
Bitrate - An estimator that always says the same number.
- Delay
Trend - One filtered delay-gradient reading.
- EcnValidation
- RFC 6679 sections 7.2-7.4 for one RTP stream, fed from RFC 8888 reports. See the module documentation.
- Estimator
Stats - What an estimator is willing to say about itself.
- FecRate
- The loss-driven amount of FEC for one sender. See the module documentation.
- Feedback
Timeline - The receiver’s clock as successive feedback reports give it, without the wraps.
- FirCommands
- The FIR commands an endpoint sends (RFC 5104 section 4.3.1): each new command for a media sender takes the next command sequence number (modulo 256), a repetition keeps it, and the “SSRC of media source” field of the packet is zero, the target being in the FCI.
- Flex
Fec03 Decoder - Recovers media packets lost from a stream protected by FlexFEC draft-03.
- Flex
Fec03 Encoder - Builds FlexFEC draft-03 repair packets.
- Flex
Fec03 Receive Builder - Builder for
FlexFec03ReceiveInterceptor. - Flex
Fec03 Receive Interceptor - Recovers media lost from streams protected by FlexFEC draft-03.
- Flex
Fec03 Send Builder - Builder for
FlexFec03SendInterceptor. - Flex
Fec03 Send Interceptor - Produces FlexFEC draft-03 repair packets for outgoing media.
- Flex
FecBlock - One block of an R=0 FEC header: the source stream (taken from the repair packet’s CSRC list), its SN base, and the mask or L/D that follows.
- Flex
FecDecoder - Recovers lost source packets from RFC 8627 FlexFEC repair packets (
flexfec, notflexfec-03): flexible masks, fixed L/D rows and columns (1-D and 2-D, decoded iteratively), retransmissions, and repair packets that protect several source streams. - Flex
FecDecoder Config - Bounds on what a
FlexFecDecoderkeeps, all of them derived from the repair window the session agreed to (RFC 8627 sections 1.1.2 and 9). - Flex
FecDecoder Stats - Counters a
FlexFecDecoderkeeps about itself. - Flex
FecEncoder - Builds RFC 8627 FlexFEC repair packets: the format negotiated as
flexfec(video/flexfecand the other three media types of RFC 8627 section 5.1), notflexfec-03. - Flex
FecParameters - The parameters of an RFC 8627
flexfecpayload type beyond its clock rate. - Flex
FecReceive Builder - Builder for
FlexFecReceiveInterceptor. - Flex
FecReceive Interceptor - Recovers media lost from streams protected by RFC 8627 FlexFEC (
flexfec, notflexfec-03). - Flex
FecSend Builder - Builder for
FlexFecSendInterceptor. - Flex
FecSend Interceptor - Produces RFC 8627 FlexFEC repair packets (
flexfec, notflexfec-03) for outgoing media. - Gcc
- Google Congestion Control.
- GccHandle
- Read-only handle to the latest GCC bandwidth estimate.
- GccInterceptor
- Sender-side GCC bandwidth estimator interceptor.
- GccInterceptor
Builder - Builder for
GccInterceptor. - GccShared
- Shared state written by
GccInterceptorand read byGccHandle. - History
- Records outgoing packets and matches incoming feedback against them.
- Inter
Group Delay - The delay gradient between two consecutive groups.
- Interval
PliInterceptor - Requests a keyframe from every bound remote stream on a fixed interval.
- Jitter
Buffer - A single stream’s packets, ordered by extended sequence number.
- Jitter
Buffer Builder - Builder for
JitterBufferInterceptor. - Jitter
Buffer Control - The application’s jitter buffer target for the streams of one receiver (W3C webrtc 5.3
jitterBufferTarget): written into the chain (into_packet), the jitter buffer takes it for each SSRC, now or when the stream is bound, and holds those streams’ packets fortargetclamped to its minimum and maximum delay instead of its adaptive target;Nonereturns them to the adaptive target. Consumed by the jitter buffer; without one in the chain it reaches the terminus and is dropped there. - Jitter
Buffer Interceptor - Holds each stream’s packets for a fixed span of time, then releases them in order.
- Jitter
Buffer Metrics - The jitter buffer the application plays a stream out of, for the VoIP Metrics block (RFC 3611 section 4.7.7). The engine does not play media out, so it cannot know these itself.
- Jitter
Buffer Stats - Counters describing what a buffer has had to cope with.
- Kalman
- Kalman filter over the one-way delay gradient, per draft-ietf-rmcat-gcc-02 §5.3.
- KeyFrame
Request Interceptor - Marks inbound RTCP that asks for a key frame — a Picture Loss Indication (RFC 4585 §6.3.1) or
a Full Intra Request (RFC 5104 §4.3.1) —
Attribute::DeliverToApplication, so it passes the chain’s terminus (NoopInterceptor) instead of ending there. - Loss
Controller - Loss-based congestion control, per draft-ietf-rmcat-gcc-02 §5.5.
- Media
Usability - The application’s bound on what is still usable media (section 4.4). The RFC leaves the bound to the application on purpose.
- Minimum
Target - Rides with
Attribute::TargetBitrateChanged: the congestion controller’s minimum bit rate, the floor its target never goes under. Where lowering the original media by the retransmission reserve would take it under this floor the NACK responder lets the retransmissions take the window’s room first (RetransmissionRateLimit::WithinTarget). Read withAttributedPacket::custom. - Nack
Generator Builder - Builder for the NackGeneratorInterceptor.
- Nack
Generator Interceptor - Interceptor that generates NACK requests for missing RTP packets.
- Nack
Responder Builder - Builder for the NackResponderInterceptor.
- Nack
Responder Interceptor - Interceptor that responds to NACK requests by retransmitting packets.
- Noop
Interceptor - Decides what becomes of inbound RTCP once the interceptors have had it, and passes everything else through.
- NtpTimestamp
Builder - Builder for
NtpTimestampInterceptor. - NtpTimestamp
Interceptor - Stamps an RFC 6051 NTP-format timestamp on the packets of local streams that negotiated
ntp-64orntp-56; see thentp_timestampmodule’s source documentation for which packets. - Overuse
Detector - Turns a filtered delay trend into a
Usage, with hysteresis. - Pacer
- A token bucket in bits, refilled from elapsed time.
- Pacer
Builder - Builder for
PacerInterceptor. - Pacer
Discard - Media the pacer discarded for want of room in the target (
QueueOverflow::Drop): whole frames of one stream (see “Discarding media” onPacerInterceptor). - Pacer
Interceptor - Releases queued packets at a target rate rather than as fast as they arrive.
- Pacer
Pause - Rides a target of zero (
Attribute::TargetBitrateChanged) that the pacer hands application-ward while it tells the source to pause (see “Pausing the source” onPacerInterceptor): the congestion controller’s target, for what application-ward of the pacer needs the rate the path carries (the NACK responder’s retransmission rate limit). Read withAttributedPacket::custom. - Packet
Report - One outgoing packet, joined with whatever the receiver later said about it.
- Pass
Through Interceptor - Hands every packet on unchanged, in both directions: the inner end of a nested interceptor
(one written with the
Interceptorderive, such asGccInterceptor) placed in aRegistryslot. - Path
Changed - A control message: the transport moved to another selected candidate pair (an ICE restart,
a switch to another pair, a move to another network), after its first one. The peer
connection reads it into the chain on the read leg, as an empty RTCP packet
(
PathChanged::into_packet), so it passes the congestion controllers first: they sit wire-most. Each starts its estimate over and forgets what it sent before (RFC 8836 section 2, requirement 1: a congestion controller reacts to a change of the path; as libwebrtc’sRtpTransportControllerSend::OnNetworkRouteChangedrestarts the bandwidth estimate and has its feedback adapter report only the packets sent on the new route). - Pause
Capability - What a negotiated
ccm pauseline says (RFC 7728 section 9, Figure 8):pause, thennowaitandconfig=<n>in any order; unknown attributes are ignored (“Unknown pause attributes MUST be ignored”). - Pause
Resume Builder - Builder for
PauseResumeInterceptor. - Pause
Resume Handle - The application’s side of
PauseResumeInterceptor: asks a remote stream to pause or resume, pauses its own streams by local decision, and reads where each stream is. A request takes effect at the interceptor’s next timeout, which the interceptor asks for at once. - Pause
Resume Interceptor - RFC 7728 pause and resume for the streams that negotiated
ccm pause; see the module documentation. - PerRtp
Session - An interceptor instance per RTP session; see the
rtp_sessionmodule’s source documentation. - Probe
Controller - Decides when a probe cluster is sent and at what rate.
- Probe
Packet - The mark of an RTP packet the pacer released as part of a probe cluster, as an
Attribute::Customon its way to the wire. - Probe
Request - A probe cluster the congestion controller asks for.
- Protection
Coverage - The assignment of media packets to repair packets.
- Queue
Limit Detector - The queueing delay of the packets reported, and whether a loss among them is the queue overflowing.
- RTCP
Feedback - RTCP feedback mechanism negotiated for the stream.
- RTPHeader
Extension - RTP header extension as negotiated via SDP (RFC 5285).
- Rate
Calculator - The rate the far end is receiving, from acknowledged bytes over a sliding window.
- Rate
Controller - The AIMD controller: a usage signal and a received rate in, a target bitrate out.
- Receiver
Report Builder - Builder for the ReceiverReportInterceptor.
- Receiver
Report Interceptor - Interceptor that generates RTCP Receiver Reports.
- RedAudio
Builder - Builder for
RedAudioInterceptor. - RedAudio
Interceptor - RFC 2198 audio redundancy for the streams that negotiated it; see the module documentation.
- RedFec
Payload - What a RED payload of a ULPFEC-protected stream holds.
- Registry
- Collects interceptors and assembles them into a chain.
- Remb
Generator Builder - Builds a
RembGeneratorInterceptor. - Remb
Generator Interceptor - Generates REMB for the remote streams that negotiated
goog-remband no per-packet congestion feedback (see thegcc::rembmodule’s source documentation). - Repeat
InRegular Reports - Attached as an
Attribute::Customto RTCP packets written into the chain: besides sending them as it sends any feedback (in an Early packet when RFC 4585 3.5.2 allows one, in the next Regular packet otherwise), the RTCP session puts a copy of them into each of the nextcountRegular compound packets after the one that carried them. - Report
- A batch of packet reports, with the round trip time they imply.
- Retransmission
Reserve - The retransmission reserve of
RetransmissionRateLimit::WithinTarget, in bits per second: the part of the congestion controller’s target kept for retransmissions, which the target reported for the original media leaves out. - Retransmissions
Left - The retransmissions that left the pacer, or were dropped there, since the last notice: each
as (SSRC on the wire, sequence number of the packet it repairs; the original sequence
number on an RTX stream). The pacer sends it application-ward on an empty RTCP carrier; the
NACK responder treats a packet as on its way while its retransmission waits in the pacer
and counts the resend interval from when it left, as libwebrtc’s packet history does
(
modules/rtp_rtcp/source/rtp_packet_history.cc: a request for a packet “already in pacer queue” is ignored; the send time is set when it is sent). Read withAttributedPacket::custom. - Rfc8888
Builder - Builder for
Rfc8888Interceptor. - Rfc8888
Interceptor - Reports when each packet of each bound remote stream arrived (RFC 8888).
- Rtcp
Bandwidth - The bandwidth figures a session description gives for RTCP, all in bits per second.
- Rtcp
Session Builder - Builder for
RtcpSessionInterceptor. - Rtcp
Session Interceptor - The RTCP session of an endpoint (RFC 3550 section 6, RFC 4585 section 3, RFC 8108).
- RtpSession
- Names the RTP session (the transport) a packet belongs to. Carried as an
Attribute::Custom; read it withRtpSession::of. - RtpSession
Assignment - A control message: the SSRCs (local and remote, media and repair) of the m= sections that
run in RTP session
session. Written into the chain as an empty RTCP packet (RtpSessionAssignment::into_packet); everyPerRtpSessionon the way takes note and moves a stream it holds in another session. - Sender
Report Builder - Builder for the SenderReportInterceptor.
- Sender
Report Interceptor - Interceptor that filters hop-by-hop RTCP reports.
- Slope
Estimator - Grouping plus filtering: acknowledgements in, a delay trend out.
- Stream
Info - Stream context passed to interceptor bind/unbind callbacks.
- Tmmb
Entry - One FCI entry of a TMMBR or a TMMBN (RFC 5104 sections 4.2.1.1 and 4.2.2.1).
- Tstn
Responder Builder - Builder for
TstnResponderInterceptor. - Tstn
Responder Interceptor - Answers each TSTR a local media sender receives with a TSTN (RFC 5104 section 4.3.3.2).
- Tstr
Commands - Command sequence numbers for TSTR (RFC 5104 section 4.3.2.1: “The sequence number space is unique for each pairing of the SSRC of command source and the SSRC of the command target. The sequence number SHALL be increased by 1 modulo 256 for each new command. A repetition SHALL NOT increase the sequence number”).
- Twcc
Receiver Builder - Builder for the TwccReceiverInterceptor.
- Twcc
Receiver Interceptor - Interceptor that tracks incoming RTP packets and generates TWCC feedback.
- Twcc
Sender Builder - Builder for the
TwccSenderInterceptor. - Twcc
Sender Interceptor - Numbers every departing RTP packet so the remote can report on it
(
draft-holmer-rmcat-transport-wide-cc-extensions-01). - Ulpfec
Decoder - Recovers lost media packets of one stream from ULPFEC packets.
- Ulpfec
Decoder Stats - What a decoder has done so far.
- Ulpfec
Encoder - Generates ULPFEC payloads.
- Ulpfec
Level - One protection level of a FEC packet: its mask and its payload (RFC 5109 7.4).
- Ulpfec
Packet - A parsed ULPFEC payload: what follows the RTP header of a FEC packet, or what a RED block of the FEC payload type holds.
- Ulpfec
Protection Level - One protection level to generate: how many octets it covers and which packets it protects.
- Ulpfec
Receive Builder - Builder for
UlpfecReceiveInterceptor. - Ulpfec
Receive Interceptor - Recovers media lost from streams protected by ULPFEC (RFC 5109).
- Ulpfec
Repair - Marks an RTP packet that carried only FEC in a RED stream.
- Ulpfec
Send Builder - Builder for
UlpfecSendInterceptor. - Ulpfec
Send Interceptor - Produces ULPFEC (RFC 5109) for outgoing media.
- Ulpfec
Stream Packetizer - Builds the RTP packets of a FEC stream sent apart from the media (RFC 5109 7.2, 14.1).
- Vbcm
Commands - Command sequence numbers for VBCM (RFC 5104 section 4.3.4.1: “The sequence number SHALL be increased by 1 modulo 256 for each new command. A repetition SHALL NOT increase the sequence number”).
- Wire
Image Tap - Copies departing RTP packets of the watched streams, as they leave. Changes nothing: every packet passes through as it came.
- Wire
Images - The reading end of a
WireImageTap. - XrReport
Builder - Builder for
XrReportInterceptor. - XrReport
Interceptor - Writes RFC 3611 report blocks about the remote streams that asked for them.
Enums§
- Attribute
- A fact about a packet, attached by one interceptor and readable by the rest.
- Audio
Redundancy - When a local audio stream whose section negotiated RED (RFC 2198) is sent in RED. Received RED is taken apart in every case.
- Circuit
Breaker Packet Size - How the congestion breaker takes s, the packet size of the TCP throughput equation (RFC 8083 section 4.3).
- Circuit
Breaker Reason - Which breaker stopped a flow.
- Circuit
Breaker State - What the circuit breaker is doing with one flow.
- Congestion
Feedback Format - The per-packet feedback format a stream’s arrivals are reported in.
- EcnFailure
- An ECN failure a stream’s validation detected (RFC 6679 sections 7.2.1 and 7.4.2: detected
failures and erroneous behaviour “should” be logged “to enable follow up”). Each is logged
and kept for the application (
EcnValidation::take_failures). - EcnInitiation
- How a stream starts using ECN.
- EcnMarking
- Which ECT codepoint a stream that marks sends.
- EcnState
- Where a stream is in RFC 6679’s procedure.
- EctPreference
- Which ECT codepoint a receiver asks the sender to use: the
ect=parameter of itsa=ecn-capable-rtp(RFC 6679 section 6.1). Left out, the sender uses ECT(0). - Flex
FecEncode Error - Why a repair packet could not be built.
- Flex
FecHeader - A parsed FEC header (section 4.2.2).
- Flex
FecHeader Error - Why a repair packet’s FEC header cannot be used.
- Flex
FecLayout - How a repair packet names the source packets it protects.
- Flex
FecParse Error - Why a repair packet could not be used.
- Flex
FecProtected - How one block of a repair packet names the source packets it protects.
- Flex
FecProtection - The shape of the FEC a sender applies to each block of consecutive source packets (RFC 8627 section 1.1).
- Jitter
Buffer State - Whether the buffer is still filling or is handing packets out.
- Nack
Control - What a session description negotiated for retransmission (RFC 4588), told to the NACK interceptors while they run.
- Pacer
Queue Overflow - What the pacer does with media the target has no room for: a packet that has waited the queue time limit, or the oldest one when a packet arrives at a full queue. It happens only when the application writes faster than the congestion controller’s target for longer than the limit.
- Packet
- RTP/RTCP Packet
- Pause
Resume Control - What the peer connection tells the
PauseResumeInterceptorwhile it runs: a local stream it sends made inactive or active again (W3C webrtc-pcRTCRtpEncodingParametersactive), which RFC 8853 section 5.2 has treated as an RFC 7728 local pause (section 6.4, announced with PAUSED) and resume. A stream that did not negotiate pause and resume is not affected. - Pause
State - Where a local RTP stream is in the state machine of RFC 7728 section 6 (Figure 4).
- Rate
Control State - What the rate controller should be doing.
- Received
Rate Bound - What the bound of the estimate by the received rate (
A_hat(i) < 1.5 * R_hat(i), draft-ietf-rmcat-gcc-02 section 5.5) does to an estimate that is above it. - RedPlacement
- Where FEC data goes in a RED stream.
- Rejected
- Why a packet was not stored.
- Remote
Pause State - What a receiver knows of a remote RTP stream it can pause.
- Retransmission
Rate Limit - How the NACK responder holds its retransmissions to the congestion controller’s target
(RFC 4588 section 7), read from
Attribute::TargetBitrateChangedas it passes on the read leg. Until a target has passed, and in a chain without a congestion controller, nothing is held back. - Rtcp
Profile - The RTP profile whose RTCP timing rules apply.
- Rtcp
Session Control - What an application (or the peer connection) tells the session while it runs.
- Rtcp
Session Event - What the session tells the rest of the chain and the peer connection.
- Slot
- Where an interceptor belongs in the chain, measured by distance from the wire.
- Threshold
Time Base - Which time step the threshold adaptation of draft-ietf-rmcat-gcc-02 section 5.4 takes,
del_var_th(i) = del_var_th(i-1) + (t(i)-t(i-1)) * K(i) * (|m(i)| - del_var_th(i-1)). - Tmmbr
Control - What an application tells the TMMBR requester (the congestion control interceptor), written
into the chain with
into_packet. - Ulpfec
Error - Why ULPFEC data was refused.
- Usage
- What the delay signal currently says about the path.
Constants§
- ABS_
SEND_ TIME_ SLOT - Where the default interceptor set puts the
AbsSendTimeInterceptor(Slot::Custom(ABS_SEND_TIME_SLOT)): wire-ward of the pacer (3_000), so the stamp is the instant a packet leaves it, and of the TWCC sender (2_000); application-ward of the FEC wire-image tap (1_500), so FEC protects the stamped packet. - ABS_
SEND_ TIME_ URI - The abs-send-time header extension’s URI.
- CIRCUIT_
BREAKER_ NON_ REPORTING_ THRESHOLD - The non-reporting threshold k: the RECOMMENDED value (RFC 8083 section 4.2).
- CIRCUIT_
BREAKER_ RTCP_ INTERVAL - The fixed minimum RTCP interval the RTCP timeout is computed with (Tmin, RFC 8083 section 4.1).
- CONGESTION_
CONTROL_ DEFAULT_ PRUNE_ HORIZON - How long an unacknowledged packet is kept before it is written off.
- DEFAULT_
NUM_ FEC_ PACKETS - Repair packets produced per block.
- DEFAULT_
NUM_ MEDIA_ PACKETS - Media packets gathered before a repair block is produced.
- ECN_
CONFIRMATIONS - Probes reported received with an ECN-capable marking that make the initiation succeed.
- ECN_
DEFAULT_ RETRY_ AFTER - How long after a failed initiation the next one starts (RFC 6679 section 7.4.1 option 1).
- ECN_
PROBE_ INTERVAL - During initiation a probe is sent at least this often (given an unmarked packet since the last one): two per RTCP reporting interval at the shortest regular interval RFC 3550 section 6.2 allows a reduced-minimum sender (360 / session kbit/s seconds) is met for any session above 720 kbit/s by the spacing, and below by this.
- ECN_
PROBE_ SPACING - During initiation one packet in this many is a probe sent ECT.
- FEC_
MIN_ LOSS - Smoothed loss under which no repair packet is sent: it would not help recover anything.
- FLEXFE
C03_ MAX_ MEDIA_ PACKETS - The most media packets one draft-03 repair packet can describe: 15 + 31 + 63 mask bits (draft-ietf-payload-flexible-fec-scheme-03, section 4.2).
- FLEXFEC_
DEFAULT_ PROTECTION - The protection applied when the builder names none: flexible masks, two interleaved repair packets per five source packets (the draft-03 interceptor’s default shape).
- FLEXFEC_
DEFAULT_ REPAIR_ WINDOW - The repair window a decoder assumes when none is signalled: 10 s, the value libwebrtc writes for FlexFEC.
- FLEXFEC_
MAX_ MASK_ BITS - The most source packets a flexible mask can name: 15 + 31 + 64 bits (section 4.2.2.1).
- FLEXFEC_
MAX_ PROTECTED_ SSRCS - The most source streams one repair packet can protect: the CSRC count is four bits.
- FLEXFEC_
MAX_ REPAIR_ WINDOW - The longest repair window a receiver built without
with_max_repair_windowsupports: 10 s. - FLEXFEC_
RECOVERY_ SIZE - The recovery fields every R=0 header starts with: P, X, CC, M, PT recovery, length recovery and TS recovery (Figures 12 and 13).
- GCC_
DECREASE_ FACTOR - Multiplier applied to the received rate when backing off (beta, section 5.5).
- GCC_
DEFAULT_ BURST_ INTERVAL - Packets sent within this of each other are one burst.
- GCC_
DEFAULT_ OVERUSE_ TIME - How long the trend must stay outside the threshold before overuse is declared.
- GCC_
HIGH_ LOSS - Above this the path is considered congested and the rate must fall.
- GCC_
INCREASE_ FACTOR - Multiplicative growth per second while far from convergence (the 1.08 of eta, section 5.5).
- GCC_
INITIAL_ BITRATE - Rate to start from when nothing is known yet.
- GCC_
LOSS_ INTERVAL - How long between changes, so each is observed before the next.
- GCC_
LOW_ LOSS - Below this loss fraction the path is considered healthy and the rate may climb.
- GCC_
MAX_ BITRATE - Ceiling.
- GCC_
MIN_ BITRATE - Floor. Below this a video call is not worth having.
- GCC_
RATE_ CONTROL_ INTERVAL - The step the first update of a controller is taken to cover, before there is a previous update to measure from.
- GCC_
RATE_ WINDOW - How far back the received rate is measured over.
- GCC_
THRESHOLD_ INITIAL_ MS - Starting threshold, in milliseconds — draft-ietf-rmcat-gcc-02 §5.4.
- GOOG_
REMB - The RTCP feedback type that negotiates REMB (
a=rtcp-fb:<pt> goog-remb). - INTERVAL_
PLI_ DEFAULT_ INTERVAL - How often a keyframe is requested when no interval is configured.
- JITTER_
BUFFER_ DEFAULT_ CAPACITY - Default cap on packets held per stream, so a stalled or hostile stream cannot grow without bound while its deadline is still in the future.
- JITTER_
BUFFER_ DEFAULT_ DEPTH - Default playout depth: enough to absorb ordinary network jitter without adding audible delay.
- MAX_
FEC_ PACKETS - The most repair packets one block can produce.
- MAX_
HELD_ WIRE_ IMAGES - The most wire images held for an encoder that is not taking them.
- MAX_
MEDIA_ PACKETS - The most media packets one FEC block can protect.
- MAX_
RETRANSMISSION_ RESERVE - The most of the congestion controller’s target the retransmission reserve of
RetransmissionRateLimit::WithinTargettakes, by default: half. - NACK_
SUGGESTED_ MAX_ NACKS_ PER_ PACKET - A limit for
NackGeneratorBuilder::with_max_nacks_per_packet: ten requests, the generator’s default from v0.22.0+brainwires.6 until requests became unlimited. Not libwebrtc’s: itskMaxNackRetriesis 100 (modules/video_coding/nack_requester.ccat a222406d, line 39), the limit of theChromebehaviour profile. Not the default (see the method). - NACK_
SUGGESTED_ MAX_ PACKET_ AGE - A limit for
NackGeneratorBuilder::with_max_packet_age, for a receiver that plays a packet out within two seconds of its loss. Not the default (see the method). - NTP_
TIMESTAMP_ INITIAL_ WINDOW - How long from a stream’s first packet every packet carries the timestamp, by default.
- NTP_
TIMESTAMP_ INTERVAL - How often a frame carries the timestamp after the initial window, by default.
- NTP_
TIMESTAMP_ SLOT - Where
NtpTimestampInterceptorsits in the default set:Slot::Custom(1_850). - PACER_
BURST_ TIME - The pacing interval: a group of packets leaves every 5 ms (draft-ietf-rmcat-gcc-02 section 4).
- PACER_
DEFAULT_ BITRATE - Rate used when none is configured: 1 Mb/s.
- PACER_
DEFAULT_ QUEUE_ LIMIT - Packets held before the queue overflows (see
QueueOverflow). - PACER_
DEFAULT_ QUEUE_ TIME_ LIMIT - How long a packet may wait in the queue by default (libwebrtc’s
kMaxExpectedQueueLength, 2 s); what happens to one that would wait longer isQueueOverflow’s. - PACER_
MIN_ BURST_ BITS - Smallest burst any pacer allows, in bits.
- PAUSED_
REPETITIONS - How often PAUSED is repeated after the first one: “PAUSED MUST also be included in (at least) the next two regular RTCP reports” (section 8.2).
- PAUSE_
DEFAULT_ REPORT_ INTERVAL - The interval at which PAUSED is repeated and after which a participant that sent nothing for five of them has timed out (RFC 3550 section 6.3.5), unless the builder says otherwise: the RTCP report interval of a session at the minimum RTCP rate (RFC 3550 section 6.2).
- PAUSE_
DEFAULT_ ROUND_ TRIP_ TIME - The round trip a sender or receiver assumes while it knows none (RFC 7728 section 8.1: “RTP stream receivers that lack an RTT estimate to the sender SHOULD use 500 ms as the default value”).
- PENDING_
REQUEST_ LIFETIME - A request that waits for room is dropped when the receiver has not asked for the packet again within this long, or within two round trips when that is longer: a receiver asks again every round trip while the packet is missing, so one that stopped asking has the packet or no longer wants it.
- PROBE_
AFTER_ DROP_ TIMEOUT - How long after a large drop the old rate is probed for.
- PROBE_
APPLICATION_ LIMITED_ INTERVAL - How often a cluster is sent while the application sends less than the target.
- PROBE_
MAX_ OCTETS - The most a cluster asks for, whatever its rate.
- PROBE_
MIN_ DURATION - How long a cluster lasts at its rate, at least.
- PROBE_
MIN_ PACKETS - How many packets a cluster has, at least.
- PROBE_
PADDING_ OCTETS - The padding octets of one probe packet: the most RFC 3550 section 5.1 padding holds (its count is one octet).
- PROBE_
RESULT_ TIMEOUT - How long a cluster’s reports are waited for before it is given up.
- QUEUE_
AT_ LIMIT_ MIN_ DELAY - And at least this much queueing delay: below it there is no queue to speak of, and loss is loss on the way (a radio link, a policer), which the loss-based controller is for.
- QUEUE_
AT_ LIMIT_ SHARE - A batch whose packets all met at least this share of the recent highest queueing delay arrived out of a queue at its limit.
- QUEUE_
BASE_ WINDOW - How far back the lowest one-way delay is looked for: the path’s delay with an empty queue.
- QUEUE_
HIGH_ WINDOW - How far back the highest queueing delay is looked for: where the queue overflows.
- RED_
AUDIO_ DEFAULT_ MAX_ PAYLOAD_ SIZE - The largest RED payload the sender builds by default: redundant blocks that would make the payload larger are left out (an Opus packet is far smaller), so that a RED packet stays within the path MTU the application sized the primary for, with the header, its extensions and the SRTP tag.
- RED_
AUDIO_ DEFAULT_ REDUNDANCY - How many earlier primaries a RED packet carries by default: one, as Chromium sends Opus RED.
- REMB_
DECREASE_ TRIGGER - An estimate below this share of the last one sent is news (congestion) and goes out at
once, as libwebrtc’s
kSendThresholdPercenthas it. - REMB_
GENERATOR_ SLOT - Where the default interceptor set puts the
RembGeneratorInterceptor(Slot::Custom(REMB_GENERATOR_SLOT)): with the other arrival recorders, after the RFC 8888 one (9_000) and before the receiver report (10_000). - REMB_
INITIALIZATION_ TIME - How long arrivals are watched before the first estimate is made from what they carry.
- REMB_
MAX_ INTERVAL - The longest a REMB waits when nothing has changed (section 3: “at least once per second”).
- REMB_
TIMEOUT - How long a REMB keeps bounding the target after it was received.
- REMB_
UPDATE_ INTERVAL - How often the arrivals are given to the estimator.
- RETRANSMISSION_
RATE_ WINDOW - The window
RetransmissionRateLimitmeasures the rates over (libwebrtc’skRetransmitWindowSizeMs). - RFC8888_
DEFAULT_ INTERVAL - How often feedback is sent when no interval is configured.
- RFC8888_
DEFAULT_ MAX_ REPORT_ SIZE - Byte budget for one report, chosen to sit inside a conservative path MTU.
- RTCP_
FB_ CCM_ PAUSE - The
ccmparameter ofa=rtcp-fbthat negotiates the messages (RFC 7728 section 9). - RTCP_
FB_ NACK_ ECN - The
nackparameter of the RFC 6679 RTCP ECN Feedback packet (a=rtcp-fb:<pt> nack ecn, section 6.2). The RTCP session writes the packet. - RTCP_
FB_ RRTR - The RTCP feedback type (
a=rtcp-fb:<pt> rrtr) that asks the receiver of a stream to send RTCP XR receiver reference time blocks (RFC 3611 section 4.4), libwebrtc’s name for it. - RTCP_
FB_ XR - The RTCP feedback type a stream’s negotiated
a=rtcp-xrunilateral formats arrive under (one entry per format, the format as its parameter). - RTCP_
SESSION_ DEFAULT_ MTU - The default of
RtcpSessionBuilder::with_mtu: the size a compound RTCP packet is kept under, SRTCP and lower layers not counted. - RTCP_
SESSION_ DEFAULT_ T_ RR_ INTERVAL - The default of
RtcpSessionBuilder::with_t_rr_interval. - RTCP_
SESSION_ MIN_ BANDWIDTH - The session bandwidth assumed while none is configured and no media has been measured: one audio stream.
- RTCP_
SESSION_ NOMINAL_ AUDIO_ BANDWIDTH - The session bandwidth assumed for audio while none was signalled: 64 kbit/s, an Opus stream at its high end for speech and the floor the session has always had.
- RTCP_
SESSION_ NOMINAL_ VIDEO_ BANDWIDTH - The session bandwidth assumed for video at the start, while no
b=line gave one and the media has not yet had its two seconds to be measured: 1 Mbit/s, a camera stream at standard definition. - RTCP_
XR_ ECN_ SUMMARY - The
xr-formatof the RFC 6679 ECN Summary Report block (a=rtcp-xr:ecn-sum, section 6.3). The RTCP session writes the block (RtcpSessionInterceptor). - TMMBR_
OWNER_ TIMEOUT - How long the owner of a tuple may stay silent before it has left: five reporting intervals of five seconds, the RTP participant timeout (RFC 3550 section 6.3.5).
- TMMBR_
REPEAT_ INTERVAL - How long an unacknowledged TMMBR waits before it is sent again (RFC 5104 section 4.2.1.2): about a regular RTCP reporting interval of a WebRTC session.
- ULPFEC_
DEFAULT_ NUM_ FEC_ PACKETS - FEC packets produced per block of media.
- ULPFEC_
DEFAULT_ NUM_ MEDIA_ PACKETS - Media packets gathered before FEC is produced for them.
- ULPFEC_
HEADER_ LENGTH - Octets of the FEC header (RFC 5109 7.3).
- ULPFEC_
LONG_ MASK_ BITS - Packets a long mask describes (L = 1).
- ULPFEC_
MAX_ HELD_ FEC - The most FEC packets held while they still have something to recover.
- ULPFEC_
MAX_ LEVELS - The most protection levels read from one FEC packet.
- ULPFEC_
MEDIA_ WINDOW - How far behind (and ahead of) the newest media sequence number packets are kept.
- ULPFEC_
SHORT_ MASK_ BITS - Packets a short mask describes (L = 0).
- XR_
DEFAULT_ GMIN - The Gmin of the VoIP Metrics burst model (RFC 3611 section 4.7.2 recommends 16).
- XR_
DEFAULT_ INTERVAL - How often the blocks are written when no interval is configured: about once per regular RTCP report of a video session.
Traits§
- Bandwidth
Estimator - A congestion control algorithm: acknowledged packets in, a target bitrate out.
- Interceptor
- One interceptor of packet processing.
- Rtcp
Random - The source of the random numbers the RTCP session uses: the variation of the report interval (RFC 3550 6.3.1), the dither of early feedback (RFC 4585 3.5.2), a reporting SSRC (RFC 3550 8.1) and the CNAME (RFC 7022 section 5).
Functions§
- convert_
ccfb - Convert an RFC 8888 report into acknowledgements per media stream, with the delay the receiver added before sending it.
- convert_
twcc - Convert a TWCC feedback packet into one acknowledgement per reported packet.
- depacketize_
red_ for_ ulpfec - Take a RED payload (RFC 2198) apart for ULPFEC (RFC 5109 14.2): the blocks of
fec_payload_typeare FEC payloads, the primary block is the media. - generate_
rtcp_ cname - A new RTCP CNAME for an endpoint, as RFC 7022 section 4.2 defines a short-term persistent
one: 96 bits from the operating system’s CSPRNG, Base64 encoded (16 characters). RFC 8834
4.9 asks for one per
RTCPeerConnection, used by every SSRC it sends from. - negotiated_
congestion_ feedback - The one feedback format a stream uses, from what was negotiated for it.
- pause_
config_ answer - The
configan answerer that implements everything answers to an offered one (RFC 7728 section 9.1, Figure 9): the complementary subset, so that what one side sends the other receives.Nonefor a value the section does not define: “MUST remove the “pause” CCM line in the answer when receiving an offer with a “config” value it does not understand“. The mapping is its own inverse, so it also gives the peer’sconfigfrom this endpoint’s. - probe_
estimate - The bit rate a path showed it carries, from the reports on the packets of one cluster.
- ulpfec_
one_ level_ only_ from_ fmtp - The value of the
onelevelonlymedia type parameter in ana=fmtpparameter string (RFC 5109 13):trueforonelevelonly=1,falsefor0, for an absent parameter (its default) and for any other value. - validate_
ulpfec_ scheme - Check the mask rules of RFC 5109 7.4 that relate the FEC packets of one group.
- wire_
image_ tap - A tap and the handle that reads it.
Type Aliases§
- Boxed
Interceptor - An interceptor whose concrete type has been erased.
- Tagged
Packet - Tagged packet with transport metadata.
Attribute Macros§
- interceptor
- Derive macros for nested (
#[next]-field) interceptors. Attribute macro for impl blocks to generate Protocol and Interceptor implementations.
Derive Macros§
- Interceptor
- Derive macros for nested (
#[next]-field) interceptors. Derive macro that marks a struct as an interceptor.