xmpp-parsers: Use #[xml(flag)] for rtcp-mux
Also test that it gets deserialized correctly.
This commit is contained in:
parent
4d6e1363db
commit
dbe7925d83
2 changed files with 6 additions and 9 deletions
|
|
@ -12,6 +12,7 @@ XXXX-YY-ZZ RELEASER <admin@example.com>
|
||||||
- Remove the unnecessary SaslMechanisms struct, to directly extract
|
- Remove the unnecessary SaslMechanisms struct, to directly extract
|
||||||
SASL mechanisms in a Vec<String> in StreamFeatures.
|
SASL mechanisms in a Vec<String> in StreamFeatures.
|
||||||
- bind::BindFeature::required is now a bool, thanks to xso’s flag.
|
- bind::BindFeature::required is now a bool, thanks to xso’s flag.
|
||||||
|
- jingle_rtp::Description::rtcp_mux is now a bool flag too.
|
||||||
* Improvements:
|
* Improvements:
|
||||||
- Make Priority’s inner i8 pub, which had been broken since the
|
- Make Priority’s inner i8 pub, which had been broken since the
|
||||||
conversion to xso. (!632)
|
conversion to xso. (!632)
|
||||||
|
|
|
||||||
|
|
@ -11,12 +11,6 @@ use crate::jingle_rtp_hdrext::RtpHdrext;
|
||||||
use crate::jingle_ssma::{Group, Source};
|
use crate::jingle_ssma::{Group, Source};
|
||||||
use crate::ns;
|
use crate::ns;
|
||||||
|
|
||||||
/// Specifies the ability to multiplex RTP Data and Control Packets on a single port as
|
|
||||||
/// described in RFC 5761.
|
|
||||||
#[derive(FromXml, AsXml, PartialEq, Debug, Clone)]
|
|
||||||
#[xml(namespace = ns::JINGLE_RTP, name = "rtcp-mux")]
|
|
||||||
pub struct RtcpMux;
|
|
||||||
|
|
||||||
/// Wrapper element describing an RTP session.
|
/// Wrapper element describing an RTP session.
|
||||||
#[derive(FromXml, AsXml, PartialEq, Debug, Clone)]
|
#[derive(FromXml, AsXml, PartialEq, Debug, Clone)]
|
||||||
#[xml(namespace = ns::JINGLE_RTP, name = "description")]
|
#[xml(namespace = ns::JINGLE_RTP, name = "description")]
|
||||||
|
|
@ -36,8 +30,8 @@ pub struct Description {
|
||||||
|
|
||||||
/// Specifies the ability to multiplex RTP Data and Control Packets on a single port as
|
/// Specifies the ability to multiplex RTP Data and Control Packets on a single port as
|
||||||
/// described in RFC 5761.
|
/// described in RFC 5761.
|
||||||
#[xml(child(default))]
|
#[xml(flag(name = "rtcp-mux"))]
|
||||||
pub rtcp_mux: Option<RtcpMux>,
|
pub rtcp_mux: bool,
|
||||||
|
|
||||||
/// List of ssrc-group.
|
/// List of ssrc-group.
|
||||||
#[xml(child(n = ..))]
|
#[xml(child(n = ..))]
|
||||||
|
|
@ -60,7 +54,7 @@ impl Description {
|
||||||
media,
|
media,
|
||||||
ssrc: None,
|
ssrc: None,
|
||||||
payload_types: Vec::new(),
|
payload_types: Vec::new(),
|
||||||
rtcp_mux: None,
|
rtcp_mux: false,
|
||||||
ssrc_groups: Vec::new(),
|
ssrc_groups: Vec::new(),
|
||||||
ssrcs: Vec::new(),
|
ssrcs: Vec::new(),
|
||||||
hdrexts: Vec::new(),
|
hdrexts: Vec::new(),
|
||||||
|
|
@ -208,11 +202,13 @@ mod tests {
|
||||||
<payload-type xmlns='urn:xmpp:jingle:apps:rtp:1' clockrate='8000' id='102' name='telephone-event'>
|
<payload-type xmlns='urn:xmpp:jingle:apps:rtp:1' clockrate='8000' id='102' name='telephone-event'>
|
||||||
<parameter xmlns='urn:xmpp:jingle:apps:rtp:1' name='events' value='0-15'/>
|
<parameter xmlns='urn:xmpp:jingle:apps:rtp:1' name='events' value='0-15'/>
|
||||||
</payload-type>
|
</payload-type>
|
||||||
|
<rtcp-mux/>
|
||||||
</description>"
|
</description>"
|
||||||
.parse()
|
.parse()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let desc = Description::try_from(elem).unwrap();
|
let desc = Description::try_from(elem).unwrap();
|
||||||
assert_eq!(desc.media, "audio");
|
assert_eq!(desc.media, "audio");
|
||||||
assert_eq!(desc.ssrc, None);
|
assert_eq!(desc.ssrc, None);
|
||||||
|
assert_eq!(desc.rtcp_mux, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue