pub struct RtcpSessionBuilder { /* private fields */ }Expand description
Builder for RtcpSessionInterceptor.
use rtci_interceptor::{Registry, RtcpSessionBuilder, Slot};
let chain = Registry::new()
.with(Slot::RtcpSession, RtcpSessionBuilder::new().build())
.build();Implementations§
Source§impl RtcpSessionBuilder
impl RtcpSessionBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
A builder with the defaults: RTP/AVPF timing, a T_rr_interval of one second, RTCP at
5% of the measured media bitrate (a start-up value before it is measured), compound
packets only, congestion control feedback sent as it is built.
Sourcepub fn with_profile(self, profile: RtcpProfile) -> Self
pub fn with_profile(self, profile: RtcpProfile) -> Self
The profile whose timing rules apply. Default: RtcpProfile::Avpf.
Sourcepub fn with_t_rr_interval(self, t_rr_interval: Duration) -> Self
pub fn with_t_rr_interval(self, t_rr_interval: Duration) -> Self
T_rr_interval (RFC 4585 3.4): the minimum interval between regular (full compound)
reports under RTP/AVPF. Feedback is not held by it.
RFC 4585 4.2 makes the value zero when trr-int is not negotiated, which lets regular
reports use the whole RTCP bandwidth: a report every few tens of milliseconds beside a
video stream. The default here is one second (what this engine sent before, and what
browsers send); a negotiated trr-int (RtcpSessionControl::TrrInt) replaces it,
and zero gives the RFC’s default.
Sourcepub fn with_bandwidth(self, bandwidth: RtcpBandwidth) -> Self
pub fn with_bandwidth(self, bandwidth: RtcpBandwidth) -> Self
The bandwidth the session description gives (b=AS / b=TIAS, b=RS, b=RR).
Default: none, so the media bitrate is measured and RTCP gets 5% of it.
Sourcepub fn with_rtcp_fraction(self, fraction: f64) -> Self
pub fn with_rtcp_fraction(self, fraction: f64) -> Self
The share of the session bandwidth RTCP uses when b=RS / b=RR do not say. Default:
0.05, the value RFC 3550 6.2 recommends.
Sourcepub fn with_reduced_minimum(self, reduced_minimum: bool) -> Self
pub fn with_reduced_minimum(self, reduced_minimum: bool) -> Self
Under RTP/AVP, use the reduced minimum interval of RFC 3550 6.2 (360 divided by the session bandwidth in kbit/s) instead of five seconds.
Sourcepub fn with_reduced_size(self, reduced_size: bool) -> Self
pub fn with_reduced_size(self, reduced_size: bool) -> Self
Whether reduced-size RTCP (RFC 5506) was negotiated. Default: no, every packet is a compound packet.
Sourcepub fn with_mtu(self, mtu: usize) -> Self
pub fn with_mtu(self, mtu: usize) -> Self
The size compound packets are kept under (RFC 3550 6.1). Default:
RTCP_SESSION_DEFAULT_MTU.
Sourcepub fn with_cname(self, cname: impl Into<String>) -> Self
pub fn with_cname(self, cname: impl Into<String>) -> Self
The CNAME to use. Default: one generated as RFC 7022 section 4.2 describes.
Sourcepub fn with_point_to_point(self, point_to_point: bool) -> Self
pub fn with_point_to_point(self, point_to_point: bool) -> Self
Says whether the session is point to point instead of leaving it to the count of remote CNAMEs (RFC 8108 5.4.2: “unless signaling indicates”).
Sourcepub fn with_report_from_every_ssrc(self, every: bool) -> Self
pub fn with_report_from_every_ssrc(self, every: bool) -> Self
RFC 8108 5.1 to the letter: every local SSRC carries a report block for every remote SSRC. Default: off, the blocks are carried once, by the first local media SSRC (what browsers do, and what RFC 8861 reporting groups exist to allow).
Sourcepub fn with_immediate_congestion_feedback(self, immediate: bool) -> Self
pub fn with_immediate_congestion_feedback(self, immediate: bool) -> Self
Whether congestion control feedback (transport-wide feedback, RFC 8888 reports) leaves as soon as its generator writes it (the default), or waits its turn under RFC 4585 section 3.5.2 like other feedback: at most one Early packet per regular interval.
The generators size their own cadence to 5% of the media they report on, between 50
and 250 ms (TwccReceiverBuilder::with_adaptive_interval): congestion control feedback
is the sender’s congestion signal and is not held to the RTCP bandwidth the regular
reports share, as libwebrtc and the browsers send it. It goes as a reduced-size packet
where a=rtcp-rsize was negotiated, else in a minimal compound packet, and does not
move the regular reports’ timing. false is RFC 4585 as written: at low media rates
the session then sends feedback a few times a second, with gaps a sender’s estimator
does not climb through.
Sourcepub fn with_congestion_feedback_in_budget(self, in_budget: bool) -> Self
pub fn with_congestion_feedback_in_budget(self, in_budget: bool) -> Self
Whether the congestion control feedback that leaves at once
(Self::with_immediate_congestion_feedback) counts against the RTCP bandwidth the
regular reports share (true), or comes on top of it (false, the default).
With true the session measures the congestion control feedback it sends and receives
over the last two seconds, and spaces its regular reports so that they and the
feedback together stay inside the RTCP bandwidth (RFC 3550 section 6.2: 5% of the
session bandwidth): the regular interval computed with what the feedback leaves becomes
a T_rr_interval (RFC 4585 section 3.5.3, which suppresses regular reports inside it
and lets feedback through), no longer than five seconds. Regular reports become rarer
at low media rates and nothing else changes. Part of the Performance behaviour
profile.
Sourcepub fn with_minimum_session_bandwidth(self, bits_per_second: u64) -> Self
pub fn with_minimum_session_bandwidth(self, bits_per_second: u64) -> Self
The least session bandwidth the RTCP bandwidth is computed from when no b= line gives
one and the media is measured, bits per second. Default
RTCP_SESSION_MIN_BANDWIDTH (64 kbit/s). Below it the measured media rate is not
used, so a 24 kbit/s audio call reports as a 64 kbit/s one would (RFC 3550 section 6.2
lets the session bandwidth be the expected one). The Performance behaviour profile
takes 16 kbit/s, so the RTCP bandwidth follows the media down to there. Held to at
least 8 kbit/s, so a session with no media still reports.
Sourcepub fn with_joins_on_start(self, joins_on_start: bool) -> Self
pub fn with_joins_on_start(self, joins_on_start: bool) -> Self
Whether the session joins only when told RtcpSessionControl::Start (true), or at
the first control, packet or stream it is given (false, the default).
RFC 3550 section 6: RTCP is the control protocol of an RTP session, and there is none
until an RTP m= section is negotiated (RFC 8834 section 4.1). A peer connection knows
when that is, per transport, and joins the session then; with true nothing else makes
it join: until Start it sends nothing (no report, no SDES, no SSRC of its own), and
what is written to it as RTCP is dropped. After RtcpSessionControl::Leave, a
Start joins it again (RTCP resumes from a new reporting SSRC).
Sourcepub fn with_first_report_at_join(self, at_join: bool) -> Self
pub fn with_first_report_at_join(self, at_join: bool) -> Self
Whether the first compound packet goes out when the session joins (true), or after
the initial interval of RFC 3550 section 6.2 (false, the default).
RFC 8834 section 4.1, with RFC 3550 section 6.2 as RFC 8108 updates it: “The delay before sending the initial compound RTCP packet can be set to zero.” A peer connection joins a transport’s session when its keys exist, and reporting then tells the peer the endpoint’s SSRCs at once (RFC 3550 section 8.2: an SSRC collision is found from the first packet that shows it) and starts the round-trip and loss reports congestion control reads.
Sourcepub fn with_random(self, random: impl RtcpRandom + 'static) -> Self
pub fn with_random(self, random: impl RtcpRandom + 'static) -> Self
The source of the session’s random numbers; a test supplies one that repeats.
Sourcepub fn with_wall_clock(self, anchor: SystemInstant) -> Self
pub fn with_wall_clock(self, anchor: SystemInstant) -> Self
The wall-clock anchor the session’s NTP times (sender reports, XR receiver reference
times) derive from. Default: the process-wide SystemInstant::shared. Give one per
peer connection for reproducible virtual-time runs: two runs in one process otherwise
map the same instants to NTP times as far apart as the real time between them.
Sourcepub fn build_per_rtp_session(self) -> PerRtpSession<RtcpSessionInterceptor>
pub fn build_per_rtp_session(self) -> PerRtpSession<RtcpSessionInterceptor>
Builds an RTCP session per RTP session (crate::PerRtpSession): a peer connection
with sections on several transports runs an RTCP session on each (RFC 3550 section 6,
RFC 8834 section 4.4), every one with these settings, the same CNAME (RFC 7022
section 4.2: one per endpoint) and its own members, bandwidth and timers.
Sourcepub fn build(self) -> RtcpSessionInterceptor
pub fn build(self) -> RtcpSessionInterceptor
Builds the interceptor.