pub struct RtpPacket { /* private fields */ }Expand description
RTP packet.
Implementations§
Source§impl RtpPacket
impl RtpPacket
Sourcepub fn from_parts(
header: RtpHeader,
payload: Bytes,
) -> Result<Self, InvalidInput>
pub fn from_parts( header: RtpHeader, payload: Bytes, ) -> Result<Self, InvalidInput>
Create a new RTP packets from given parts.
Sourcepub fn deconstruct(self) -> (RtpHeader, Bytes)
pub fn deconstruct(self) -> (RtpHeader, Bytes)
Deconstruct the packet into its parts.
Sourcepub fn decode(frame: Bytes) -> Result<Self, InvalidInput>
pub fn decode(frame: Bytes) -> Result<Self, InvalidInput>
Decode RTP packet from given data frame.
Sourcepub fn with_marker(self, marker: bool) -> Self
pub fn with_marker(self, marker: bool) -> Self
Set the marker bit.
Sourcepub fn payload_type(&self) -> u8
pub fn payload_type(&self) -> u8
Get the payload type.
Note: Only the lower 7 bits are used.
Sourcepub fn with_payload_type(self, payload_type: u8) -> Self
pub fn with_payload_type(self, payload_type: u8) -> Self
Sourcepub fn sequence_number(&self) -> u16
pub fn sequence_number(&self) -> u16
Get the RTP sequence number.
Sourcepub fn with_sequence_number(self, sequence_number: u16) -> Self
pub fn with_sequence_number(self, sequence_number: u16) -> Self
Set the RTP sequence number.
Sourcepub fn with_timestamp(self, timestamp: u32) -> Self
pub fn with_timestamp(self, timestamp: u32) -> Self
Set the RTP timestamp.
Sourcepub fn with_csrcs<T>(self, csrcs: T) -> Self
pub fn with_csrcs<T>(self, csrcs: T) -> Self
Set the CSRC identifiers.
§Panics
The method panics if the number of identifiers is greater than 255.
Sourcepub fn padding(&self) -> u8
pub fn padding(&self) -> u8
Get length of the optional padding.
Zero means that the padding is not used at all.
Sourcepub fn stripped_payload(&self) -> Bytes
pub fn stripped_payload(&self) -> Bytes
Get the packet payload without any padding.
Sourcepub fn with_payload(self, payload: Bytes, padding: u8) -> Self
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.
Sourcepub fn with_padded_payload(self, payload: Bytes) -> Self
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.
Trait Implementations§
Source§impl AsRef<RtpPacket> for IncomingRtpPacket
impl AsRef<RtpPacket> for IncomingRtpPacket
Source§impl AsRef<RtpPacket> for OrderedRtpPacket
impl AsRef<RtpPacket> for OrderedRtpPacket
Source§impl Borrow<RtpPacket> for IncomingRtpPacket
impl Borrow<RtpPacket> for IncomingRtpPacket
Source§impl Borrow<RtpPacket> for OrderedRtpPacket
impl Borrow<RtpPacket> for OrderedRtpPacket
Source§impl From<IncomingRtpPacket> for RtpPacket
impl From<IncomingRtpPacket> for RtpPacket
Source§fn from(packet: IncomingRtpPacket) -> Self
fn from(packet: IncomingRtpPacket) -> Self
Source§impl From<OrderedRtpPacket> for RtpPacket
impl From<OrderedRtpPacket> for RtpPacket
Source§fn from(packet: OrderedRtpPacket) -> Self
fn from(packet: OrderedRtpPacket) -> Self
Source§impl<T, E> Sink<RtpPacket> for DefaultRtpTransceiver<T, E>
impl<T, E> Sink<RtpPacket> for DefaultRtpTransceiver<T, E>
Source§type Error = <T as Sink<RtpPacket>>::Error
type Error = <T as Sink<RtpPacket>>::Error
Source§fn poll_ready(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>>
fn poll_ready( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>
Sink to receive a value. Read moreSource§fn start_send(
self: Pin<&mut Self>,
packet: RtpPacket,
) -> Result<(), Self::Error>
fn start_send( self: Pin<&mut Self>, packet: RtpPacket, ) -> Result<(), Self::Error>
poll_ready which returned Poll::Ready(Ok(())). Read moreSource§impl<P, E> Sink<RtpPacket> for MuxedRtcpHandler<P, E>
impl<P, E> Sink<RtpPacket> for MuxedRtcpHandler<P, E>
Source§fn poll_ready(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>>
fn poll_ready( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>
Sink to receive a value. Read moreSource§fn start_send(self: Pin<&mut Self>, item: RtpPacket) -> Result<(), Self::Error>
fn start_send(self: Pin<&mut Self>, item: RtpPacket) -> Result<(), Self::Error>
poll_ready which returned Poll::Ready(Ok(())). Read moreSource§impl<T> Sink<RtpPacket> for RtpChannel<T>
impl<T> Sink<RtpPacket> for RtpChannel<T>
Source§type Error = <T as Sink<Bytes>>::Error
type Error = <T as Sink<Bytes>>::Error
Source§fn poll_ready(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>>
fn poll_ready( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>
Sink to receive a value. Read moreSource§fn start_send(self: Pin<&mut Self>, item: RtpPacket) -> Result<(), Self::Error>
fn start_send(self: Pin<&mut Self>, item: RtpPacket) -> Result<(), Self::Error>
poll_ready which returned Poll::Ready(Ok(())). Read more