RtpPacket

Struct RtpPacket 

Source
pub struct RtpPacket { /* private fields */ }
Expand description

RTP packet.

Implementations§

Source§

impl RtpPacket

Source

pub const fn new() -> Self

Create a new RTP packet.

Source

pub fn from_parts( header: RtpHeader, payload: Bytes, ) -> Result<Self, InvalidInput>

Create a new RTP packets from given parts.

Source

pub fn deconstruct(self) -> (RtpHeader, Bytes)

Deconstruct the packet into its parts.

Source

pub fn decode(frame: Bytes) -> Result<Self, InvalidInput>

Decode RTP packet from given data frame.

Source

pub fn encode(&self, buf: &mut BytesMut)

Encode the packet.

Source

pub fn header(&self) -> &RtpHeader

Get the RTP header.

Source

pub fn marker(&self) -> bool

Get the marker bit value.

Source

pub fn with_marker(self, marker: bool) -> Self

Set the marker bit.

Source

pub fn payload_type(&self) -> u8

Get the payload type.

Note: Only the lower 7 bits are used.

Source

pub fn with_payload_type(self, payload_type: u8) -> Self

Set the payload type.

§Panics

The method panics if the payload type is greater than 127.

Source

pub fn sequence_number(&self) -> u16

Get the RTP sequence number.

Source

pub fn with_sequence_number(self, sequence_number: u16) -> Self

Set the RTP sequence number.

Source

pub fn timestamp(&self) -> u32

Get the RTP timestamp.

Source

pub fn with_timestamp(self, timestamp: u32) -> Self

Set the RTP timestamp.

Source

pub fn ssrc(&self) -> u32

Get the SSRC identifier.

Source

pub fn with_ssrc(self, ssrc: u32) -> Self

Set the SSRC identifier.

Source

pub fn csrcs(&self) -> &[u32]

Get the CSRC identifiers.

Source

pub fn with_csrcs<T>(self, csrcs: T) -> Self
where T: Into<Vec<u32>>,

Set the CSRC identifiers.

§Panics

The method panics if the number of identifiers is greater than 255.

Source

pub fn padding(&self) -> u8

Get length of the optional padding.

Zero means that the padding is not used at all.

Source

pub fn payload(&self) -> &Bytes

Get the packet payload including the optional padding.

Source

pub fn stripped_payload(&self) -> Bytes

Get the packet payload without any padding.

Source

pub fn with_payload(self, payload: Bytes, padding: u8) -> Self

Set the payload and add padding of a given length.

If the padding is zero, no padding will be added and the padding bit in the RTP header will be set to zero.

Source

pub fn with_padded_payload(self, payload: Bytes) -> Self

Set the payload that already includes padding.

§Panics

The method panics if the given payload is empty, if the last byte is zero or if the length of the padding is greater than the length of the payload.

Source

pub fn raw_size(&self) -> usize

Get raw size of the packet (i.e. byte length of the encoded packet).

Trait Implementations§

Source§

impl AsRef<RtpPacket> for IncomingRtpPacket

Source§

fn as_ref(&self) -> &RtpPacket

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<RtpPacket> for OrderedRtpPacket

Source§

fn as_ref(&self) -> &RtpPacket

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Borrow<RtpPacket> for IncomingRtpPacket

Source§

fn borrow(&self) -> &RtpPacket

Immutably borrows from an owned value. Read more
Source§

impl Borrow<RtpPacket> for OrderedRtpPacket

Source§

fn borrow(&self) -> &RtpPacket

Immutably borrows from an owned value. Read more
Source§

impl Clone for RtpPacket

Source§

fn clone(&self) -> RtpPacket

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for RtpPacket

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<IncomingRtpPacket> for RtpPacket

Source§

fn from(packet: IncomingRtpPacket) -> Self

Converts to this type from the input type.
Source§

impl From<OrderedRtpPacket> for RtpPacket

Source§

fn from(packet: OrderedRtpPacket) -> Self

Converts to this type from the input type.
Source§

impl From<RtpPacket> for PacketMux

Source§

fn from(packet: RtpPacket) -> Self

Converts to this type from the input type.
Source§

impl<T, E> Sink<RtpPacket> for DefaultRtpTransceiver<T, E>
where T: Sink<RtpPacket>,

Source§

type Error = <T as Sink<RtpPacket>>::Error

The type of value produced by the sink when an error occurs.
Source§

fn poll_ready( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>

Attempts to prepare the Sink to receive a value. Read more
Source§

fn start_send( self: Pin<&mut Self>, packet: RtpPacket, ) -> Result<(), Self::Error>

Begin the process of sending a value to the sink. Each call to this function must be preceded by a successful call to poll_ready which returned Poll::Ready(Ok(())). Read more
Source§

fn poll_flush( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>

Flush any remaining output from this sink. Read more
Source§

fn poll_close( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>

Flush any remaining output and close this sink, if necessary. Read more
Source§

impl<P, E> Sink<RtpPacket> for MuxedRtcpHandler<P, E>

Source§

type Error = E

The type of value produced by the sink when an error occurs.
Source§

fn poll_ready( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>

Attempts to prepare the Sink to receive a value. Read more
Source§

fn start_send(self: Pin<&mut Self>, item: RtpPacket) -> Result<(), Self::Error>

Begin the process of sending a value to the sink. Each call to this function must be preceded by a successful call to poll_ready which returned Poll::Ready(Ok(())). Read more
Source§

fn poll_flush( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>

Flush any remaining output from this sink. Read more
Source§

fn poll_close( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>

Flush any remaining output and close this sink, if necessary. Read more
Source§

impl<T> Sink<RtpPacket> for RtpChannel<T>
where T: Sink<Bytes>,

Source§

type Error = <T as Sink<Bytes>>::Error

The type of value produced by the sink when an error occurs.
Source§

fn poll_ready( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>

Attempts to prepare the Sink to receive a value. Read more
Source§

fn start_send(self: Pin<&mut Self>, item: RtpPacket) -> Result<(), Self::Error>

Begin the process of sending a value to the sink. Each call to this function must be preceded by a successful call to poll_ready which returned Poll::Ready(Ok(())). Read more
Source§

fn poll_flush( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>

Flush any remaining output from this sink. Read more
Source§

fn poll_close( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>

Flush any remaining output and close this sink, if necessary. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

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

Source§

fn vzip(self) -> V