Struct webrtc_audio_processing::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
sourceimpl Processor
impl Processor
sourcepub fn new(config: &InitializationConfig) -> Result<Self, Error>
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.
sourcepub fn process_capture_frame(&mut self, frame: &mut [f32]) -> Result<(), Error>
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.
sourcepub fn process_capture_frame_noninterleaved(
&mut self,
frame: &mut Vec<Vec<f32>>
) -> Result<(), Error>
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.
sourcepub fn process_render_frame(&mut self, frame: &mut [f32]) -> Result<(), Error>
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.
sourcepub fn process_render_frame_noninterleaved(
&mut self,
frame: &mut Vec<Vec<f32>>
) -> Result<(), Error>
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.
sourcepub fn get_stats(&self) -> Stats
pub fn get_stats(&self) -> Stats
Returns statistics from the last process_capture_frame()
call.
sourcepub fn set_config(&mut self, config: Config)
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.
sourcepub fn set_output_will_be_muted(&self, muted: bool)
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
Auto Trait Implementations
impl RefUnwindSafe for Processor
impl Send for Processor
impl Sync for Processor
impl Unpin for Processor
impl UnwindSafe for Processor
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more