pub struct H265MultiStreamDepacketizer { /* private fields */ }Expand description
The receiver of an HEVC bitstream carried in several RTP streams: MRST (several streams on one transport) and MRMT (several streams on several transports), RFC 7798 section 4.3: “Receivers MUST support all of SRST, MRST, and MRMT”. It holds the RTP streams of one bitstream, in dependency order, and passes their NAL units on in decoding order as RFC 7798 section 6 describes:
- When
sprop-max-don-diffis greater than 0 for any of the streams, the NAL units of all of them are stored in one de-packetization buffer with their AbsDon (section 4.6, derived along each stream) and leave, the smallest AbsDon first, while the AbsDon values span the highest stream’ssprop-max-don-diffor more (condition A) or the buffer holds more thansprop-depack-buf-nalusNAL units (condition B). Among equal AbsDon values a stream lower in the dependency order goes first. - Otherwise the NAL units are passed on in the order of their NTP timestamps; of the same timestamp, a dependee stream’s before a dependent’s, and one stream’s in transmission order. The caller gives each packet’s NTP timestamp (its RTP timestamp mapped through the stream’s sender reports). A NAL unit leaves once no stream can still deliver one that goes before it: every stream it depends on has shown a later timestamp, and every dependent stream received so far the same timestamp or a later one.
Duplicated and outdated packets (a sequence number not after the stream’s last) are removed
(section 6). Give each stream’s packets in sequence number order, after the jitter buffer:
an MRMT receiver feeds the packets of each transport’s streams into the same instance. The
grouping of the streams (which streams make one bitstream and their dependency order) is
signalled with RFC 5583 a=depend, which the application reads from the description.
Implementations§
Source§impl H265MultiStreamDepacketizer
impl H265MultiStreamDepacketizer
Sourcepub fn new(sprop_depack_buf_nalus: u16) -> Self
pub fn new(sprop_depack_buf_nalus: u16) -> Self
A receiver whose bitstream has this sprop-depack-buf-nalus (RFC 7798 section 7.1; 0
when the description gives none).
Sourcepub fn add_stream(&mut self, id: u32, sprop_max_don_diff: u16)
pub fn add_stream(&mut self, id: u32, sprop_max_don_diff: u16)
Adds the RTP stream id (an SSRC, or any number the caller tells the streams apart by)
with its sprop-max-don-diff. Streams are added in dependency order: a stream depends
only on streams added before it. Adding a stream already held changes nothing.
Sourcepub fn push(
&mut self,
stream: u32,
sequence_number: u16,
ntp: u64,
payload: &Bytes,
) -> Result<Vec<H265NalUnit>>
pub fn push( &mut self, stream: u32, sequence_number: u16, ntp: u64, payload: &Bytes, ) -> Result<Vec<H265NalUnit>>
Takes one RTP packet of stream stream: its sequence number, its NTP timestamp and its
payload. Returns the NAL units now due, in decoding order. A packet of a stream not
added, a duplicate and an outdated packet give nothing.
§Errors
Sourcepub fn flush(&mut self) -> Vec<H265NalUnit>
pub fn flush(&mut self) -> Vec<H265NalUnit>
Every NAL unit still waiting, in decoding order: no more packets are coming.