rtp: Don't restrict payload types for payloaders

WebRTC uses payload types 35-63 as dynamic payload types too to be able
to place more codec variants into the SDP offer.

Instead of allowing just certain payload types, completely remove any
restrictions and let the user decide. There's technically nothing wrong
with using any payload type, especially when using the encoding-name.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/551

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1587>
This commit is contained in:
Sebastian Dröge 2024-05-27 10:57:32 +03:00 committed by GStreamer Marge Bot
parent b4fd6cf362
commit 984a9fe5ff
7 changed files with 6 additions and 41 deletions

View file

@ -7184,7 +7184,7 @@
"presence": "always"
},
"src": {
"caps": "application/x-rtp:\n media: video\n payload: [ 96, 127 ]\n clock-rate: 90000\n encoding-name: AV1\n",
"caps": "application/x-rtp:\n media: video\n clock-rate: 90000\n encoding-name: AV1\n",
"direction": "src",
"presence": "always"
}
@ -7490,7 +7490,7 @@
"presence": "always"
},
"src": {
"caps": "application/x-rtp:\n media: audio\n payload: [ 96, 127 ]\n clock-rate: [ 1, 2147483647 ]\n encoding-name: MP4A-LATM\n",
"caps": "application/x-rtp:\n media: audio\n clock-rate: [ 1, 2147483647 ]\n encoding-name: MP4A-LATM\n",
"direction": "src",
"presence": "always"
}
@ -7691,7 +7691,7 @@
"presence": "always"
},
"src": {
"caps": "application/x-rtp:\n media: audio\n payload: 8\n clock-rate: 8000\napplication/x-rtp:\n media: audio\n payload: [ 96, 127 ]\n encoding-name: PCMA\n clock-rate: [ 1, 2147483647 ]\n",
"caps": "application/x-rtp:\n media: audio\n payload: 8\n clock-rate: 8000\napplication/x-rtp:\n media: audio\n encoding-name: PCMA\n clock-rate: [ 1, 2147483647 ]\n",
"direction": "src",
"presence": "always"
}
@ -7746,7 +7746,7 @@
"presence": "always"
},
"src": {
"caps": "application/x-rtp:\n media: audio\n payload: 0\n clock-rate: 8000\napplication/x-rtp:\n media: audio\n payload: [ 96, 127 ]\n encoding-name: PCMU\n clock-rate: [ 1, 2147483647 ]\n",
"caps": "application/x-rtp:\n media: audio\n payload: 0\n clock-rate: 8000\napplication/x-rtp:\n media: audio\n encoding-name: PCMU\n clock-rate: [ 1, 2147483647 ]\n",
"direction": "src",
"presence": "always"
}
@ -7824,7 +7824,7 @@
"presence": "always"
},
"src": {
"caps": "application/x-rtp:\n media: video\n payload: [ 96, 127 ]\n clock-rate: 90000\n encoding-name: { (string)VP8, (string)VP8-DRAFT-IETF-01 }\n",
"caps": "application/x-rtp:\n media: video\n clock-rate: 90000\n encoding-name: { (string)VP8, (string)VP8-DRAFT-IETF-01 }\n",
"direction": "src",
"presence": "always"
}
@ -7956,7 +7956,7 @@
"presence": "always"
},
"src": {
"caps": "application/x-rtp:\n media: video\n payload: [ 96, 127 ]\n clock-rate: 90000\n encoding-name: { (string)VP9, (string)VP9-DRAFT-IETF-01 }\n",
"caps": "application/x-rtp:\n media: video\n clock-rate: 90000\n encoding-name: { (string)VP9, (string)VP9-DRAFT-IETF-01 }\n",
"direction": "src",
"presence": "always"
}

View file

@ -527,7 +527,6 @@ impl ElementImpl for RTPAv1Pay {
gst::PadPresence::Always,
&gst::Caps::builder("application/x-rtp")
.field("media", "video")
.field("payload", gst::IntRange::new(96, 127))
.field("clock-rate", CLOCK_RATE as i32)
.field("encoding-name", "AV1")
.build(),

View file

@ -2036,35 +2036,6 @@ impl ElementImpl for RtpBasePay2 {
.timestamp_offset
.unwrap_or_else(|| rng.gen::<u32>());
let seqnum_offset = settings.seqnum_offset.unwrap_or_else(|| rng.gen::<u16>());
// Need to check pt against template caps if it's a non-dynamic PT
if pt < 96 {
let mut pt_found = false;
let templ_caps = self.src_pad.pad_template_caps();
for s in templ_caps.iter() {
let Ok(allowed_pt) = s.value("payload") else {
continue;
};
if allowed_pt.can_intersect(&(pt as i32).to_value()) {
pt_found = true;
break;
}
}
if !pt_found {
gst::error!(
CAT,
imp: self,
"Unsupported static payload type {pt}, not found in template caps {templ_caps}",
);
// We would now return NotNegotiated the next time a buffer is tried to be sent
// downstream.
return Err(gst::StateChangeError);
}
}
let stream = Stream {
pt,
ssrc,

View file

@ -95,7 +95,6 @@ impl ElementImpl for RtpMpeg4AudioPay {
gst::PadPresence::Always,
&gst::Caps::builder("application/x-rtp")
.field("media", "audio")
.field("payload", gst::IntRange::new(96i32, 127i32))
.field("clock-rate", gst::IntRange::new(1i32, i32::MAX))
.field("encoding-name", ENCODING_NAME)
/* All optional parameters

View file

@ -168,7 +168,6 @@ impl ElementImpl for RtpPcmaPay {
.structure(
gst::Structure::builder("application/x-rtp")
.field("media", "audio")
.field("payload", gst::IntRange::new(96i32, 127i32))
.field("encoding-name", "PCMA")
.field("clock-rate", gst::IntRange::new(1, i32::MAX))
.build(),
@ -271,7 +270,6 @@ impl ElementImpl for RtpPcmuPay {
.structure(
gst::Structure::builder("application/x-rtp")
.field("media", "audio")
.field("payload", gst::IntRange::new(96i32, 127i32))
.field("encoding-name", "PCMU")
.field("clock-rate", gst::IntRange::new(1, i32::MAX))
.build(),

View file

@ -197,7 +197,6 @@ impl ElementImpl for RtpVp8Pay {
gst::PadPresence::Always,
&gst::Caps::builder("application/x-rtp")
.field("media", "video")
.field("payload", gst::IntRange::new(96, 127))
.field("clock-rate", 90_000i32)
.field(
"encoding-name",

View file

@ -177,7 +177,6 @@ impl ElementImpl for RtpVp9Pay {
gst::PadPresence::Always,
&gst::Caps::builder("application/x-rtp")
.field("media", "video")
.field("payload", gst::IntRange::new(96, 127))
.field("clock-rate", 90_000i32)
.field(
"encoding-name",