pub struct Policy { /* private fields */ }Expand description
Target follower and threshold calculator.
Implementations§
Source§impl Policy
impl Policy
Sourcepub fn new(cfg: PolicyConfig) -> Self
pub fn new(cfg: PolicyConfig) -> Self
New policy at the floor target.
Sourcepub fn need_with_granularity_us(
&self,
baseline_us: u64,
stall_peak_us: u64,
granularity_us: u64,
) -> u64
pub fn need_with_granularity_us( &self, baseline_us: u64, stall_peak_us: u64, granularity_us: u64, ) -> u64
Unclamped need:
max(k1 * baseline + margin, k2 * stall_peak, granularity + margin)
(the last term only when granularity_us > 0).
Sourcepub fn need_us(&self, baseline_us: u64, stall_peak_us: u64) -> u64
pub fn need_us(&self, baseline_us: u64, stall_peak_us: u64) -> u64
Unclamped need without a granularity floor:
max(k1 * baseline + margin, k2 * stall_peak).
Sourcepub fn granularity_need_us(&self, granularity_us: u64) -> u64
pub fn granularity_need_us(&self, granularity_us: u64) -> u64
The delivery-granularity floor: granularity + margin, 0 when there is
no granularity to cover.
Sourcepub fn follow(&mut self, need_us: u64, now_us: u64) -> u64
pub fn follow(&mut self, need_us: u64, now_us: u64) -> u64
Asymmetric follower: rise instantly, fall at most
max_step_down_per_s. Returns the new target.
Sourcepub fn resume(&self, stall_peak: Duration) -> Duration
pub fn resume(&self, stall_peak: Duration) -> Duration
Post-stall resume threshold: clamp(max(target, after_rebuffer * stall_peak)).
Sourcepub fn reprime_floor(&self) -> Duration
pub fn reprime_floor(&self) -> Duration
The configured voluntary re-prime floor (0 when disabled).
Sourcepub fn reprime_hold(&self) -> Duration
pub fn reprime_hold(&self) -> Duration
The configured re-prime hold.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Policy
impl Freeze for Policy
impl Move 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
Mutably borrows from an owned value. Read more