mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-01-08 10:15:29 +00:00
rtp: av1: Drop padding OBUs too like Chrome does
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1628>
This commit is contained in:
parent
998b4734bf
commit
8840861861
3 changed files with 30 additions and 16 deletions
|
@ -532,7 +532,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))
|
||||||
|
|
|
@ -139,9 +139,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,
|
||||||
|
@ -751,7 +751,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
|
||||||
},
|
},
|
||||||
|
@ -810,6 +810,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,
|
||||||
|
@ -821,7 +829,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
|
||||||
},
|
},
|
||||||
|
@ -898,8 +906,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,
|
||||||
|
@ -942,7 +950,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<_>>()
|
||||||
|
|
|
@ -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,
|
||||||
],
|
],
|
||||||
false,
|
false,
|
||||||
|
@ -64,7 +64,7 @@ fn test_depayloader() {
|
||||||
],
|
],
|
||||||
vec![
|
vec![
|
||||||
0b0001_0010, 0,
|
0b0001_0010, 0,
|
||||||
0b0111_1010, 0b0000_0101, 1, 2, 3, 4, 5,
|
0b0011_0010, 0b0000_0101, 1, 2, 3, 4, 5,
|
||||||
],
|
],
|
||||||
vec![
|
vec![
|
||||||
0b0011_0010, 0b0000_1010, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
|
0b0011_0010, 0b0000_1010, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
|
||||||
|
@ -115,15 +115,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,
|
||||||
],
|
],
|
||||||
|
@ -141,7 +142,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,
|
||||||
],
|
],
|
||||||
|
@ -150,7 +152,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,
|
||||||
|
@ -183,7 +185,7 @@ fn test_payloader() {
|
||||||
let pay = h.element().unwrap();
|
let pay = h.element().unwrap();
|
||||||
pay.set_property(
|
pay.set_property(
|
||||||
"mtu",
|
"mtu",
|
||||||
gst_rtp::calc_packet_len(25, 0, 0)
|
gst_rtp::calc_packet_len(27, 0, 0)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
h.play();
|
h.play();
|
||||||
|
|
Loading…
Reference in a new issue