mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-26 13:31:00 +00:00
webrtcsrc: add twcc extension to codec-preferences when present
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1245>
This commit is contained in:
parent
02c77d2e44
commit
f00a169081
1 changed files with 30 additions and 1 deletions
|
@ -26,6 +26,9 @@ static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
|||
)
|
||||
});
|
||||
|
||||
const RTP_TWCC_URI: &str =
|
||||
"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01";
|
||||
|
||||
struct Settings {
|
||||
stun_server: Option<String>,
|
||||
signaller: Signallable,
|
||||
|
@ -656,7 +659,7 @@ impl WebRTCSrc {
|
|||
.formats()
|
||||
.filter_map(|format| {
|
||||
format.parse::<i32>().ok().and_then(|pt| {
|
||||
let mediacaps = media.caps_from_media(pt)?;
|
||||
let mut mediacaps = media.caps_from_media(pt)?;
|
||||
let s = mediacaps.structure(0).unwrap();
|
||||
if !codec_names.contains(s.get::<&str>("encoding-name").ok()?) {
|
||||
return None;
|
||||
|
@ -671,6 +674,32 @@ impl WebRTCSrc {
|
|||
}
|
||||
}));
|
||||
|
||||
if media
|
||||
.attributes_to_caps(mediacaps.get_mut().unwrap())
|
||||
.is_err()
|
||||
{
|
||||
gst::warning!(
|
||||
CAT,
|
||||
imp: self,
|
||||
"Failed to retrieve attributes from media!"
|
||||
);
|
||||
return None;
|
||||
}
|
||||
|
||||
let s = mediacaps.structure(0).unwrap();
|
||||
|
||||
filtered_s.extend(s.iter().filter_map(|(key, value)| {
|
||||
if key.starts_with("extmap-") {
|
||||
if let Ok(s) = value.get::<String>() {
|
||||
if s == RTP_TWCC_URI {
|
||||
return Some((key, value.to_owned()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
}));
|
||||
|
||||
Some(filtered_s)
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue