pub struct RtpPacketizer { /* private fields */ }ingest and (crate features rtsp or webrtc) only.Expand description
Packetizes H.264 Annex-B access units into RFC 6184 RTP packets — the inverse
of H264Depacketizer, used for WebRTC/WHEP egress.
Each NAL unit that fits the MTU is sent as a single-NAL packet; larger NALs are split into FU-A fragments. The RTP marker bit is set on the last packet of each access unit so the receiver knows the frame is complete.
Implementations§
Source§impl RtpPacketizer
impl RtpPacketizer
Sourcepub fn new(payload_type: u8, ssrc: u32, mtu: usize) -> Self
pub fn new(payload_type: u8, ssrc: u32, mtu: usize) -> Self
An H.264 packetizer for payload_type/ssrc. mtu is the maximum UDP
payload (1200 is the WebRTC-safe default); the 12-byte RTP header is
subtracted.
Sourcepub fn new_h265(payload_type: u8, ssrc: u32, mtu: usize) -> Self
pub fn new_h265(payload_type: u8, ssrc: u32, mtu: usize) -> Self
An H.265 (HEVC) packetizer, emitting the RFC 7798 payload format
(2-byte NAL header, FU type 49). Counterpart to new.
Sourcepub fn packetize(&mut self, access_unit: &[u8], timestamp: u32) -> Vec<Vec<u8>>
pub fn packetize(&mut self, access_unit: &[u8], timestamp: u32) -> Vec<Vec<u8>>
Packetize one Annex-B access unit at timestamp (90 kHz) into RTP packets.
Each NAL that fits the MTU is sent as a single-NAL packet; larger NALs are fragmented (FU-A for H.264, FU for H.265). The marker bit is set on the last packet of the access unit.
Trait Implementations§
Source§impl Clone for RtpPacketizer
impl Clone for RtpPacketizer
Source§fn clone(&self) -> RtpPacketizer
fn clone(&self) -> RtpPacketizer
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more