Skip to main content

LiveDecoder

Struct LiveDecoder 

Source
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

Source

pub fn new(rate: Rate) -> Self

Open a new live decoder at the given rate, all state cold.

Source

pub fn vocoder(&self) -> &Vocoder

Read-only access to the underlying Vocoder.

Source

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.

Source

pub fn pending_bytes(&self) -> usize

Bytes currently buffered (between 0 and fec_frame_bytes()-1 after every push returns).

Source

pub fn discard_pending(&mut self)

Drop any pending bytes without decoding them.

Source

pub fn reset(&mut self)

Reset all state — inner Vocoder + residual byte buffer.

Source

pub fn rate(&self) -> Rate

Configured rate.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.