Skip to main content

AudioTrackOptions

Struct AudioTrackOptions 

Source
#[non_exhaustive]
pub struct AudioTrackOptions { pub source: AudioTrackSource, pub echo_cancellation: Option<bool>, pub noise_suppression: Option<bool>, pub auto_gain_control: Option<bool>, pub high_pass_filter: Option<bool>, }
Expand description

Options for [PeerConnectionFactory::create_audio_track_with_options].

All fields optional; Default::default() produces exactly what [PeerConnectionFactory::create_audio_track] produces. The struct is #[non_exhaustive] — construct via Default and assign fields.

The processing flags are constraints refining what this track asks of the factory’s APM chain (the one [PeerConnectionFactoryBuilder::with_apm] built — default: none): None inherits the chain’s state, Some(v) forces the stage on/off for this track’s source. They act one level above the flags list — with libwebrtc semantics this crate honors: a flag set per constraint only takes effect by engaging part of an APM the factory already has. On a factory without an APM (the default) they are inert — there is nothing in the capture pipeline for them to toggle; that is not a bug, the DSP chain genuinely doesn’t exist. They constrain the capture/send side only — received audio is never processed.

A LocalPush source bypasses the ADM device path entirely, so these flags only ever matter on AudioTrackSource::Adm — pushed audio has no echo to cancel.

ⓘ
let mic = factory.create_audio_track_with_options("mic", {
    let mut o = AudioTrackOptions::default();
    o.echo_cancellation = Some(true);      // target the APM chain
    o.noise_suppression = Some(true);
    o
})?;
let music = factory.create_audio_track_with_options("music", {
    let mut o = AudioTrackOptions::default();
    o.source = AudioTrackSource::LocalPush;
    o
})?;

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.
§source: AudioTrackSource

Where this track’s samples come from. Default: AudioTrackSource::Adm.

§echo_cancellation: Option<bool>

AEC3 echo cancellation for this track’s source.

§noise_suppression: Option<bool>

Noise suppression for this track’s source.

§auto_gain_control: Option<bool>

Automatic gain control for this track’s source.

§high_pass_filter: Option<bool>

High-pass filter for this track’s source.

Trait Implementations§

Source§

impl Default for AudioTrackOptions

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<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, 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.