Struct AudioJitterBuffer
pub struct AudioJitterBuffer { /* private fields */ }Expand description
Adaptive jitter buffer for audio playback.
Implementations§
§impl AudioJitterBuffer
impl AudioJitterBuffer
pub fn new(config: JitterConfig) -> AudioJitterBuffer
pub fn new(config: JitterConfig) -> AudioJitterBuffer
Create a new jitter buffer with the given configuration.
pub fn state(&self) -> BufferState
pub fn state(&self) -> BufferState
Current buffer state.
pub fn underrun_count(&self) -> u64
pub fn underrun_count(&self) -> u64
Total underrun events since creation.
pub fn jitter_estimate_us(&self) -> f64
pub fn jitter_estimate_us(&self) -> f64
Current smoothed jitter estimate in microseconds.
pub fn push(&mut self, samples: &[i16])
pub fn push(&mut self, samples: &[i16])
Push audio samples into the buffer (called when network data arrives).
pub fn pull(&mut self, out: &mut [i16]) -> usize
pub fn pull(&mut self, out: &mut [i16]) -> usize
Pull audio samples for playback.
Fills out with audio data. If the buffer underruns, fills remaining
slots with silence (zero) for click-free output.
Returns the number of real (non-silence) samples written.
pub fn flush(&mut self)
pub fn flush(&mut self)
Flush the buffer immediately (used for barge-in).
Drops all buffered audio and resets to the Filling state. This produces instant silence when the user starts speaking.
pub fn reset(&mut self)
pub fn reset(&mut self)
Reset the buffer completely, including jitter estimates.
Auto Trait Implementations§
impl Freeze for AudioJitterBuffer
impl RefUnwindSafe for AudioJitterBuffer
impl Send for AudioJitterBuffer
impl Sync for AudioJitterBuffer
impl Unpin for AudioJitterBuffer
impl UnwindSafe for AudioJitterBuffer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more