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