pub struct Gcc { /* private fields */ }Expand description
Google Congestion Control.
§The two halves
reports ─┬─▶ SlopeEstimator ─▶ OveruseDetector ─▶ RateController ─┐
│ group, filter usage + adaptive AIMD ├─▶ min ─▶ target
│ threshold │
├─▶ RateCalculator ────────────────────────────────────▶─┘
│ what is actually arriving
└─▶ LossController ────────────────────────────────────▶─┘The two are combined by min: whichever signal is more pessimistic wins. A path can be
congested in either way independently — a deep buffer queues without losing, a shallow or lossy
one loses without queueing — so neither half alone is sufficient and taking the lower of the two
is the only combination that responds to both.
§Deliberate divergences from upstream
- D3 — one clamp. Applied once, here, from configuration. Upstream clamps inside the loss controller to a hard-coded 100 kb/s–100 Mb/s and again in the rate controller to the configured range, and the two disagree.
- D4 — loss may move the target alone. See
LossController. - No hidden headroom.
target_bitrateis what the pacer is asked for. Upstream’s pacer silently multiplies by 1.5, so its reported target and its wire rate differ by half again. - No clock. Every instant is a parameter, which is what makes a bitrate trajectory reproducible.
Implementations§
Source§impl Gcc
impl Gcc
Sourcepub fn new(initial: f64, min: f64, max: f64) -> Self
pub fn new(initial: f64, min: f64, max: f64) -> Self
An estimator starting at initial, held within min..=max.
Sourcepub fn delay_based_bitrate(&self) -> f64
pub fn delay_based_bitrate(&self) -> f64
The delay-based half’s current target, in bits per second.
Sourcepub fn loss_based_bitrate(&self) -> f64
pub fn loss_based_bitrate(&self) -> f64
The loss-based half’s current target, in bits per second.
Trait Implementations§
Source§impl BandwidthEstimator for Gcc
impl BandwidthEstimator for Gcc
Source§fn on_reports(&mut self, now: Instant, reports: &[PacketReport])
fn on_reports(&mut self, now: Instant, reports: &[PacketReport])
Packets whose fate the remote has now reported, in send order. Read more
Source§fn target_bitrate(&self) -> f64
fn target_bitrate(&self) -> f64
The current estimate, in bits per second. Read more
Source§fn stats(&self) -> EstimatorStats
fn stats(&self) -> EstimatorStats
Whatever the algorithm wants to expose. Never load-bearing.
Source§fn handle_timeout(&mut self, _now: Instant)
fn handle_timeout(&mut self, _now: Instant)
Periodic work, for an estimator that has any. Most do not.
Auto Trait Implementations§
impl Freeze for Gcc
impl RefUnwindSafe for Gcc
impl Send for Gcc
impl Sync for Gcc
impl Unpin for Gcc
impl UnsafeUnpin for Gcc
impl UnwindSafe for Gcc
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more