#[non_exhaustive]pub struct Policy {
pub max: Rate,
pub min: Rate,
pub lower: Option<Rate>,
}Expand description
How a bandwidth estimate maps onto the bitrate a sender should produce at.
Build one with Policy::new. The behaviour is tuned for a live contribution
sender on a cellular uplink: give back bandwidth immediately when the pipe closes,
take it back slowly when it opens, and don’t twitch at every jitter in the estimate.
The deadband and ramp that implement that are deliberately not knobs; they are
properties of how congestion control behaves, not of any one sender.
The estimate handed in is expected to be this sender’s alone. Splitting one
connection’s estimate among the senders sharing it is
[bandwidth::Allocator]’s job, one layer down,
so nothing here holds a fraction back for anyone else.
#[non_exhaustive]: construct via Policy::new and set fields, so new
knobs stay additive.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.max: RateUpper bound, normally the bitrate the caller asked for. The estimate can only ever take the target down from here: an optimistic estimate is not a reason to send more than was configured.
min: RateLower bound. Below some rate the media isn’t worth sending, so the target
holds here and the transport’s priority queue sheds the excess instead.
Defaults to a tenth of max.
lower: Option<Rate>The next lower rendition’s max, when this one is encoded beside
lower renditions of the same source.
A grant below the band boundary (max + 2 * lower) / 3 disables this rendition,
since the lower one then serves viewers better than a starved copy of this one.
It resumes at the boundary once the grant clears it by the same 5% hysteresis
every move needs. It only disables while a session probes for it (see
Control::set_probed), since nothing else could raise the estimate to resume it.
None, the default, for the lowest or only rendition, which never disables. A
lower at or above max leaves no band, so it never disables either.
Implementations§
Trait Implementations§
impl Eq for Policy
impl StructuralPartialEq for Policy
Auto Trait Implementations§
impl Freeze for Policy
impl RefUnwindSafe for Policy
impl Send for Policy
impl Sync for Policy
impl Unpin for Policy
impl UnsafeUnpin for Policy
impl UnwindSafe for Policy
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.