mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-15 14:52:04 +00:00
webrtcsrc: add twcc extension to codec-preferences when present
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1248>
This commit is contained in:
parent
719455815f
commit
dbd8946608
1 changed files with 30 additions and 1 deletions
|
@ -133,6 +133,9 @@ static CODECS: Lazy<Codecs> = 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,
|
||||
|
@ -792,7 +795,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;
|
||||
|
@ -807,6 +810,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