Skip to main content

ControllerConfig

Struct ControllerConfig 

Source
#[non_exhaustive]
pub struct ControllerConfig { pub jitter: JitterConfig, pub policy: PolicyConfig, pub starve_threshold_us: Micros, pub nodata_after_us: Micros, pub track_silence_timeout_us: Micros, pub track_granularity: bool, pub granularity_hold_us: Micros, pub granularity_decay_us: Micros, }
Expand description

Whole-controller configuration.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§jitter: JitterConfig

Estimator configuration.

§policy: PolicyConfig

Policy configuration.

§starve_threshold_us: Micros

Starved when lead is at or below this while the clock advances (20 ms).

§nodata_after_us: Micros

No chunk for this long => pause reason NoData (200 ms).

§track_silence_timeout_us: Micros

A track with no delivery for this long is excluded from the effective media end (on_track_media / register_track), so a dead track cannot starve playback forever (3 s).

§track_granularity: bool

Per-track delivery-granularity floor on/off (default on): the target is kept at least max over tracks of (largest media-end step) + policy.margin_us, so a track that delivers in coarse bursts (MP2 audio in ~0.3 s bursts) cannot starve between bursts. See DESIGN.md section 0.7.

§granularity_hold_us: Micros

How long a track’s largest delivery step is held before it decays (30 s).

§granularity_decay_us: Micros

Linear decay of a held delivery step to zero after the hold (30 s).

Implementations§

Source§

impl ControllerConfig

Source

pub const DEFAULT: Self

The documented defaults.

Source

pub fn new( jitter: JitterConfig, policy: PolicyConfig, starve_threshold_us: Micros, nodata_after_us: Micros, ) -> Result<Self, Error>

Build and validate a configuration (the per-track silence timeout takes its default; change it with with_track_silence_timeout_us).

§Errors

See ControllerConfig::validate.

Source

pub fn with_track_silence_timeout_us( self, timeout_us: Micros, ) -> Result<Self, Error>

Replace the per-track silence timeout and re-validate.

§Errors

Error::InvalidConfig (ConfigField::TrackSilence) when zero.

Source

pub fn with_track_granularity(self, enabled: bool) -> Self

Switch the per-track delivery-granularity floor on or off.

Source

pub fn with_granularity_memory_us( self, hold_us: Micros, decay_us: Micros, ) -> Result<Self, Error>

Replace the granularity memory (hold, then linear decay) and re-validate.

§Errors

Error::InvalidConfig (ConfigField::GranularityDecay) when decay_us is zero.

Source

pub fn validate(&self) -> Result<(), Error>

Validate the parts and the cross-field rules (max_us within the histogram range, starve_threshold_us < min_us, non-zero silence timeout).

§Errors

Error::InvalidConfig / Error::ZeroLengthWindow.

Trait Implementations§

Source§

impl Clone for ControllerConfig

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 ControllerConfig

Source§

impl Debug for ControllerConfig

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for ControllerConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ControllerConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for ControllerConfig

Source§

impl PartialEq for ControllerConfig

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ControllerConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ControllerConfig

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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.