pub struct LiveDecoder { /* private fields */ }Expand description
Push-driven decoder for live FEC byte streams that arrive in chunks
of arbitrary length (network sockets, log replays, partial reads).
Mirrors LiveEncoder.
let mut dec = LiveDecoder::new(Rate::AmbePlus2_3600x2450);
let chunk: [u8; 23] = [0; 23]; // 2 full 9-byte frames + 5 byte residue
let frames = dec.push(&chunk);
assert_eq!(frames.len(), 2);
assert_eq!(dec.pending_bytes(), 5);Implementations§
Source§impl LiveDecoder
impl LiveDecoder
Sourcepub fn push(&mut self, bits: &[u8]) -> Vec<Result<Vec<i16>, VocoderError>>
pub fn push(&mut self, bits: &[u8]) -> Vec<Result<Vec<i16>, VocoderError>>
Append FEC bytes and emit zero or more PCM frames. Per-frame
errors surface as Err entries in the returned Vec; the
buffer drains regardless.
Sourcepub fn pending_bytes(&self) -> usize
pub fn pending_bytes(&self) -> usize
Bytes currently buffered (between 0 and fec_frame_bytes()-1
after every push returns).
Sourcepub fn discard_pending(&mut self)
pub fn discard_pending(&mut self)
Drop any pending bytes without decoding them.
Auto Trait Implementations§
impl Freeze for LiveDecoder
impl RefUnwindSafe for LiveDecoder
impl Send for LiveDecoder
impl Sync for LiveDecoder
impl Unpin for LiveDecoder
impl UnsafeUnpin for LiveDecoder
impl UnwindSafe for LiveDecoder
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