pub struct NackResponderBuilder { /* private fields */ }Expand description
Builder for the NackResponderInterceptor.
§Example
use rtci_interceptor::{Slot, Registry, NackResponderBuilder};
let chain = Registry::new()
.with(Slot::NackResponder, NackResponderBuilder::new()
.with_size(1024)
.build())
.build();Implementations§
Source§impl NackResponderBuilder
impl NackResponderBuilder
Sourcepub fn with_size(self, size: u16) -> Self
pub fn with_size(self, size: u16) -> Self
Set the size of the send buffer.
Size must be a power of 2 between 1 and 32768 (inclusive). Larger buffers can retransmit older packets but use more memory.
Sourcepub fn with_max_packet_age(self, max_packet_age: Option<Duration>) -> Self
pub fn with_max_packet_age(self, max_packet_age: Option<Duration>) -> Self
Set how long a sent packet is kept for retransmission: the rtx-time of RFC 4588
8.1, when one is signalled. A NACK for a packet sent longer ago is not answered.
Default: None, a packet is available for as long as the buffer holds it.
Sourcepub fn with_rate_limit(self, rate_limit: RetransmissionRateLimit) -> Self
pub fn with_rate_limit(self, rate_limit: RetransmissionRateLimit) -> Self
Set how retransmissions are held to the congestion controller’s target (RFC 4588
section 7). Default: RetransmissionRateLimit::WithinTarget, the RFC’s form;
RetransmissionRateLimit::UpToTarget is the limiter libwebrtc’s RtpSender has
when it is given one.
Sourcepub fn with_max_reserve_fraction(self, fraction: f64) -> Self
pub fn with_max_reserve_fraction(self, fraction: f64) -> Self
Set the most of the congestion controller’s target the retransmission reserve of
RetransmissionRateLimit::WithinTarget takes, from 0 (no reserve: the target is
never lowered) to 1. Default: MAX_RETRANSMISSION_RESERVE.
Sourcepub fn with_max_repair_age(self, max_repair_age: Option<Duration>) -> Self
pub fn with_max_repair_age(self, max_repair_age: Option<Duration>) -> Self
Set how old a packet may be and still be repaired: a NACK for a packet written to the responder longer ago is declined (RFC 8834 section 6.1: “the likelihood of them arriving in time to be useful need[s] to be considered before RTP retransmission is used”; RFC 4588 section 7: the sender “MAY selectively retransmit only the packets that it deems important and ignore NACK messages for other packets”).
A receiver that still asks for a video packet that old is waiting for a picture
nobody can use, so the first such request gives the stream up: everything sent on
it so far is forgotten (its buffer, the requests waiting), the retransmission reserve
they held is released at once, and the application is asked for a key frame (a Picture
Loss Indication with sender SSRC 0, RTCPeerConnectionEvent::OnKeyFrameRequest, as at
the pacer’s flush). What is written afterwards is buffered and repaired as ever. An
audio packet that old is not retransmitted and nothing else happens.
Default: MAX_REPAIR_AGE. None: a packet is repaired for as long as the buffer
holds it. This is the sender’s own judgement and is not announced.
An rtx-time takes its place. RFC 4588 section 8.1: rtx-time is “the maximum
time a sender will keep an original RTP packet in its buffers available for
retransmission”. Where one is in force for a stream (announced in the session
description or set by the application for its retransmission format,
NackControl::LocalRtxTime, or configured with
with_max_packet_age), that is how old a packet of the
stream may be and still be repaired, whether shorter or longer than this setting, and
this setting does nothing for the stream: a packet older than the rtx-time is not
retransmitted and nothing else happens (the stream is not given up, no key frame is
asked for: the receiver was told the time and “should take into account the signalled
sender retransmission buffer length”, section 8.8).
The rtx-time is that of the packet’s own retransmission format (RFC 4588 section 8.6:
a parameter of each RTX payload type, which apt ties to one original payload type):
a RED packet’s is the one announced for the RTX of red, a plain packet’s the one of
its codec’s RTX. That one value decides all three for the packet: the cut at the time,
this setting where there is no time, and whether the packet’s age gives the stream up.
A packet that is never sent again (a FEC packet in RED on a stream without RTX, a
payload type without an RTX format on a stream that has RTX) gives nothing up by its
age: the receiver is not waiting for a picture because of it.
Sourcepub fn with_repair_backlog_bound(self, bound: Option<Duration>) -> Self
pub fn with_repair_backlog_bound(self, bound: Option<Duration>) -> Self
Set the backlog of repairs past which they are given up when the path’s capacity has
collapsed: the requests waiting would take this long or more to leave at the congestion
controller’s whole target, and the target is at most half of the highest in force
within the last two seconds. Every video stream with a request waiting is then given
up as with_max_repair_age describes (forgotten, the
reserve released, a key frame asked for). The targets from before a give-up no longer
count: the next one needs the target to halve again. RFC 4588 section 7: “If
congestion is not kept under control, then retransmission SHOULD NOT be used”: such a
backlog is repaired at a rate the path drops again, for seconds, while the original
media is held at the reserve’s floor.
A backlog at a steady target (ordinary loss, however heavy) is never given up: it
is repaired within the target. Audio requests count toward the backlog and are never
given up. Without a congestion controller’s target there is no such rule. An
rtx-time does not change it: the time is the most a packet is kept, and a collapse
ends the repairs of what was sent before it as the pacer’s flush does.
Default: REPAIR_BACKLOG_BOUND. None: every request is served in order.
Sourcepub fn build(self) -> NackResponderInterceptor
pub fn build(self) -> NackResponderInterceptor
Build the interceptor.