pub struct FecRate { /* private fields */ }Expand description
The loss-driven amount of FEC for one sender. See the module documentation.
Implementations§
Source§impl FecRate
impl FecRate
Sourcepub fn new(media_packets: u32, fec_packets: u32, adaptive: bool) -> Self
pub fn new(media_packets: u32, fec_packets: u32, adaptive: bool) -> Self
fec_packets repair packets per media_packets source packets until the loss is known;
adaptive false keeps that amount whatever the loss.
Sourcepub fn with_source_rate_first(self, source_rate_first: bool) -> Self
pub fn with_source_rate_first(self, source_rate_first: bool) -> Self
Whether stronger FEC waits until the source rate has been reduced (RFC 8627 section 8;
the default): once a congestion controller’s target went by, the amount of FEC rises
only when the source sent in the last second plus the FEC the higher amount adds fit
within that target, and the target for the application is lowered by the FEC asked for
so the source makes the room. false: the amount follows the loss at once, and only
the FEC sent is taken out of the target.
Sourcepub fn source_rate_first(&self) -> bool
pub fn source_rate_first(&self) -> bool
Whether stronger FEC waits until the source rate has been reduced.
Sourcepub fn on_media_sent(&mut self, now: Instant, size: usize, protected: bool)
pub fn on_media_sent(&mut self, now: Instant, size: usize, protected: bool)
A source packet of size octets was handed to the sender at now; protected: its
stream is one this sender protects. Retransmissions and repair packets are not source
packets.
Sourcepub fn media_bitrate(&mut self, now: Instant) -> f64
pub fn media_bitrate(&mut self, now: Instant) -> f64
The bit rate of the source packets handed to the sender in the last second at now.
Sourcepub fn with_latency_budget(self, latency_budget: Option<Duration>) -> Self
pub fn with_latency_budget(self, latency_budget: Option<Duration>) -> Self
The round trip within which a stream that can be repaired by retransmission gets no FEC
(RFC 8854 section 8); FEC_DEFAULT_LATENCY_BUDGET by default. None is the
application paying for proactive FEC: the amount follows the loss whatever the round
trip.
Sourcepub fn latency_budget(&self) -> Option<Duration>
pub fn latency_budget(&self) -> Option<Duration>
The latency budget in force.
Sourcepub fn round_trip_time(&self) -> Option<Duration>
pub fn round_trip_time(&self) -> Option<Duration>
The newest round trip measured to the receiver of a protected stream.
Sourcepub fn on_round_trip_time(&mut self, round_trip_time: Duration)
pub fn on_round_trip_time(&mut self, round_trip_time: Duration)
A round trip measured to the receiver of a protected stream.
Sourcepub fn retransmission_preferred(&self) -> bool
pub fn retransmission_preferred(&self) -> bool
Whether retransmission is to repair a stream that can be retransmitted, rather than FEC: the amount follows the loss, a latency budget is set, and the round trip measured is within it.
Sourcepub fn fec_packets_with(&self, retransmission: bool) -> u32
pub fn fec_packets_with(&self, retransmission: bool) -> u32
Repair packets for the next block of a stream; retransmission: whether the stream can
be repaired by retransmission. None while retransmission_preferred
or, for an amount that follows the loss within a latency budget, before any report told
the loss; otherwise fec_packets.
Sourcepub fn fec_packets_for(&self, media_packets: u32, retransmission: bool) -> u32
pub fn fec_packets_for(&self, media_packets: u32, retransmission: bool) -> u32
Repair packets for a block of media_packets source packets that closed short (or is
shorter than the configured block), as fec_packets_with
decides for a full one, and never more than the block has packets.
Sourcepub fn on_acknowledgements(
&mut self,
ssrc: Option<u32>,
acknowledgements: &[Acknowledgement],
)
pub fn on_acknowledgements( &mut self, ssrc: Option<u32>, acknowledgements: &[Acknowledgement], )
Per-packet feedback for one sequence number space: ssrc names the stream an RFC 8888
report is about, None is transport-wide feedback. Feeds loss_pattern.
Sourcepub fn loss_pattern(&self) -> Option<LossPattern>
pub fn loss_pattern(&self) -> Option<LossPattern>
Whether the recent losses were isolated, in bursts, or both (the last 32 runs of lost
packets; None before four runs were seen).
Sourcepub fn adaptive(&self) -> bool
pub fn adaptive(&self) -> bool
Whether the amount follows the loss (false: the configured amount whatever happens).
Sourcepub fn on_fraction_lost(&mut self, fraction_lost: u8)
pub fn on_fraction_lost(&mut self, fraction_lost: u8)
A receiver report’s fraction lost (RFC 3550 6.4.1, in 1/256) for a protected stream.
Sourcepub fn fec_packets(&self) -> u32
pub fn fec_packets(&self) -> u32
Repair packets for the next block: what the loss asks for, held, while the rule of RFC 8627 section 8 applies, to the amount in force until the source leaves room for more.
Sourcepub fn protects(&self) -> bool
pub fn protects(&self) -> bool
Whether any repair is to be sent now (for protection shapes whose amount is fixed: sent or not).
Sourcepub fn on_repair_sent(&mut self, now: Instant, size: usize)
pub fn on_repair_sent(&mut self, now: Instant, size: usize)
A repair packet of size octets left at now.
Sourcepub fn fec_bitrate(&mut self, now: Instant) -> f64
pub fn fec_bitrate(&mut self, now: Instant) -> f64
The bit rate of the repair packets of the last second at now.
Sourcepub fn media_target(&mut self, now: Instant, target: f64) -> f64
pub fn media_target(&mut self, now: Instant, target: f64) -> f64
The target the application encodes at, out of the congestion controller’s target:
what is left after the FEC (the FEC sent in the last second, or, while stronger FEC
waits for the source to give up rate, the FEC asked for if that is more).
Sourcepub fn on_read(
&mut self,
msg: &mut TaggedPacket,
protected: impl Fn(u32) -> bool,
)
pub fn on_read( &mut self, msg: &mut TaggedPacket, protected: impl Fn(u32) -> bool, )
Reads what an inbound packet tells the FEC rate, and takes the FEC out of a target it
carries: the receiver reports of protected streams feed the loss, the round trip the
RTCP session measured to one of them the latency rule, per-packet feedback (transport-wide,
and RFC 8888 reports on protected streams) the loss pattern, and an
Attribute::TargetBitrateChanged on the packet is lowered by the FEC bit rate.