pub struct Vp9LayerFilter { /* private fields */ }Expand description
Decides which packets of a layered VP9 stream to forward for a target spatial and temporal layer, from the payload descriptor alone (RFC 9628 sections 4.2 and 9).
A middlebox keeps one per receiver and gives it every packet of the stream in order. The rules it applies:
- a frame above the temporal layer in use is dropped; the temporal layer goes up after a
forwarded picture that is a switching up point (
U=1) or starts a key picture, and down at once; - of the spatial layers below the one in use, a frame is forwarded unless it says no
higher layer depends on it (
Z=1); - the spatial layer goes up at a frame of the wanted layer that does not predict from an
earlier picture (
P=0) and whose lower-layer dependency (D), if any, was forwarded, in a picture whose frame of the layer in use is such a frame too (a key picture): in any other picture the marker has already been given to the layer in use; - it goes down as soon as a frame of the lower layer is decodable for this receiver: at
once when the lower layers were being forwarded (full SVC), at that layer’s next
P=0 frame otherwise (K-SVC, simulcast in one stream), which the caller asks for with a PLI or FIR whenVp9LayerFilter::needs_key_framesays so.
Nothing is forwarded before a frame the receiver can start from (P=0 and D=0). A
stream without layer indices (L=0) is forwarded whole.
Implementations§
Source§impl Vp9LayerFilter
impl Vp9LayerFilter
Sourcepub fn new(target_sid: u8, target_tid: u8) -> Self
pub fn new(target_sid: u8, target_tid: u8) -> Self
A filter that selects spatial layer target_sid and the temporal layers up to
target_tid.
Sourcepub fn set_target(&mut self, target_sid: u8, target_tid: u8)
pub fn set_target(&mut self, target_sid: u8, target_tid: u8)
Changes the target layers. Each takes effect at the next point where the stream allows it (see the type’s description).
Sourcepub fn needs_key_frame(&self) -> bool
pub fn needs_key_frame(&self) -> bool
Whether the selection cannot be reached without a frame the receiver can start from: nothing has been forwarded yet, or a lower spatial layer is wanted whose frames were not being forwarded. The caller should request a key frame.
Sourcepub fn forward(&mut self, descriptor: &Vp9Packet, marker: bool) -> Vp9Forward
pub fn forward(&mut self, descriptor: &Vp9Packet, marker: bool) -> Vp9Forward
Decides for one packet: descriptor is its parsed payload descriptor (a Vp9Packet
after Depacketizer::depacketize) and marker its RTP marker bit.