pub struct H264Packet {
pub is_avc: bool,
/* private fields */
}Expand description
H264Packet represents the H264 header that is stored in the payload of an RTP Packet
Fields§
§is_avc: boolWhether to emit AVCC length-prefixed output instead of Annex B start codes.
Implementations§
Source§impl H264Packet
impl H264Packet
Sourcepub fn with_deinterleaving(self, buffer: H264DeinterleavingBuffer) -> Self
pub fn with_deinterleaving(self, buffer: H264DeinterleavingBuffer) -> Self
Receives an interleaved stream (packetization-mode=2) in decoding order: NAL units
that carry a DON go through buffer before depacketize
returns them (RFC 6184 section 7.2.2). Without this, NAL units come out in the order
their packets hold them, which is decoding order for modes 0 and 1.
Sourcepub fn flush_deinterleaving(&mut self) -> Bytes
pub fn flush_deinterleaving(&mut self) -> Bytes
The NAL units still in the de-interleaving buffer, in decoding order and in the output
format of depacketize: for the end of the stream.
Sourcepub fn depacketize_at(&mut self, now: Instant, packet: &Bytes) -> Result<Bytes>
pub fn depacketize_at(&mut self, now: Instant, packet: &Bytes) -> Result<Bytes>
As depacketize, for a packet received at now: the
first NAL unit given to the de-interleaving buffer starts its sprop-init-buf-time
(H264DeinterleavingBuffer::push_at), so that
is_initial_buffering can end by the time as RFC 6184
section 7.2.2 has it, and not only by the depth or the DON spread.
§Errors
As depacketize.
Sourcepub fn is_initial_buffering(&self, now: Instant) -> bool
pub fn is_initial_buffering(&self, now: Instant) -> bool
Whether an interleaved stream’s receiver is still in initial buffering at now and so
is not to start decoding (RFC 6184 section 7.2.2;
H264DeinterleavingBuffer::is_initial_buffering). False without a de-interleaving
buffer: modes 0 and 1 have no initial buffering of their own.
Sourcepub fn depacketize_with_sequence_number(
&mut self,
sequence_number: u16,
packet: &Bytes,
) -> Result<Bytes>
pub fn depacketize_with_sequence_number( &mut self, sequence_number: u16, packet: &Bytes, ) -> Result<Bytes>
As depacketize, given the packet’s RTP sequence number:
when a packet is missing before this one, the fragments collected so far are discarded
with the rest of their NAL unit, in place of a NAL unit with a hole in it (RFC 6184
section 5.8: a receiver discards the following fragmentation units of a NAL unit after
a lost one). Give the packets in sequence number order.
§Errors
As depacketize.
Sourcepub fn nal_units(&mut self, packet: &Bytes) -> Result<Vec<H264NalUnit>>
pub fn nal_units(&mut self, packet: &Bytes) -> Result<Vec<H264NalUnit>>
The NAL units a payload completes, with the decoding order number and timestamp offset its packet type gives them: one for a single NAL unit packet, several for an aggregate, none or one for a fragment. Reserved packet types yield nothing (RFC 6184 section 5.4: a receiver ignores them). The de-interleaving buffer is not involved.
§Errors
Fails for an empty payload, an aggregate or fragment cut short, a NAL unit size that
runs past the payload, and a reassembly over MAX_FUA_NALU_SIZE.
Trait Implementations§
Source§impl Clone for H264Packet
impl Clone for H264Packet
Source§impl Debug for H264Packet
impl Debug for H264Packet
Source§impl Default for H264Packet
impl Default for H264Packet
Source§impl Depacketizer for H264Packet
impl Depacketizer for H264Packet
Source§fn depacketize(&mut self, packet: &Bytes) -> Result<Bytes>
fn depacketize(&mut self, packet: &Bytes) -> Result<Bytes>
depacketize parses the passed byte slice and stores the result in the H264Packet this method is called upon
Source§fn is_partition_head(&self, payload: &Bytes) -> bool
fn is_partition_head(&self, payload: &Bytes) -> bool
is_partition_head checks if this is the head of a packetized nalu stream.
Source§fn is_key_frame_start(&self, payload: &Bytes) -> bool
fn is_key_frame_start(&self, payload: &Bytes) -> bool
A packet that carries the first slice of an IDR picture (nal_unit_type 5 with
first_mb_in_slice 0, ITU-T H.264 sections 7.3.3 and 7.4.1.2.4: an IDR picture is
decoded without reference to any earlier picture): as a single NAL unit packet, as the
first fragment of an FU-A or FU-B, or inside an STAP-A or STAP-B behind nothing but
parameter sets, SEI and access unit delimiters (RFC 6184 sections 5.6 to 5.8).
Parameter sets sent in packets of their own before it belong to the same access unit
(the same RTP timestamp) and are not what this names.
Source§fn is_partition_tail(&self, marker: bool, _payload: &Bytes) -> bool
fn is_partition_tail(&self, marker: bool, _payload: &Bytes) -> bool
Source§fn has_key_frames(&self) -> bool
fn has_key_frames(&self) -> bool
false, the default, is a format whose
frames stand alone (audio) or one this depacketizer cannot speak for.