#[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
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.source: AudioTrackSourceWhere 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.