pub struct DependencyDescriptorWriter { /* private fields */ }Expand description
The send side of the Dependency Descriptor for one RTP stream (AV1 RTP specification A.4, A.8.3).
For each frame, in decode order, next_frame takes what the encoder
says about it and returns a FrameDescriptor, which writes the header extension of each
of the frame’s packets. The writer
- numbers the frames (
frame_number, one more per frame, wrapping after 65535); - picks, among the structure’s templates of the frame’s layer, the one that needs the fewest custom bits (none, when the frame follows a template);
- attaches the structure to the first packet of a coded video sequence and to no other;
- signals the active decode targets when they change, on every packet until
active_decode_targets_acknowledgedor a new coded video sequence with all of them active.
Implementations§
Source§impl DependencyDescriptorWriter
impl DependencyDescriptorWriter
Sourcepub fn new(
structure: FrameDependencyStructure,
initial_frame_number: u16,
) -> Result<Self>
pub fn new( structure: FrameDependencyStructure, initial_frame_number: u16, ) -> Result<Self>
Sourcepub fn structure(&self) -> &FrameDependencyStructure
pub fn structure(&self) -> &FrameDependencyStructure
The structure in force.
Sourcepub fn next_frame_number(&self) -> u16
pub fn next_frame_number(&self) -> u16
The number the next frame gets.
Sourcepub fn set_structure(
&mut self,
structure: FrameDependencyStructure,
) -> Result<()>
pub fn set_structure( &mut self, structure: FrameDependencyStructure, ) -> Result<()>
Replaces the structure, for the coded video sequence the next frame starts. All decode targets of the new structure are active.
Its template_id_offset SHOULD keep its template ids clear of the current structure’s
(FrameDependencyStructure::next_template_id_offset gives one that does), so that a
receiver that missed the new structure does not read the old templates into the new
ids.
§Errors
A structure that does not validate, or one with the current template_id_offset and
anything else different: “when template_id_offset of a new
template_dependency_structure is the same as in the existing
template_dependency_structure, all fields in both template_dependency_structures MUST
have identical values”.
Sourcepub fn active_decode_targets(&self) -> u32
pub fn active_decode_targets(&self) -> u32
The active decode targets, as a bitmask.
Sourcepub fn set_active_decode_targets(&mut self, bitmask: u32) -> Result<()>
pub fn set_active_decode_targets(&mut self, bitmask: u32) -> Result<()>
Changes the set of active decode targets (bit i for decode target i), for example
when the encoder stops producing a spatial layer. “Whenever the set of active Decode
targets changes, the sender MUST signal the new set”: from the next packet on every
descriptor carries the bitmask.
§Errors
A bitmask with bits beyond the structure’s decode targets.
Sourcepub fn active_decode_targets_acknowledged(&mut self)
pub fn active_decode_targets_acknowledged(&mut self)
Stops repeating the bitmask: the receiver is known to have a packet that carried it (a receiver report acknowledged one). One of the techniques A.4 names.
Sourcepub fn next_frame(
&mut self,
frame: &FrameDependencyTemplate,
starts_coded_video_sequence: bool,
) -> Result<FrameDescriptor>
pub fn next_frame( &mut self, frame: &FrameDependencyTemplate, starts_coded_video_sequence: bool, ) -> Result<FrameDescriptor>
Describes the next frame in decode order.
frame holds the frame’s own layer, decode target indications, frame differences
(how many frames back each frame it refers to is, in the frames given to this writer)
and chain differences. starts_coded_video_sequence is set for the first frame of a
coded video sequence (a key frame the stream can be joined at): its first packet
carries the structure.
§Errors
The stream’s first frame, or the first after set_structure,
does not start a coded video sequence (the receiver would never get the structure); the
structure has no template of the frame’s layer; or the frame’s values are ones
DependencyDescriptor::marshal refuses.