Struct webrtc_media::io::sample_builder::SampleBuilder

source ·
pub struct SampleBuilder<T: Depacketizer> { /* private fields */ }
Expand description

SampleBuilder buffers packets until media frames are complete.

Implementations§

source§

impl<T: Depacketizer> SampleBuilder<T>

source

pub fn new(max_late: u16, depacketizer: T, sample_rate: u32) -> Self

Constructs a new SampleBuilder. max_late is how long to wait until we can construct a completed Sample. max_late is measured in RTP packet sequence numbers. A large max_late will result in less packet loss but higher latency. The depacketizer extracts media samples from RTP packets. Several depacketizers are available in package github.com/pion/rtp/codecs.

source

pub fn with_max_time_delay(self, max_late_duration: Duration) -> Self

source

pub fn push(&mut self, p: Packet)

Adds an RTP Packet to self’s buffer.

Push does not copy the input. If you wish to reuse this memory make sure to copy before calling push

source

pub fn pop(&mut self) -> Option<Sample>

Compiles pushed RTP packets into media samples and then returns the next valid sample (or None if no sample is compiled).

source

pub fn pop_with_timestamp(&mut self) -> Option<(Sample, u32)>

Compiles pushed RTP packets into media samples and then returns the next valid sample with its associated RTP timestamp (or None if no sample is compiled).

Auto Trait Implementations§

§

impl<T> Freeze for SampleBuilder<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for SampleBuilder<T>
where T: RefUnwindSafe,

§

impl<T> Send for SampleBuilder<T>
where T: Send,

§

impl<T> Sync for SampleBuilder<T>
where T: Sync,

§

impl<T> Unpin for SampleBuilder<T>
where T: Unpin,

§

impl<T> UnwindSafe for SampleBuilder<T>
where T: UnwindSafe,

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>,

§

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>,

§

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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V