Skip to main content

ConstantBitrate

Struct ConstantBitrate 

Source
pub struct ConstantBitrate { /* private fields */ }
Expand description

An estimator that always says the same number.

Not a placeholder. It is the proof that BandwidthEstimator is usable with two methods, and it is what the interceptor’s own tests drive so that the interceptor’s behaviour — recording departures, resolving feedback, attaching the attribute — is separable from any algorithm’s.

It is also a legitimate configuration: a fixed rate with a pacer in front of it is what an application wants when the path is known and it would rather not have an algorithm second-guess it.

Implementations§

Source§

impl ConstantBitrate

Source

pub fn new(bits_per_second: f64) -> Self

An estimator fixed at bits_per_second.

Trait Implementations§

Source§

impl BandwidthEstimator for ConstantBitrate

Source§

fn on_reports(&mut self, _now: Instant, _reports: &[PacketReport])

Nothing to learn from: the answer does not depend on the question.

Source§

fn target_bitrate(&self) -> f64

The current estimate, in bits per second. Read more
Source§

fn handle_timeout(&mut self, _now: Instant)

Periodic work, for an estimator that has any. Most do not.
Source§

fn poll_timeout(&self) -> Option<Instant>

When this estimator next wants waking, or None if it does not. Read more
Source§

fn on_packet_sent(&mut self, _now: Instant, _size: usize)

A packet left for the network. With on_reports this is what lets an estimator tell “nothing was sent” from “something was sent and nothing came back”.
Source§

fn on_unreported_packet_sent(&mut self, _now: Instant, _size: usize)

A packet left for the network on a stream that negotiated no per-packet feedback (no transport-wide sequence numbers, no RFC 8888): nothing will ever report it, so an estimator that counts on feedback for what it sent (on_packet_sent) must not wait for this packet’s.
Source§

fn on_round_trip_time(&mut self, _now: Instant, _round_trip_time: Duration)

A round trip time measured from feedback: the instant a packet left to the instant the feedback naming it was read, less nothing, so it includes the receiver’s reporting delay.
Source§

fn set_external_bounds(&mut self, _min: Option<f64>, _max: Option<f64>)

Limits from outside the algorithm, in bits per second: what was negotiated (b=AS, b=TIAS), what the receiver asked for (TMMBR, REMB), what the circuit breaker allows. The interceptor combines them and hands over the tightest; None lifts the limit. An estimator that honours them keeps its target at or below max whatever it measures.
Source§

fn min_bitrate(&self) -> Option<f64>

The floor the target never goes under, in bits per second, when the estimator has one. It rides with the target as MinimumTarget, so the NACK responder knows where the original media cannot be lowered for retransmissions (RFC 4588 section 7).
Source§

fn on_receiver_report(&mut self, _now: Instant, _fraction_lost: f64)

The fraction lost a receiver report gave for a stream this endpoint sends, handed over only while the receiver sends no per-packet feedback (no TWCC, no RFC 8888): the loss-based half of an estimator can still run on it (draft-ietf-rmcat-gcc-02 section 7).
Source§

fn on_path_change(&mut self, _now: Instant)

The network path changed (a new selected candidate pair, a new interface): what was learnt about the old path says nothing about this one (RFC 8836 section 2, 1d).
Source§

fn on_congestion_marks(&mut self, _now: Instant, _marked: u64, _packets: u64)

Of packets RTP packets the receiver counted since its last ECN report, marked arrived ECN-CE (RFC 6679 section 5: the cumulative counters of its RTCP ECN Feedback packets and XR ECN Summary Reports, for a stream whose per-packet feedback is not RFC 8888, which carries the marks itself). Section 7.3.3: “The default reaction on the reception of these ECN-CE-marked packets MUST be to provide the congestion control algorithm with a congestion notification that triggers the algorithm to react as if packet loss had occurred.”
Source§

fn on_probe_result(&mut self, _now: Instant, _bits_per_second: f64)

A probe cluster showed the path carries bits_per_second (probe_estimate). Called only when bandwidth probing is on (CongestionControlBuilder::with_bandwidth_probing). An estimator that ignores it loses nothing but the faster start.
Source§

fn stats(&self) -> EstimatorStats

Whatever the algorithm wants to expose. Never load-bearing.
Source§

impl Clone for ConstantBitrate

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ConstantBitrate

Source§

impl Debug for ConstantBitrate

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.