#[non_exhaustive]pub struct Policy {
pub headroom: f64,
pub max: u64,
pub min: u64,
pub hysteresis: f64,
pub ramp: f64,
}Expand description
How a bandwidth estimate maps onto the bitrate a sender should produce at.
Build one with Policy::new and override what you need. The defaults are
tuned for a live contribution encoder 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.
#[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.headroom: f64Fraction of the estimate to target, reserving room for the other tracks sharing this connection (audio) and for transport overhead. Defaults to 0.9. Must be greater than 0; values above 1.0 target more than the link is estimated to carry and are clamped away.
max: u64Upper bound in bits per second, 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: u64Lower bound in bits per second. Below some rate the picture 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.
hysteresis: f64Ignore moves smaller than this fraction of the current target, so a jittering estimate doesn’t reconfigure the encoder every 100ms. Defaults to 0.05 (5%).
ramp: f64How fast the target may climb back, as a fraction of the current target per second. Defaults to 0.25 (25%/s, so ~3s from the floor back to a 2x higher rate). Drops ignore this and apply at once: overshooting a closing uplink costs a stalled picture, while undershooting an opening one costs only a few seconds of lower quality.