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_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,
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.
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.
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.