Struct Processor

Source
pub struct Processor { /* private fields */ }
Expand description

Processor provides an access to webrtc’s audio processing e.g. echo cancellation and automatic gain control. It can be cloned, and cloned instances share the same underlying processor module. It’s the recommended way to run the Processor in multi-threaded application.

Implementations§

Source§

impl Processor

Source

pub fn new(config: &InitializationConfig) -> Result<Self, Error>

Creates a new Processor. InitializationConfig is only used on instantiation, however new configs can be be passed to set_config() at any time during processing.

Source

pub fn process_capture_frame(&mut self, frame: &mut [f32]) -> Result<(), Error>

Processes and modifies the audio frame from a capture device by applying signal processing as specified in the config. frame should hold an interleaved f32 audio frame, with NUM_SAMPLES_PER_FRAME samples.

Source

pub fn process_capture_frame_noninterleaved( &mut self, frame: &mut Vec<Vec<f32>>, ) -> Result<(), Error>

Processes and modifies the audio frame from a capture device by applying signal processing as specified in the config. frame should be a Vec of length ‘num_capture_channels’, with each inner Vec representing a channel with NUM_SAMPLES_PER_FRAME samples.

Source

pub fn process_render_frame(&mut self, frame: &mut [f32]) -> Result<(), Error>

Processes and optionally modifies the audio frame from a playback device. frame should hold an interleaved f32 audio frame, with NUM_SAMPLES_PER_FRAME samples.

Source

pub fn process_render_frame_noninterleaved( &mut self, frame: &mut Vec<Vec<f32>>, ) -> Result<(), Error>

Processes and optionally modifies the audio frame from a playback device. frame should be a Vec of length ‘num_render_channels’, with each inner Vec representing a channel with NUM_SAMPLES_PER_FRAME samples.

Source

pub fn get_stats(&self) -> Stats

Returns statistics from the last process_capture_frame() call.

Source

pub fn set_config(&mut self, config: Config)

Immediately updates the configurations of the internal signal processor. May be called multiple times after the initialization and during processing.

Source

pub fn set_output_will_be_muted(&self, muted: bool)

Signals the AEC and AGC that the audio output will be / is muted. They may use the hint to improve their parameter adaptation.

Trait Implementations§

Source§

impl Clone for Processor

Source§

fn clone(&self) -> Processor

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. 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> 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> 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 = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.