removed abs-send-time, added back grouping element

This commit is contained in:
Jasper Hugo 2021-12-14 21:42:47 +07:00
parent 594414138c
commit cdb61f5a6b
1 changed files with 13 additions and 23 deletions

View File

@ -18,6 +18,7 @@ use xmpp_parsers::{
iq::Iq, iq::Iq,
jingle::{Action, Content, Creator, Description, Jingle, Senders, Transport}, jingle::{Action, Content, Creator, Description, Jingle, Senders, Transport},
jingle_dtls_srtp::{Fingerprint, Setup}, jingle_dtls_srtp::{Fingerprint, Setup},
jingle_grouping::{self, Semantics},
jingle_ice_udp::{self, Transport as IceUdpTransport}, jingle_ice_udp::{self, Transport as IceUdpTransport},
jingle_rtcp_fb::RtcpFb, jingle_rtcp_fb::RtcpFb,
jingle_rtp::{self, Description as RtpDescription, PayloadType, RtcpMux}, jingle_rtp::{self, Description as RtpDescription, PayloadType, RtcpMux},
@ -34,7 +35,6 @@ use crate::{
}; };
const RTP_HDREXT_SSRC_AUDIO_LEVEL: &str = "urn:ietf:params:rtp-hdrext:ssrc-audio-level"; const RTP_HDREXT_SSRC_AUDIO_LEVEL: &str = "urn:ietf:params:rtp-hdrext:ssrc-audio-level";
const RTP_HDREXT_ABS_SEND_TIME: &str = "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time";
const RTP_HDREXT_TRANSPORT_CC: &str = const RTP_HDREXT_TRANSPORT_CC: &str =
"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"; "http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01";
@ -119,7 +119,6 @@ struct ParsedRtpDescription {
codecs: Vec<Codec>, codecs: Vec<Codec>,
audio_hdrext_ssrc_audio_level: Option<u8>, audio_hdrext_ssrc_audio_level: Option<u8>,
audio_hdrext_transport_cc: Option<u8>, audio_hdrext_transport_cc: Option<u8>,
video_hdrext_abs_send_time: Option<u8>,
video_hdrext_transport_cc: Option<u8>, video_hdrext_transport_cc: Option<u8>,
} }
@ -181,7 +180,6 @@ impl JingleSession {
let mut vp9 = None; let mut vp9 = None;
let mut audio_hdrext_ssrc_audio_level = None; let mut audio_hdrext_ssrc_audio_level = None;
let mut audio_hdrext_transport_cc = None; let mut audio_hdrext_transport_cc = None;
let mut video_hdrext_abs_send_time = None;
let mut video_hdrext_transport_cc = None; let mut video_hdrext_transport_cc = None;
if description.media == "audio" { if description.media == "audio" {
@ -274,10 +272,7 @@ impl JingleSession {
for hdrext in description.hdrexts.iter() { for hdrext in description.hdrexts.iter() {
// TODO: .parse::<u8>() wont be needed after updating xmpp-parsers, it is now a u16 as // TODO: .parse::<u8>() wont be needed after updating xmpp-parsers, it is now a u16 as
// defined in the XEP and related RFC. // defined in the XEP and related RFC.
if hdrext.uri == RTP_HDREXT_ABS_SEND_TIME { if hdrext.uri == RTP_HDREXT_TRANSPORT_CC {
video_hdrext_abs_send_time = Some(hdrext.id.parse::<u8>()?);
}
else if hdrext.uri == RTP_HDREXT_TRANSPORT_CC {
video_hdrext_transport_cc = Some(hdrext.id.parse::<u8>()?); video_hdrext_transport_cc = Some(hdrext.id.parse::<u8>()?);
} }
} }
@ -327,7 +322,6 @@ impl JingleSession {
codecs, codecs,
audio_hdrext_ssrc_audio_level, audio_hdrext_ssrc_audio_level,
audio_hdrext_transport_cc, audio_hdrext_transport_cc,
video_hdrext_abs_send_time,
video_hdrext_transport_cc, video_hdrext_transport_cc,
})) }))
} }
@ -467,7 +461,6 @@ impl JingleSession {
let mut codecs = vec![]; let mut codecs = vec![];
let mut audio_hdrext_ssrc_audio_level = None; let mut audio_hdrext_ssrc_audio_level = None;
let mut audio_hdrext_transport_cc = None; let mut audio_hdrext_transport_cc = None;
let mut video_hdrext_abs_send_time = None;
let mut video_hdrext_transport_cc = None; let mut video_hdrext_transport_cc = None;
let mut remote_ssrc_map = HashMap::new(); let mut remote_ssrc_map = HashMap::new();
@ -478,7 +471,6 @@ impl JingleSession {
codecs.extend(description.codecs); codecs.extend(description.codecs);
audio_hdrext_ssrc_audio_level = audio_hdrext_ssrc_audio_level.or(description.audio_hdrext_ssrc_audio_level); audio_hdrext_ssrc_audio_level = audio_hdrext_ssrc_audio_level.or(description.audio_hdrext_ssrc_audio_level);
audio_hdrext_transport_cc = audio_hdrext_transport_cc.or(description.audio_hdrext_transport_cc); audio_hdrext_transport_cc = audio_hdrext_transport_cc.or(description.audio_hdrext_transport_cc);
video_hdrext_abs_send_time = video_hdrext_abs_send_time.or(description.video_hdrext_abs_send_time);
video_hdrext_transport_cc = video_hdrext_transport_cc.or(description.video_hdrext_transport_cc); video_hdrext_transport_cc = video_hdrext_transport_cc.or(description.video_hdrext_transport_cc);
} }
} }
@ -597,9 +589,6 @@ impl JingleSession {
.field("media", "video") .field("media", "video")
.field("clock-rate", 90000) .field("clock-rate", 90000)
.field("encoding-name", codec.encoding_name()); .field("encoding-name", codec.encoding_name());
// if let Some(hdrext) = video_hdrext_abs_send_time {
// caps = caps.field(&format!("extmap-{}", hdrext), &RTP_HDREXT_ABS_SEND_TIME);
// }
if let Some(hdrext) = video_hdrext_transport_cc { if let Some(hdrext) = video_hdrext_transport_cc {
caps = caps.field(&format!("extmap-{}", hdrext), &RTP_HDREXT_TRANSPORT_CC); caps = caps.field(&format!("extmap-{}", hdrext), &RTP_HDREXT_TRANSPORT_CC);
} }
@ -828,10 +817,10 @@ impl JingleSession {
let hdrext = RTPHeaderExtension::create_from_uri(&ext_uri) let hdrext = RTPHeaderExtension::create_from_uri(&ext_uri)
.context("failed to create hdrext")?; .context("failed to create hdrext")?;
hdrext.set_id(ext_id); hdrext.set_id(ext_id);
if ext_uri == RTP_HDREXT_ABS_SEND_TIME {}
if ext_uri == RTP_HDREXT_SSRC_AUDIO_LEVEL { if ext_uri == RTP_HDREXT_SSRC_AUDIO_LEVEL {
} }
else if ext_uri == RTP_HDREXT_TRANSPORT_CC { else if ext_uri == RTP_HDREXT_TRANSPORT_CC {
// hdrext.set_property("n-streams", 2u32)?;
} }
else { else {
bail!("unknown rtp hdrext: {}", ext_uri); bail!("unknown rtp hdrext: {}", ext_uri);
@ -938,9 +927,7 @@ impl JingleSession {
let hdrext = let hdrext =
RTPHeaderExtension::create_from_uri(&ext_uri).context("failed to create hdrext")?; RTPHeaderExtension::create_from_uri(&ext_uri).context("failed to create hdrext")?;
hdrext.set_id(ext_id); hdrext.set_id(ext_id);
if ext_uri == RTP_HDREXT_ABS_SEND_TIME { if ext_uri == RTP_HDREXT_SSRC_AUDIO_LEVEL {
}
else if ext_uri == RTP_HDREXT_SSRC_AUDIO_LEVEL {
} }
else if ext_uri == RTP_HDREXT_TRANSPORT_CC { else if ext_uri == RTP_HDREXT_TRANSPORT_CC {
// hdrext.set_property("n-streams", 2u32)?; // hdrext.set_property("n-streams", 2u32)?;
@ -994,9 +981,7 @@ impl JingleSession {
let hdrext = let hdrext =
RTPHeaderExtension::create_from_uri(&ext_uri).context("failed to create hdrext")?; RTPHeaderExtension::create_from_uri(&ext_uri).context("failed to create hdrext")?;
hdrext.set_id(ext_id); hdrext.set_id(ext_id);
if ext_uri == RTP_HDREXT_ABS_SEND_TIME { if ext_uri == RTP_HDREXT_TRANSPORT_CC {
}
else if ext_uri == RTP_HDREXT_TRANSPORT_CC {
// hdrext.set_property("n-streams", 2u32)?; // hdrext.set_property("n-streams", 2u32)?;
} }
else { else {
@ -1197,9 +1182,6 @@ impl JingleSession {
} }
} }
else if initiate_content.name.0 == "video" { else if initiate_content.name.0 == "video" {
// if let Some(hdrext) = video_hdrext_abs_send_time {
// description.hdrexts.push(RtpHdrext::new(hdrext.to_string(), RTP_HDREXT_ABS_SEND_TIME.to_owned()));
// }
if let Some(hdrext) = video_hdrext_transport_cc { if let Some(hdrext) = video_hdrext_transport_cc {
description.hdrexts.push(RtpHdrext::new( description.hdrexts.push(RtpHdrext::new(
hdrext.to_string(), hdrext.to_string(),
@ -1250,6 +1232,14 @@ impl JingleSession {
); );
} }
jingle_accept = jingle_accept.set_group(jingle_grouping::Group {
semantics: Semantics::Bundle,
contents: vec![
jingle_grouping::Content::new("video"),
jingle_grouping::Content::new("audio"),
],
});
let accept_iq_id = generate_id(); let accept_iq_id = generate_id();
let session_accept_iq = Iq::from_set(accept_iq_id.clone(), jingle_accept) let session_accept_iq = Iq::from_set(accept_iq_id.clone(), jingle_accept)
.with_to(Jid::Full(conference.focus_jid_in_muc()?)) .with_to(Jid::Full(conference.focus_jid_in_muc()?))