pub struct JitterBuffer { /* private fields */ }Expand description
Bounded reorder window for GAP audio frames.
Implementations§
Source§impl JitterBuffer
impl JitterBuffer
Sourcepub fn new(capacity_per_source: usize) -> Self
pub fn new(capacity_per_source: usize) -> Self
Builds a jitter buffer that retains up to capacity_per_source
frames for each media_source_id.
§Panics
Panics if capacity_per_source == 0.
Sourcepub fn push(&mut self, frame: GapPayload) -> JitterPush
pub fn push(&mut self, frame: GapPayload) -> JitterPush
Inserts a frame into the buffer.
Sourcepub fn pop_in_order(&mut self, media_source_id: u32) -> Option<GapPayload>
pub fn pop_in_order(&mut self, media_source_id: u32) -> Option<GapPayload>
Pops the next frame for media_source_id if it is the next one
expected (i.e. its rtp_sequence is contiguous with the previous
pop). Returns None if the head of the queue is from the future
(caller should wait or skip via JitterBuffer::pop_force).
Sourcepub fn pop_force(&mut self, media_source_id: u32) -> Option<GapPayload>
pub fn pop_force(&mut self, media_source_id: u32) -> Option<GapPayload>
Forces the next frame out regardless of contiguity. Use this when the playout deadline is reached and the next-expected packet is still missing — the caller will play the next available frame and skip the gap.
Auto Trait Implementations§
impl Freeze for JitterBuffer
impl RefUnwindSafe for JitterBuffer
impl Send for JitterBuffer
impl Sync for JitterBuffer
impl Unpin for JitterBuffer
impl UnsafeUnpin for JitterBuffer
impl UnwindSafe for JitterBuffer
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
Source§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more