From dbe7925d8304933ac9764cc897e0d648bce5073e Mon Sep 17 00:00:00 2001 From: Link Mauve Date: Sun, 25 Jan 2026 18:30:06 +0100 Subject: [PATCH] xmpp-parsers: Use #[xml(flag)] for rtcp-mux Also test that it gets deserialized correctly. --- parsers/ChangeLog | 1 + parsers/src/jingle_rtp.rs | 14 +++++--------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/parsers/ChangeLog b/parsers/ChangeLog index 0aa4821a..4b4353ce 100644 --- a/parsers/ChangeLog +++ b/parsers/ChangeLog @@ -12,6 +12,7 @@ XXXX-YY-ZZ RELEASER - Remove the unnecessary SaslMechanisms struct, to directly extract SASL mechanisms in a Vec in StreamFeatures. - bind::BindFeature::required is now a bool, thanks to xso’s flag. + - jingle_rtp::Description::rtcp_mux is now a bool flag too. * Improvements: - Make Priority’s inner i8 pub, which had been broken since the conversion to xso. (!632) diff --git a/parsers/src/jingle_rtp.rs b/parsers/src/jingle_rtp.rs index d655f079..96110e76 100644 --- a/parsers/src/jingle_rtp.rs +++ b/parsers/src/jingle_rtp.rs @@ -11,12 +11,6 @@ use crate::jingle_rtp_hdrext::RtpHdrext; use crate::jingle_ssma::{Group, Source}; 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. #[derive(FromXml, AsXml, PartialEq, Debug, Clone)] #[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 /// described in RFC 5761. - #[xml(child(default))] - pub rtcp_mux: Option, + #[xml(flag(name = "rtcp-mux"))] + pub rtcp_mux: bool, /// List of ssrc-group. #[xml(child(n = ..))] @@ -60,7 +54,7 @@ impl Description { media, ssrc: None, payload_types: Vec::new(), - rtcp_mux: None, + rtcp_mux: false, ssrc_groups: Vec::new(), ssrcs: Vec::new(), hdrexts: Vec::new(), @@ -208,11 +202,13 @@ mod tests { + " .parse() .unwrap(); let desc = Description::try_from(elem).unwrap(); assert_eq!(desc.media, "audio"); assert_eq!(desc.ssrc, None); + assert_eq!(desc.rtcp_mux, true); } }