whepsrc: Fix incorrect default caps

add-transceiver needs application/x-rtp caps and not raw caps. We were
providing raw caps which is incorrect.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1748>
This commit is contained in:
Sanchayan Maity 2024-08-23 19:34:48 +05:30
parent 66727188cf
commit d274caeb35
2 changed files with 33 additions and 18 deletions

View file

@ -13198,7 +13198,7 @@
"construct": false,
"construct-only": false,
"controllable": false,
"default": "audio/x-opus",
"default": "application/x-rtp, media=(string)audio, encoding-name=(string)OPUS, payload=(int)96, clock-rate=(int)48000",
"mutable": "null",
"readable": true,
"type": "GstCaps",
@ -13284,7 +13284,7 @@
"construct": false,
"construct-only": false,
"controllable": false,
"default": "video/x-vp8; video/x-h264; video/x-vp9; video/x-h265; video/x-av1",
"default": "application/x-rtp, media=(string)video, payload=(int)101, encoding-name=(string)VP8, clock-rate=(int)90000; application/x-rtp, media=(string)video, payload=(int)102, encoding-name=(string)VP9, clock-rate=(int)90000; application/x-rtp, media=(string)video, payload=(int)103, encoding-name=(string)H264, clock-rate=(int)90000; application/x-rtp, media=(string)video, payload=(int)104, encoding-name=(string)H265, clock-rate=(int)90000; application/x-rtp, media=(string)video, payload=(int)105, encoding-name=(string)AV1, clock-rate=(int)90000",
"mutable": "null",
"readable": true,
"type": "GstCaps",

View file

@ -50,23 +50,38 @@ struct Settings {
#[allow(clippy::derivable_impls)]
impl Default for Settings {
fn default() -> Self {
let video_caps = Some(
[
"video/x-vp8",
"video/x-h264",
"video/x-vp9",
"video/x-h265",
"video/x-av1",
]
.into_iter()
.map(gst::Structure::new_empty)
.collect::<gst::Caps>(),
);
let video_caps = {
let video = [
("VP8", 101),
("VP9", 102),
("H264", 103),
("H265", 104),
("AV1", 105),
];
let mut video_caps = gst::Caps::new_empty();
let caps = video_caps.get_mut().unwrap();
for (encoding, pt) in video {
let s = gst::Structure::builder("application/x-rtp")
.field("media", "video")
.field("payload", pt)
.field("encoding-name", encoding)
.field("clock-rate", 90000)
.build();
caps.append_structure(s);
}
Some(video_caps)
};
let audio_caps = Some(
["audio/x-opus"]
.into_iter()
.map(gst::Structure::new_empty)
.collect::<gst::Caps>(),
gst::Caps::builder("application/x-rtp")
.field("media", "audio")
.field("encoding-name", "OPUS")
.field("payload", 96)
.field("clock-rate", 48000)
.build(),
);
Self {