diff --git a/parsers/ChangeLog b/parsers/ChangeLog index 64857e29..71000d98 100644 --- a/parsers/ChangeLog +++ b/parsers/ChangeLog @@ -19,6 +19,7 @@ XXXX-YY-ZZ RELEASER conversion to xso. (!632) - ibr::LegacyQuery now implements Default, allowing users to more easily construct it (!660) + - jingle_rtp::Description gained a bandwidth child. Version 0.22.0: 2025-10-28 pep diff --git a/parsers/src/jingle.rs b/parsers/src/jingle.rs index 6f2dfce1..fd529286 100644 --- a/parsers/src/jingle.rs +++ b/parsers/src/jingle.rs @@ -594,7 +594,7 @@ mod tests { assert_size!(Senders, 1); assert_size!(Disposition, 1); assert_size!(ContentId, 12); - assert_size!(Content, 152); + assert_size!(Content, 160); assert_size!(Reason, 12); assert_size!(ReasonElement, 24); assert_size!(SessionId, 12); @@ -609,7 +609,7 @@ mod tests { assert_size!(Senders, 1); assert_size!(Disposition, 1); assert_size!(ContentId, 24); - assert_size!(Content, 296); + assert_size!(Content, 304); assert_size!(Reason, 24); assert_size!(ReasonElement, 48); assert_size!(SessionId, 24); diff --git a/parsers/src/jingle_rtp.rs b/parsers/src/jingle_rtp.rs index 96110e76..2fb0023b 100644 --- a/parsers/src/jingle_rtp.rs +++ b/parsers/src/jingle_rtp.rs @@ -11,6 +11,45 @@ use crate::jingle_rtp_hdrext::RtpHdrext; use crate::jingle_ssma::{Group, Source}; use crate::ns; +generate_attribute!( + /// Value for the SDP "bwtype" parameter as listed in the IANA Session Description Protocol + /// Parameters Registry: + /// + /// See RFC8859. + BwType, "type", { + /// Not impacted. + Ct => "CT", + + /// For media-level usage, the aggregate of individual bandwidth values is considered. + As => "AS", + + /// Session-level usage represents session aggregate, and media-level usage indicates SUM + /// of the individual values while multiplexing. + Rs => "RS", + + /// Session-level usage represents session aggregate, and media-level usage indicates SUM + /// of the individual values while multiplexing. + Rr => "RR", + + /// Transport Independent Application Specific Maximum (TIAS) bandwidth modifier that does + /// not include transport overhead. + Tias => "TIAS", + } +); + +/// Allowable or preferred bandwidth for use by this application type. +#[derive(FromXml, AsXml, PartialEq, Debug, Clone)] +#[xml(namespace = ns::JINGLE_RTP, name = "description")] +pub struct Bandwidth { + /// Value for the SDP "bwtype" parameter as listed in the IANA Session Description Protocol + /// Parameters Registry: + #[xml(attribute)] + type_: BwType, + + #[xml(text)] + value: u32, +} + /// Wrapper element describing an RTP session. #[derive(FromXml, AsXml, PartialEq, Debug, Clone)] #[xml(namespace = ns::JINGLE_RTP, name = "description")] @@ -44,7 +83,11 @@ pub struct Description { /// List of header extensions. #[xml(child(n = ..))] pub hdrexts: Vec, - // TODO: Add support for and . + + /// Allowable or preferred bandwidth for use by this application type. + #[xml(child(default))] + pub bandwidth: Option, + // TODO: Add support for . } impl Description { @@ -58,6 +101,7 @@ impl Description { ssrc_groups: Vec::new(), ssrcs: Vec::new(), hdrexts: Vec::new(), + bandwidth: None, } } } @@ -162,7 +206,9 @@ mod tests { #[cfg(target_pointer_width = "32")] #[test] fn test_size() { - assert_size!(Description, 72); + assert_size!(BwType, 1); + assert_size!(Bandwidth, 8); + assert_size!(Description, 80); assert_size!(Channels, 1); assert_size!(PayloadType, 64); assert_size!(Parameter, 24); @@ -171,7 +217,9 @@ mod tests { #[cfg(target_pointer_width = "64")] #[test] fn test_size() { - assert_size!(Description, 136); + assert_size!(BwType, 1); + assert_size!(Bandwidth, 8); + assert_size!(Description, 144); assert_size!(Channels, 1); assert_size!(PayloadType, 104); assert_size!(Parameter, 48);