mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-06-06 23:48:57 +00:00
rtp: av1: Drop padding OBUs too like Chrome does
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1624>
This commit is contained in:
parent
b4b56eb282
commit
bbe38b9599
4 changed files with 30 additions and 16 deletions
|
@ -553,7 +553,10 @@ impl RTPAv1Depay {
|
||||||
first = false;
|
first = false;
|
||||||
|
|
||||||
// ignore these OBU types
|
// 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);
|
gst::trace!(CAT, imp: self, "Dropping {:?} of size {element_size}", obu.obu_type);
|
||||||
reader
|
reader
|
||||||
.seek(SeekFrom::Current(element_size as i64))
|
.seek(SeekFrom::Current(element_size as i64))
|
||||||
|
|
|
@ -35,7 +35,7 @@ fn test_depayloader() {
|
||||||
), ( // 2 OBUs, last is fragmented
|
), ( // 2 OBUs, last is fragmented
|
||||||
vec![
|
vec![
|
||||||
0b0110_0000,
|
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,
|
0b0011_0000, 1, 2, 3,
|
||||||
],
|
],
|
||||||
gst::ClockTime::from_seconds(1),
|
gst::ClockTime::from_seconds(1),
|
||||||
|
@ -68,7 +68,7 @@ fn test_depayloader() {
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
gst::ClockTime::from_seconds(1),
|
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),
|
gst::ClockTime::from_seconds(1),
|
||||||
|
|
|
@ -127,9 +127,9 @@ impl RTPAv1Pay {
|
||||||
// tile lists and temporal delimiters should not be transmitted,
|
// tile lists and temporal delimiters should not be transmitted,
|
||||||
// see section 5 of the RTP AV1 spec
|
// see section 5 of the RTP AV1 spec
|
||||||
match obu.obu_type {
|
match obu.obu_type {
|
||||||
// completely ignore tile lists
|
// completely ignore tile lists and padding
|
||||||
ObuType::TileList => {
|
ObuType::TileList | ObuType::Padding => {
|
||||||
gst::log!(CAT, imp: self, "ignoring tile list OBU");
|
gst::log!(CAT, imp: self, "ignoring {:?} OBU", obu.obu_type);
|
||||||
reader
|
reader
|
||||||
.seek(SeekFrom::Current(
|
.seek(SeekFrom::Current(
|
||||||
(obu.header_len + obu.leb_size + obu.size) as i64,
|
(obu.header_len + obu.leb_size + obu.size) as i64,
|
||||||
|
@ -656,7 +656,7 @@ mod tests {
|
||||||
obus: VecDeque::from(vec![
|
obus: VecDeque::from(vec![
|
||||||
ObuData {
|
ObuData {
|
||||||
info: SizedObu {
|
info: SizedObu {
|
||||||
obu_type: ObuType::Padding,
|
obu_type: ObuType::Frame,
|
||||||
size: 3,
|
size: 3,
|
||||||
..base_obu
|
..base_obu
|
||||||
},
|
},
|
||||||
|
@ -715,6 +715,14 @@ mod tests {
|
||||||
},
|
},
|
||||||
..ObuData::default()
|
..ObuData::default()
|
||||||
},
|
},
|
||||||
|
ObuData {
|
||||||
|
info: SizedObu {
|
||||||
|
obu_type: ObuType::SequenceHeader,
|
||||||
|
size: 0,
|
||||||
|
..base_obu
|
||||||
|
},
|
||||||
|
..ObuData::default()
|
||||||
|
},
|
||||||
ObuData {
|
ObuData {
|
||||||
info: SizedObu {
|
info: SizedObu {
|
||||||
obu_type: ObuType::Frame,
|
obu_type: ObuType::Frame,
|
||||||
|
@ -726,7 +734,7 @@ mod tests {
|
||||||
},
|
},
|
||||||
ObuData {
|
ObuData {
|
||||||
info: SizedObu {
|
info: SizedObu {
|
||||||
obu_type: ObuType::Padding,
|
obu_type: ObuType::Frame,
|
||||||
size: 6,
|
size: 6,
|
||||||
..base_obu
|
..base_obu
|
||||||
},
|
},
|
||||||
|
@ -803,8 +811,8 @@ mod tests {
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
Some(PacketOBUData {
|
Some(PacketOBUData {
|
||||||
obu_count: 4,
|
obu_count: 5,
|
||||||
payload_size: 34,
|
payload_size: 36,
|
||||||
last_obu_fragment_size: None,
|
last_obu_fragment_size: None,
|
||||||
omit_last_size_field: false,
|
omit_last_size_field: false,
|
||||||
ends_temporal_unit: true,
|
ends_temporal_unit: true,
|
||||||
|
@ -849,7 +857,8 @@ mod tests {
|
||||||
state
|
state
|
||||||
.obus
|
.obus
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|o| o.info.obu_type != ObuType::TemporalDelimiter)
|
.filter(|o| o.info.obu_type != ObuType::TemporalDelimiter
|
||||||
|
&& o.info.obu_type != ObuType::Padding)
|
||||||
.cloned()
|
.cloned()
|
||||||
.collect::<Vec<_>>(),
|
.collect::<Vec<_>>(),
|
||||||
results[idx].1.obus.iter().cloned().collect::<Vec<_>>()
|
results[idx].1.obus.iter().cloned().collect::<Vec<_>>()
|
||||||
|
|
|
@ -26,15 +26,16 @@ fn test_payloader() {
|
||||||
let test_buffers: [(u64, Vec<u8>); 3] = [
|
let test_buffers: [(u64, Vec<u8>); 3] = [
|
||||||
(
|
(
|
||||||
0,
|
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,
|
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_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,
|
0b0011_0010, 0b0000_1001, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||||
],
|
],
|
||||||
), (
|
), (
|
||||||
0,
|
0,
|
||||||
vec![ // these all have to go in separate packets since their IDs mismatch
|
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, 0b0010_1000, 0b0000_0101, 1, 2, 3, 4, 5,
|
||||||
0b0011_0110, 0b0100_1000, 0b0000_0001, 1,
|
0b0011_0110, 0b0100_1000, 0b0000_0001, 1,
|
||||||
],
|
],
|
||||||
|
@ -53,7 +54,8 @@ fn test_payloader() {
|
||||||
false, // marker bit
|
false, // marker bit
|
||||||
0, // relative RTP timestamp
|
0, // relative RTP timestamp
|
||||||
vec![ // payload bytes
|
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,
|
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,
|
0b0011_0000, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||||
],
|
],
|
||||||
|
@ -62,7 +64,7 @@ fn test_payloader() {
|
||||||
0,
|
0,
|
||||||
vec![
|
vec![
|
||||||
0b0001_0000,
|
0b0001_0000,
|
||||||
0b0111_1000, 1, 2, 3, 4,
|
0b0011_0000, 1, 2, 3, 4,
|
||||||
]
|
]
|
||||||
), (
|
), (
|
||||||
false,
|
false,
|
||||||
|
@ -95,7 +97,7 @@ fn test_payloader() {
|
||||||
let pay = h.element().unwrap();
|
let pay = h.element().unwrap();
|
||||||
pay.set_property(
|
pay.set_property(
|
||||||
"mtu",
|
"mtu",
|
||||||
25u32 + rtp_types::RtpPacket::MIN_RTP_PACKET_LEN as u32,
|
27u32 + rtp_types::RtpPacket::MIN_RTP_PACKET_LEN as u32,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
h.play();
|
h.play();
|
||||||
|
|
Loading…
Reference in a new issue