pub enum Decoder {
G711(G711Codec),
Opus(OpusDecoder),
}Expand description
The decode half of a negotiated call codec.
The loss-recovery calls are uniform so a receive loop can drive them without codec branches: for G.711 they are no-ops (append nothing, return 0) because G.711 carries no redundancy and its historical loss behavior — silence by absence — is the correct one to keep.
Variants§
Implementations§
Source§impl Decoder
impl Decoder
Sourcepub fn pcm_sample_rate(&self) -> u32
pub fn pcm_sample_rate(&self) -> u32
The PCM rate decoded frames come out at: 8 kHz for G.711, 16 kHz for Opus.
Sourcepub fn decode(
&mut self,
payload: &[u8],
out: &mut Vec<i16>,
) -> Result<usize, CoreError>
pub fn decode( &mut self, payload: &[u8], out: &mut Vec<i16>, ) -> Result<usize, CoreError>
Decode one received payload, appending PCM to out and
returning the sample count. Use the returned length — Opus
peers choose their own frame size.
Sourcepub fn recover_lost(
&mut self,
next_payload: &[u8],
out: &mut Vec<i16>,
) -> Result<usize, CoreError>
pub fn recover_lost( &mut self, next_payload: &[u8], out: &mut Vec<i16>, ) -> Result<usize, CoreError>
Recover a single lost frame from the packet that followed it (drive this on a one-packet RTP sequence gap). Opus decodes the next packet’s in-band FEC; G.711 has nothing to recover and appends nothing.
Auto Trait Implementations§
impl !Sync for Decoder
impl Freeze for Decoder
impl RefUnwindSafe for Decoder
impl Send for Decoder
impl Unpin for Decoder
impl UnsafeUnpin for Decoder
impl UnwindSafe for Decoder
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