pub struct RtpPacket<'a> { /* private fields */ }Expand description
A parsed RTP packet. A wrapper around a byte slice. Each field is only accessed when needed
Implementations§
source§impl<'a> RtpPacket<'a>
impl<'a> RtpPacket<'a>
sourcepub const MIN_RTP_PACKET_LEN: usize = 12usize
pub const MIN_RTP_PACKET_LEN: usize = 12usize
The minimum number of bytes a RTP packet must be to be parsed correctly
sourcepub const MAX_N_CSRCS: usize = 15usize
pub const MAX_N_CSRCS: usize = 15usize
The maximum number of CSRCs a RTP packet can contain
sourcepub fn parse(data: &'a [u8]) -> Result<RtpPacket<'a>, RtpParseError>
pub fn parse(data: &'a [u8]) -> Result<RtpPacket<'a>, RtpParseError>
Parse a byte slice into a RtpPacket. This implementation prefers to fail fast and will
return errors when the size of passed in data is not sufficient for values described in the
data.
sourcepub fn padding(&self) -> Option<u8>
pub fn padding(&self) -> Option<u8>
Returns the number of bytes of padding used by this packet or None
sourcepub fn n_csrcs(&self) -> u8
pub fn n_csrcs(&self) -> u8
Returns the number of Contribution Sources for this packet. May not be used by this packet.
sourcepub fn marker(&self) -> bool
pub fn marker(&self) -> bool
Returns whether the marker bit is set for this packet. The meaning of the marker bit is payload-specific
sourcepub fn payload_type(&self) -> u8
pub fn payload_type(&self) -> u8
Returns the payload type for this packet.
sourcepub fn sequence_number(&self) -> u16
pub fn sequence_number(&self) -> u16
Returns the sequence number for this packet
sourcepub fn csrc(&self) -> impl Iterator<Item = u32> + '_
pub fn csrc(&self) -> impl Iterator<Item = u32> + '_
Returns a (potentially empty) iterator over the Contribution Sources for this packet
sourcepub fn extension(&self) -> Option<(u16, &[u8])>
pub fn extension(&self) -> Option<(u16, &[u8])>
Returns the extension data for this packet. The first value is an identifier and is ‘defined by the RTP profile’. The second value is the extension data.
sourcepub fn as_builder(&'a self) -> RtpPacketBuilder<&'a [u8], &'a [u8]>
pub fn as_builder(&'a self) -> RtpPacketBuilder<&'a [u8], &'a [u8]>
Creates a builder that will be able to reconstruct this packet byte for byte (excluding any padding bytes). Any aspect of the returned builder can be modified.