diff --git a/net/rtp/src/av1/depay/imp.rs b/net/rtp/src/av1/depay/imp.rs index 8c7d7ceb..4976aea3 100644 --- a/net/rtp/src/av1/depay/imp.rs +++ b/net/rtp/src/av1/depay/imp.rs @@ -553,7 +553,10 @@ impl RTPAv1Depay { first = false; // ignore these OBU types - if matches!(obu.obu_type, ObuType::TemporalDelimiter | ObuType::TileList) { + if matches!( + obu.obu_type, + ObuType::TemporalDelimiter | ObuType::TileList | ObuType::Padding + ) { gst::trace!(CAT, imp: self, "Dropping {:?} of size {element_size}", obu.obu_type); reader .seek(SeekFrom::Current(element_size as i64)) diff --git a/net/rtp/src/av1/depay/tests.rs b/net/rtp/src/av1/depay/tests.rs index b366effd..505ad77b 100644 --- a/net/rtp/src/av1/depay/tests.rs +++ b/net/rtp/src/av1/depay/tests.rs @@ -35,7 +35,7 @@ fn test_depayloader() { ), ( // 2 OBUs, last is fragmented vec![ 0b0110_0000, - 0b0000_0110, 0b0111_1000, 1, 2, 3, 4, 5, + 0b0000_0110, 0b0011_0000, 1, 2, 3, 4, 5, 0b0011_0000, 1, 2, 3, ], gst::ClockTime::from_seconds(1), @@ -68,7 +68,7 @@ fn test_depayloader() { ), ( gst::ClockTime::from_seconds(1), - vec![0b0001_0010, 0, 0b0111_1010, 0b0000_0101, 1, 2, 3, 4, 5], + vec![0b0001_0010, 0, 0b0011_0010, 0b0000_0101, 1, 2, 3, 4, 5], ), ( gst::ClockTime::from_seconds(1), diff --git a/net/rtp/src/av1/pay/imp.rs b/net/rtp/src/av1/pay/imp.rs index a50d73ba..a8a60f9a 100644 --- a/net/rtp/src/av1/pay/imp.rs +++ b/net/rtp/src/av1/pay/imp.rs @@ -127,9 +127,9 @@ impl RTPAv1Pay { // tile lists and temporal delimiters should not be transmitted, // see section 5 of the RTP AV1 spec match obu.obu_type { - // completely ignore tile lists - ObuType::TileList => { - gst::log!(CAT, imp: self, "ignoring tile list OBU"); + // completely ignore tile lists and padding + ObuType::TileList | ObuType::Padding => { + gst::log!(CAT, imp: self, "ignoring {:?} OBU", obu.obu_type); reader .seek(SeekFrom::Current( (obu.header_len + obu.leb_size + obu.size) as i64, @@ -656,7 +656,7 @@ mod tests { obus: VecDeque::from(vec![ ObuData { info: SizedObu { - obu_type: ObuType::Padding, + obu_type: ObuType::Frame, size: 3, ..base_obu }, @@ -715,6 +715,14 @@ mod tests { }, ..ObuData::default() }, + ObuData { + info: SizedObu { + obu_type: ObuType::SequenceHeader, + size: 0, + ..base_obu + }, + ..ObuData::default() + }, ObuData { info: SizedObu { obu_type: ObuType::Frame, @@ -726,7 +734,7 @@ mod tests { }, ObuData { info: SizedObu { - obu_type: ObuType::Padding, + obu_type: ObuType::Frame, size: 6, ..base_obu }, @@ -803,8 +811,8 @@ mod tests { ), ( Some(PacketOBUData { - obu_count: 4, - payload_size: 34, + obu_count: 5, + payload_size: 36, last_obu_fragment_size: None, omit_last_size_field: false, ends_temporal_unit: true, @@ -849,7 +857,8 @@ mod tests { state .obus .iter() - .filter(|o| o.info.obu_type != ObuType::TemporalDelimiter) + .filter(|o| o.info.obu_type != ObuType::TemporalDelimiter + && o.info.obu_type != ObuType::Padding) .cloned() .collect::>(), results[idx].1.obus.iter().cloned().collect::>() diff --git a/net/rtp/src/av1/pay/tests.rs b/net/rtp/src/av1/pay/tests.rs index 813f9d70..d8390b11 100644 --- a/net/rtp/src/av1/pay/tests.rs +++ b/net/rtp/src/av1/pay/tests.rs @@ -26,15 +26,16 @@ fn test_payloader() { let test_buffers: [(u64, Vec); 3] = [ ( 0, - vec![ // this should result in exactly 25 bytes for the RTP payload + vec![ // this should result in exactly 27 bytes for the RTP payload 0b0001_0010, 0, + 0b0000_1010, 0, 0b0011_0010, 0b0000_1100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0b0011_0010, 0b0000_1001, 1, 2, 3, 4, 5, 6, 7, 8, 9, ], ), ( 0, vec![ // these all have to go in separate packets since their IDs mismatch - 0b0111_1010, 0b0000_0100, 1, 2, 3, 4, + 0b0011_0010, 0b0000_0100, 1, 2, 3, 4, 0b0011_0110, 0b0010_1000, 0b0000_0101, 1, 2, 3, 4, 5, 0b0011_0110, 0b0100_1000, 0b0000_0001, 1, ], @@ -53,7 +54,8 @@ fn test_payloader() { false, // marker bit 0, // relative RTP timestamp vec![ // payload bytes - 0b0010_1000, + 0b0011_1000, + 0b0000_0001, 0b0000_1000, 0b0000_1101, 0b0011_0000, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0b0011_0000, 1, 2, 3, 4, 5, 6, 7, 8, 9, ], @@ -62,7 +64,7 @@ fn test_payloader() { 0, vec![ 0b0001_0000, - 0b0111_1000, 1, 2, 3, 4, + 0b0011_0000, 1, 2, 3, 4, ] ), ( false, @@ -95,7 +97,7 @@ fn test_payloader() { let pay = h.element().unwrap(); pay.set_property( "mtu", - 25u32 + rtp_types::RtpPacket::MIN_RTP_PACKET_LEN as u32, + 27u32 + rtp_types::RtpPacket::MIN_RTP_PACKET_LEN as u32, ); } h.play();