Skip to main content

Crate rtci_interceptor

Crate rtci_interceptor 

Source
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

InterceptorDescription
RtcpSessionInterceptorThe 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)
SenderReportInterceptorSender Reports (SR) for local streams on a fixed timer, for a chain built without the session
ReceiverReportInterceptorReceiver Reports (RR) on a fixed timer, for a chain built without the session
KeyFrameRequestInterceptorDelivers inbound PLI and FIR (each FIR command once) to the application

§NACK (Negative Acknowledgement)

InterceptorDescription
NackGeneratorInterceptorDetects missing RTP packets and generates NACK requests (RFC 4585)
NackResponderInterceptorBuffers sent packets and retransmits on NACK, with optional RTX support (RFC 4588)

§TWCC (Transport Wide Congestion Control)

InterceptorDescription
TwccSenderInterceptorAdds transport-wide sequence numbers to outgoing RTP packets
TwccReceiverInterceptorTracks incoming packets and generates TransportLayerCC feedback

§Congestion control

InterceptorDescription
PacerInterceptorReleases outgoing packets at a target rate rather than in bursts
Rfc8888InterceptorReports per-packet arrival times back to the sender (RFC 8888)

§Utility

InterceptorDescription
NoopInterceptorEnds 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  → … → first

Each 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§

AbsSendTimeInterceptor
Stamps the abs-send-time header extension on every packet of a local stream that negotiated it (see the gcc::remb module’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 at Slot::Custom(1_900)).
Acknowledgement
One packet’s fate, as reported by the receiver.
AdaptiveJitterBufferBuilder
Builder for JitterBufferInterceptor.
AdaptiveJitterBufferInterceptor
Receiver-side jitter buffer interceptor.
AdaptiveThreshold
A threshold that follows the trend it is judging.
ArrivalGroup
A run of packets that departed together, and when they turned up.
ArrivalGroupAccumulator
Collects acknowledgements into bursts and emits the gradient between consecutive bursts.
AttributedPacket
A packet together with what the interceptors have learned about it.
BitArray
A 128-bit mask, indexed from the most significant bit.
CcFeedbackRecorder
Records packet arrivals per stream and builds feedback reports from them.
CircuitBreakerBuilder
Builder for CircuitBreakerInterceptor.
CircuitBreakerHandle
The application’s view of the circuit breaker, and the only way a ceased flow restarts.
CircuitBreakerInterceptor
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.
CongestionControlBuilder
Builder for CongestionControlInterceptor.
CongestionControlHandle
The application’s end of the congestion controller: the estimate, pulled when the encoder wants it, and the limits only the application knows.
CongestionControlInterceptor
Records every departing packet, resolves the remote’s feedback against it, and drives a BandwidthEstimator.
ConstantBitrate
An estimator that always says the same number.
DelayTrend
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.
EstimatorStats
What an estimator is willing to say about itself.
FecRate
The loss-driven amount of FEC for one sender. See the module documentation.
FeedbackTimeline
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.
FlexFec03Decoder
Recovers media packets lost from a stream protected by FlexFEC draft-03.
FlexFec03Encoder
Builds FlexFEC draft-03 repair packets.
FlexFec03ReceiveBuilder
Builder for FlexFec03ReceiveInterceptor.
FlexFec03ReceiveInterceptor
Recovers media lost from streams protected by FlexFEC draft-03.
FlexFec03SendBuilder
Builder for FlexFec03SendInterceptor.
FlexFec03SendInterceptor
Produces FlexFEC draft-03 repair packets for outgoing media.
FlexFecBlock
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.
FlexFecDecoder
Recovers lost source packets from RFC 8627 FlexFEC repair packets (flexfec, not flexfec-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.
FlexFecDecoderConfig
Bounds on what a FlexFecDecoder keeps, all of them derived from the repair window the session agreed to (RFC 8627 sections 1.1.2 and 9).
FlexFecDecoderStats
Counters a FlexFecDecoder keeps about itself.
FlexFecEncoder
Builds RFC 8627 FlexFEC repair packets: the format negotiated as flexfec (video/flexfec and the other three media types of RFC 8627 section 5.1), not flexfec-03.
FlexFecParameters
The parameters of an RFC 8627 flexfec payload type beyond its clock rate.
FlexFecReceiveBuilder
Builder for FlexFecReceiveInterceptor.
FlexFecReceiveInterceptor
Recovers media lost from streams protected by RFC 8627 FlexFEC (flexfec, not flexfec-03).
FlexFecSendBuilder
Builder for FlexFecSendInterceptor.
FlexFecSendInterceptor
Produces RFC 8627 FlexFEC repair packets (flexfec, not flexfec-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.
GccInterceptorBuilder
Builder for GccInterceptor.
GccShared
Shared state written by GccInterceptor and read by GccHandle.
History
Records outgoing packets and matches incoming feedback against them.
InterGroupDelay
The delay gradient between two consecutive groups.
IntervalPliInterceptor
Requests a keyframe from every bound remote stream on a fixed interval.
JitterBuffer
A single stream’s packets, ordered by extended sequence number.
JitterBufferBuilder
Builder for JitterBufferInterceptor.
JitterBufferControl
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 for target clamped to its minimum and maximum delay instead of its adaptive target; None returns them to the adaptive target. Consumed by the jitter buffer; without one in the chain it reaches the terminus and is dropped there.
JitterBufferInterceptor
Holds each stream’s packets for a fixed span of time, then releases them in order.
JitterBufferMetrics
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.
JitterBufferStats
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.
KeyFrameRequestInterceptor
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.
LossController
Loss-based congestion control, per draft-ietf-rmcat-gcc-02 §5.5.
MediaUsability
The application’s bound on what is still usable media (section 4.4). The RFC leaves the bound to the application on purpose.
MinimumTarget
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 with AttributedPacket::custom.
NackGeneratorBuilder
Builder for the NackGeneratorInterceptor.
NackGeneratorInterceptor
Interceptor that generates NACK requests for missing RTP packets.
NackResponderBuilder
Builder for the NackResponderInterceptor.
NackResponderInterceptor
Interceptor that responds to NACK requests by retransmitting packets.
NoopInterceptor
Decides what becomes of inbound RTCP once the interceptors have had it, and passes everything else through.
NtpTimestampBuilder
Builder for NtpTimestampInterceptor.
NtpTimestampInterceptor
Stamps an RFC 6051 NTP-format timestamp on the packets of local streams that negotiated ntp-64 or ntp-56; see the ntp_timestamp module’s source documentation for which packets.
OveruseDetector
Turns a filtered delay trend into a Usage, with hysteresis.
Pacer
A token bucket in bits, refilled from elapsed time.
PacerBuilder
Builder for PacerInterceptor.
PacerDiscard
Media the pacer discarded for want of room in the target (QueueOverflow::Drop): whole frames of one stream (see “Discarding media” on PacerInterceptor).
PacerInterceptor
Releases queued packets at a target rate rather than as fast as they arrive.
PacerPause
Rides a target of zero (Attribute::TargetBitrateChanged) that the pacer hands application-ward while it tells the source to pause (see “Pausing the source” on PacerInterceptor): 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 with AttributedPacket::custom.
PacketReport
One outgoing packet, joined with whatever the receiver later said about it.
PassThroughInterceptor
Hands every packet on unchanged, in both directions: the inner end of a nested interceptor (one written with the Interceptor derive, such as GccInterceptor) placed in a Registry slot.
PathChanged
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’s RtpTransportControllerSend::OnNetworkRouteChanged restarts the bandwidth estimate and has its feedback adapter report only the packets sent on the new route).
PauseCapability
What a negotiated ccm pause line says (RFC 7728 section 9, Figure 8): pause, then nowait and config=<n> in any order; unknown attributes are ignored (“Unknown pause attributes MUST be ignored”).
PauseResumeBuilder
Builder for PauseResumeInterceptor.
PauseResumeHandle
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.
PauseResumeInterceptor
RFC 7728 pause and resume for the streams that negotiated ccm pause; see the module documentation.
PerRtpSession
An interceptor instance per RTP session; see the rtp_session module’s source documentation.
ProbeController
Decides when a probe cluster is sent and at what rate.
ProbePacket
The mark of an RTP packet the pacer released as part of a probe cluster, as an Attribute::Custom on its way to the wire.
ProbeRequest
A probe cluster the congestion controller asks for.
ProtectionCoverage
The assignment of media packets to repair packets.
QueueLimitDetector
The queueing delay of the packets reported, and whether a loss among them is the queue overflowing.
RTCPFeedback
RTCP feedback mechanism negotiated for the stream.
RTPHeaderExtension
RTP header extension as negotiated via SDP (RFC 5285).
RateCalculator
The rate the far end is receiving, from acknowledged bytes over a sliding window.
RateController
The AIMD controller: a usage signal and a received rate in, a target bitrate out.
ReceiverReportBuilder
Builder for the ReceiverReportInterceptor.
ReceiverReportInterceptor
Interceptor that generates RTCP Receiver Reports.
RedAudioBuilder
Builder for RedAudioInterceptor.
RedAudioInterceptor
RFC 2198 audio redundancy for the streams that negotiated it; see the module documentation.
RedFecPayload
What a RED payload of a ULPFEC-protected stream holds.
Registry
Collects interceptors and assembles them into a chain.
RembGeneratorBuilder
Builds a RembGeneratorInterceptor.
RembGeneratorInterceptor
Generates REMB for the remote streams that negotiated goog-remb and no per-packet congestion feedback (see the gcc::remb module’s source documentation).
RepeatInRegularReports
Attached as an Attribute::Custom to 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 next count Regular compound packets after the one that carried them.
Report
A batch of packet reports, with the round trip time they imply.
RetransmissionReserve
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.
RetransmissionsLeft
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 with AttributedPacket::custom.
Rfc8888Builder
Builder for Rfc8888Interceptor.
Rfc8888Interceptor
Reports when each packet of each bound remote stream arrived (RFC 8888).
RtcpBandwidth
The bandwidth figures a session description gives for RTCP, all in bits per second.
RtcpSessionBuilder
Builder for RtcpSessionInterceptor.
RtcpSessionInterceptor
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 with RtpSession::of.
RtpSessionAssignment
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); every PerRtpSession on the way takes note and moves a stream it holds in another session.
SenderReportBuilder
Builder for the SenderReportInterceptor.
SenderReportInterceptor
Interceptor that filters hop-by-hop RTCP reports.
SlopeEstimator
Grouping plus filtering: acknowledgements in, a delay trend out.
StreamInfo
Stream context passed to interceptor bind/unbind callbacks.
TmmbEntry
One FCI entry of a TMMBR or a TMMBN (RFC 5104 sections 4.2.1.1 and 4.2.2.1).
TstnResponderBuilder
Builder for TstnResponderInterceptor.
TstnResponderInterceptor
Answers each TSTR a local media sender receives with a TSTN (RFC 5104 section 4.3.3.2).
TstrCommands
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”).
TwccReceiverBuilder
Builder for the TwccReceiverInterceptor.
TwccReceiverInterceptor
Interceptor that tracks incoming RTP packets and generates TWCC feedback.
TwccSenderBuilder
Builder for the TwccSenderInterceptor.
TwccSenderInterceptor
Numbers every departing RTP packet so the remote can report on it (draft-holmer-rmcat-transport-wide-cc-extensions-01).
UlpfecDecoder
Recovers lost media packets of one stream from ULPFEC packets.
UlpfecDecoderStats
What a decoder has done so far.
UlpfecEncoder
Generates ULPFEC payloads.
UlpfecLevel
One protection level of a FEC packet: its mask and its payload (RFC 5109 7.4).
UlpfecPacket
A parsed ULPFEC payload: what follows the RTP header of a FEC packet, or what a RED block of the FEC payload type holds.
UlpfecProtectionLevel
One protection level to generate: how many octets it covers and which packets it protects.
UlpfecReceiveBuilder
Builder for UlpfecReceiveInterceptor.
UlpfecReceiveInterceptor
Recovers media lost from streams protected by ULPFEC (RFC 5109).
UlpfecRepair
Marks an RTP packet that carried only FEC in a RED stream.
UlpfecSendBuilder
Builder for UlpfecSendInterceptor.
UlpfecSendInterceptor
Produces ULPFEC (RFC 5109) for outgoing media.
UlpfecStreamPacketizer
Builds the RTP packets of a FEC stream sent apart from the media (RFC 5109 7.2, 14.1).
VbcmCommands
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”).
WireImageTap
Copies departing RTP packets of the watched streams, as they leave. Changes nothing: every packet passes through as it came.
WireImages
The reading end of a WireImageTap.
XrReportBuilder
Builder for XrReportInterceptor.
XrReportInterceptor
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.
AudioRedundancy
When a local audio stream whose section negotiated RED (RFC 2198) is sent in RED. Received RED is taken apart in every case.
CircuitBreakerPacketSize
How the congestion breaker takes s, the packet size of the TCP throughput equation (RFC 8083 section 4.3).
CircuitBreakerReason
Which breaker stopped a flow.
CircuitBreakerState
What the circuit breaker is doing with one flow.
CongestionFeedbackFormat
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 its a=ecn-capable-rtp (RFC 6679 section 6.1). Left out, the sender uses ECT(0).
FlexFecEncodeError
Why a repair packet could not be built.
FlexFecHeader
A parsed FEC header (section 4.2.2).
FlexFecHeaderError
Why a repair packet’s FEC header cannot be used.
FlexFecLayout
How a repair packet names the source packets it protects.
FlexFecParseError
Why a repair packet could not be used.
FlexFecProtected
How one block of a repair packet names the source packets it protects.
FlexFecProtection
The shape of the FEC a sender applies to each block of consecutive source packets (RFC 8627 section 1.1).
JitterBufferState
Whether the buffer is still filling or is handing packets out.
NackControl
What a session description negotiated for retransmission (RFC 4588), told to the NACK interceptors while they run.
PacerQueueOverflow
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
PauseResumeControl
What the peer connection tells the PauseResumeInterceptor while it runs: a local stream it sends made inactive or active again (W3C webrtc-pc RTCRtpEncodingParameters active), 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.
PauseState
Where a local RTP stream is in the state machine of RFC 7728 section 6 (Figure 4).
RateControlState
What the rate controller should be doing.
ReceivedRateBound
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.
RemotePauseState
What a receiver knows of a remote RTP stream it can pause.
RetransmissionRateLimit
How the NACK responder holds its retransmissions to the congestion controller’s target (RFC 4588 section 7), read from Attribute::TargetBitrateChanged as it passes on the read leg. Until a target has passed, and in a chain without a congestion controller, nothing is held back.
RtcpProfile
The RTP profile whose RTCP timing rules apply.
RtcpSessionControl
What an application (or the peer connection) tells the session while it runs.
RtcpSessionEvent
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.
ThresholdTimeBase
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)).
TmmbrControl
What an application tells the TMMBR requester (the congestion control interceptor), written into the chain with into_packet.
UlpfecError
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.
FLEXFEC03_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_window supports: 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::WithinTarget takes, 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: its kMaxNackRetries is 100 (modules/video_coding/nack_requester.cc at a222406d, line 39), the limit of the Chrome behaviour 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 NtpTimestampInterceptor sits 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 is QueueOverflow’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 kSendThresholdPercent has 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 RetransmissionRateLimit measures the rates over (libwebrtc’s kRetransmitWindowSizeMs).
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 ccm parameter of a=rtcp-fb that negotiates the messages (RFC 7728 section 9).
RTCP_FB_NACK_ECN
The nack parameter 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-xr unilateral 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-format of 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§

BandwidthEstimator
A congestion control algorithm: acknowledged packets in, a target bitrate out.
Interceptor
One interceptor of packet processing.
RtcpRandom
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_type are 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 config an 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. None for 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’s config from 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 onelevelonly media type parameter in an a=fmtp parameter string (RFC 5109 13): true for onelevelonly=1, false for 0, 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§

BoxedInterceptor
An interceptor whose concrete type has been erased.
TaggedPacket
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.