pub struct G722Decoder { /* private fields */ }Implementations§
Source§impl G722Decoder
impl G722Decoder
pub fn new() -> Self
pub fn with_options(rate: Bitrate, packed: bool, eight_k: bool) -> Self
Sourcepub fn decode_frame_into(
&mut self,
data: &[u8],
out: &mut [Sample],
) -> Result<usize, CodecError>
pub fn decode_frame_into( &mut self, data: &[u8], out: &mut [Sample], ) -> Result<usize, CodecError>
Decodes a G.722 frame into the caller-provided buffer.
Returns the number of samples written to out. Returns
CodecError::BufferTooSmall if out cannot accept all decoded
samples.
Sourcepub fn decode_frame(&mut self, data: &[u8]) -> PcmBuf
pub fn decode_frame(&mut self, data: &[u8]) -> PcmBuf
Decodes a G.722 frame into a freshly-allocated Vec.
Only available with the std feature.
Trait Implementations§
Source§impl Decoder for G722Decoder
impl Decoder for G722Decoder
Source§fn decode_into(
&mut self,
data: &[u8],
out: &mut [Sample],
) -> Result<usize, CodecError>
fn decode_into( &mut self, data: &[u8], out: &mut [Sample], ) -> Result<usize, CodecError>
Source§fn max_decode_samples(&self, n_bytes: usize) -> usize
fn max_decode_samples(&self, n_bytes: usize) -> usize
Upper bound on the number of samples that
decode_into will write
for an input of n_bytes bytes.Source§fn sample_rate(&self) -> u32
fn sample_rate(&self) -> u32
Get the sample rate of the decoded audio.
Source§fn enable_concealment(&mut self) -> bool
fn enable_concealment(&mut self) -> bool
Turn on the decoder’s own packet loss concealment, returning whether
Decoder::conceal_into will conceal. Off by default where keeping
it ready costs something on every decoded packet: G.711 and G.722
keep a history of the decoded audio, and have concealment only with
the plc feature. Opus’s and G.729’s are part of the decoder and
always on. The default returns false: no concealment.Source§fn conceal_into(
&mut self,
samples: usize,
out: &mut [Sample],
) -> Result<usize, CodecError>
fn conceal_into( &mut self, samples: usize, out: &mut [Sample], ) -> Result<usize, CodecError>
Conceal a lost packet: write
samples samples per channel of audio
to play in its place into out, returning the number written
(samples * channels). The decoder’s state carries on through the
loss as the codec allows, and the next packet decoded after it is
blended in. A long loss fades out: full level for 10 ms, silence at
60 ms (after G.711 Appendix I). Read moreSource§fn recover_into(
&mut self,
next: &[u8],
samples: usize,
out: &mut [Sample],
) -> Result<usize, CodecError>
fn recover_into( &mut self, next: &[u8], samples: usize, out: &mut [Sample], ) -> Result<usize, CodecError>
Rebuild a lost packet from
next, the packet that followed it, when
the codec carries redundancy for it (Opus in-band FEC), into out
like Decoder::conceal_into. next is not consumed: decode it
with decode_into afterwards. Read moreSource§fn recover(&mut self, next: &[u8], samples: usize) -> PcmBuf
fn recover(&mut self, next: &[u8], samples: usize) -> PcmBuf
Convenience wrapper that allocates a
Vec and calls recover_into.
Empty when the decoder can neither recover nor conceal.Auto Trait Implementations§
impl Freeze for G722Decoder
impl RefUnwindSafe for G722Decoder
impl Send for G722Decoder
impl Sync for G722Decoder
impl Unpin for G722Decoder
impl UnsafeUnpin for G722Decoder
impl UnwindSafe for G722Decoder
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