pub enum Encoder {
G711(G711Codec),
Opus(OpusEncoder),
}Expand description
The encode half of a negotiated call codec.
G.711 is a stateless table lookup (the enum just carries the
μ-law/A-law choice); Opus owns a heap-backed encoder with
inter-frame state. Either way: feed one 20 ms frame at
pcm_sample_rate per call, in order.
Variants§
Implementations§
Source§impl Encoder
impl Encoder
Sourcepub fn pcm_sample_rate(&self) -> u32
pub fn pcm_sample_rate(&self) -> u32
The PCM rate this encoder consumes: 8 kHz for G.711, 16 kHz for Opus. Resample the microphone to this, not to a global constant.
Sourcepub fn frame_samples(&self) -> usize
pub fn frame_samples(&self) -> usize
Samples in one 20 ms frame at pcm_sample_rate:
160 for G.711, 320 for Opus.
Auto Trait Implementations§
impl !Sync for Encoder
impl Freeze for Encoder
impl RefUnwindSafe for Encoder
impl Send for Encoder
impl Unpin for Encoder
impl UnsafeUnpin for Encoder
impl UnwindSafe for Encoder
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