Skip to main content

EngineConfig

Struct EngineConfig 

Source
#[non_exhaustive]
pub struct EngineConfig {
Show 14 fields pub backend: Backend, pub processing: ProcessingConfig, pub encoder: EncoderCfg, pub jitter: JitterConfig, pub initial_ts48k: u32, pub playout_buffer_ms: u32, pub capture_queue_frames: usize, pub recv_queue_frames: usize, pub max_participants: usize, pub levels_interval_ms: u32, pub speaking_threshold_dbov: f32, pub device_poll_interval: Duration, pub processing_poll: Duration, pub dsp_sched: DspSchedConfig,
}
Expand description

Everything crate::AudioEngine::start needs.

#[non_exhaustive]: start from EngineConfig::default (the system devices) or EngineConfig::null and chain the with_ methods, or set fields on a let mut.

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.
§backend: Backend

Devices.

§processing: ProcessingConfig

Capture processing (echo cancellation, noise suppression, gain).

§encoder: EncoderCfg

Initial encoder settings.

§jitter: JitterConfig

Jitter-buffer settings for every participant.

§initial_ts48k: u32

The first capture timestamp (crate::EncodedFrame::ts48k). RTP recommends a random start.

§playout_buffer_ms: u32

Playback queued ahead of the output device, milliseconds (10..=200). Lower is less latency; higher survives scheduling hiccups.

§capture_queue_frames: usize

Capacity of the encoded-frame queue, in frames (20 ms each).

§recv_queue_frames: usize

Capacity of the receive queue, in frames.

§max_participants: usize

The most participants at once.

§levels_interval_ms: u32

Level reading interval, milliseconds (multiple of 10).

§speaking_threshold_dbov: f32

Level at or above which a stream counts as speaking, dBov.

§device_poll_interval: Duration

How often to look for added or removed devices (hot-plug). Zero turns polling off; device errors are still handled.

§processing_poll: Duration

How often the processing thread wakes to move audio. Must be well under 10 ms.

§dsp_sched: DspSchedConfig

How the processing thread asks the OS to schedule it (macOS and iOS; elsewhere it is reported as crate::DspSchedMode::Unsupported). The default, crate::DspSchedMode::Workgroup, is 0.2.4’s behaviour. Read once, as the thread starts; what it got is in crate::Stats::dsp_sched and crate::Stats::dsp_scheduling. crate::DspSchedConfig::from_env and crate::DspSchedConfig::from_lookup read one from the environment or an app’s settings.

Implementations§

Source§

impl EngineConfig

Source

pub fn null(device: NullDevice) -> Self

A config for the null device, everything else default.

Source

pub fn with_backend(self, backend: Backend) -> Self

Set backend.

Source

pub fn with_processing(self, processing: ProcessingConfig) -> Self

Source

pub fn with_capture_stage(self, stage: Box<dyn CaptureStage>) -> Self

Set the capture stage (ProcessingConfig::capture_stage), keeping the rest of processing.

Source

pub fn with_encoder(self, encoder: EncoderCfg) -> Self

Set encoder.

Source

pub fn with_jitter(self, jitter: JitterConfig) -> Self

Set jitter.

Source

pub fn with_initial_ts48k(self, ts48k: u32) -> Self

Source

pub fn with_playout_buffer_ms(self, ms: u32) -> Self

Source

pub fn with_capture_queue_frames(self, frames: usize) -> Self

Source

pub fn with_recv_queue_frames(self, frames: usize) -> Self

Source

pub fn with_max_participants(self, n: usize) -> Self

Source

pub fn with_levels_interval_ms(self, ms: u32) -> Self

Source

pub fn with_speaking_threshold_dbov(self, dbov: f32) -> Self

Source

pub fn with_device_poll_interval(self, every: Duration) -> Self

Source

pub fn with_processing_poll(self, every: Duration) -> Self

Source

pub fn with_dsp_sched(self, sched: DspSchedConfig) -> Self

Set dsp_sched.

Trait Implementations§

Source§

impl Debug for EngineConfig

Source§

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

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

impl Default for EngineConfig

Source§

fn default() -> Self

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

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<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more