forked from mirrors/gecko-dev
Bug 1875184 - vendor webrtc-sdp 0.3.11;r=mjf,supply-chain-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D198894
This commit is contained in:
parent
f444c4b1b3
commit
d2e23c69f4
15 changed files with 175 additions and 236 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
|
@ -6386,9 +6386,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "webrtc-sdp"
|
||||
version = "0.3.10"
|
||||
version = "0.3.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b27cfe685c697666a76932399d55026bf2a5a205d91d277fd16346f0c65a7c06"
|
||||
checksum = "c7351fba122c7f6566779efdef49d2213e842f69fa1c654eef1fd9301f425064"
|
||||
dependencies = [
|
||||
"log",
|
||||
"url",
|
||||
|
|
|
|||
|
|
@ -4286,6 +4286,11 @@ who = "Byron Campen <docfaraday@gmail.com>"
|
|||
criteria = "safe-to-deploy"
|
||||
delta = "0.3.9 -> 0.3.10"
|
||||
|
||||
[[audits.webrtc-sdp]]
|
||||
who = "Nicolas Grunbaum <ngrunbaum@mozilla.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.3.10 -> 0.3.11"
|
||||
|
||||
[[audits.weedle2]]
|
||||
who = "Travis Long <tlong@mozilla.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
2
third_party/rust/webrtc-sdp/CHANGELOG.md
vendored
2
third_party/rust/webrtc-sdp/CHANGELOG.md
vendored
|
|
@ -1,4 +1,6 @@
|
|||
# Changelog
|
||||
## [0.3.11] - 2024-01-17
|
||||
- Permit a wider set of payload type numbers
|
||||
## [0.3.10] - 2023-01-05
|
||||
- Permit inconsistent simulcast directions
|
||||
## [0.3.9] - 2022-01-12
|
||||
|
|
|
|||
104
third_party/rust/webrtc-sdp/Cargo.lock
generated
vendored
104
third_party/rust/webrtc-sdp/Cargo.lock
generated
vendored
|
|
@ -2,95 +2,78 @@
|
|||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "form_urlencoded"
|
||||
version = "1.0.1"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191"
|
||||
checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652"
|
||||
dependencies = [
|
||||
"matches",
|
||||
"percent-encoding",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "0.2.3"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8"
|
||||
checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c"
|
||||
dependencies = [
|
||||
"matches",
|
||||
"unicode-bidi",
|
||||
"unicode-normalization",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.1"
|
||||
version = "1.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35"
|
||||
checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.14"
|
||||
version = "0.4.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "matches"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
|
||||
checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4"
|
||||
|
||||
[[package]]
|
||||
name = "percent-encoding"
|
||||
version = "2.1.0"
|
||||
version = "2.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
|
||||
checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.36"
|
||||
version = "1.0.66"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029"
|
||||
checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9"
|
||||
dependencies = [
|
||||
"unicode-xid",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.14"
|
||||
version = "1.0.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "47aa80447ce4daf1717500037052af176af5d38cc3e571d9ec1c7353fc10c87d"
|
||||
checksum = "5fe8a65d69dd0808184ebb5f836ab526bb259db23c657efa38711b1072ee47f0"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.9"
|
||||
version = "1.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f"
|
||||
checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.133"
|
||||
version = "1.0.173"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "97565067517b60e2d1ea8b268e59ce036de907ac523ad83a0475da04e818989a"
|
||||
checksum = "e91f70896d6720bc714a4a57d22fc91f1db634680e65c8efe13323f1fa38d53f"
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.133"
|
||||
version = "1.0.173"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed201699328568d8d08208fdd080e3ff594e6c422e438b6705905da01005d537"
|
||||
checksum = "a6250dde8342e0232232be9ca3db7aa40aceb5a3e5dd9bddbc00d99a007cde49"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
@ -99,9 +82,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.74"
|
||||
version = "1.0.103"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ee2bb9cd061c5865d345bb02ca49fcef1391741b672b54a0bf7b679badec3142"
|
||||
checksum = "d03b412469450d4404fe8499a268edd7f8b79fecb074b0d812ad64ca21f4031b"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
|
|
@ -110,66 +93,65 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.85"
|
||||
version = "2.0.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a684ac3dcd8913827e18cd09a68384ee66c1de24157e3c556c9ab16d85695fb7"
|
||||
checksum = "45c3457aacde3c65315de5031ec191ce46604304d2446e803d71ade03308d970"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-xid",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tinyvec"
|
||||
version = "1.5.1"
|
||||
version = "1.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2"
|
||||
checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50"
|
||||
dependencies = [
|
||||
"tinyvec_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tinyvec_macros"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
|
||||
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-bidi"
|
||||
version = "0.3.7"
|
||||
version = "0.3.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f"
|
||||
checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-normalization"
|
||||
version = "0.1.19"
|
||||
version = "0.1.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9"
|
||||
checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921"
|
||||
dependencies = [
|
||||
"tinyvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
|
||||
|
||||
[[package]]
|
||||
name = "url"
|
||||
version = "2.2.2"
|
||||
version = "2.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c"
|
||||
checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb"
|
||||
dependencies = [
|
||||
"form_urlencoded",
|
||||
"idna",
|
||||
"matches",
|
||||
"percent-encoding",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webrtc-sdp"
|
||||
version = "0.3.10"
|
||||
version = "0.3.11"
|
||||
dependencies = [
|
||||
"log",
|
||||
"serde",
|
||||
|
|
|
|||
2
third_party/rust/webrtc-sdp/Cargo.toml
vendored
2
third_party/rust/webrtc-sdp/Cargo.toml
vendored
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
[package]
|
||||
name = "webrtc-sdp"
|
||||
version = "0.3.10"
|
||||
version = "0.3.11"
|
||||
authors = [
|
||||
"Nicolas Grunbaum <na-g+github@nostrum.com>",
|
||||
"Nils Ohlmeier <github@ohlmeier.org>",
|
||||
|
|
|
|||
2
third_party/rust/webrtc-sdp/README.md
vendored
2
third_party/rust/webrtc-sdp/README.md
vendored
|
|
@ -10,7 +10,7 @@ A SDP parser written in Rust specifically aimed to handle WebRTC SDP offers and
|
|||
|
||||
## Dependecies
|
||||
|
||||
* Rust >= 1.45.0
|
||||
* Rust >= 1.60.0
|
||||
* log module
|
||||
* serde module
|
||||
* serde-derive module
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ fn main() {
|
|||
let path = Path::new(filename.as_str());
|
||||
let display = path.display();
|
||||
|
||||
let mut file = match File::open(&path) {
|
||||
let mut file = match File::open(path) {
|
||||
Err(why) => panic!("Failed to open {}: {}", display, why),
|
||||
Ok(file) => file,
|
||||
};
|
||||
|
|
@ -61,7 +61,7 @@ fn main() {
|
|||
let res = webrtc_sdp::parse_sdp(&s, true);
|
||||
match res {
|
||||
Err(why) => panic!("Failed to parse SDP with error: {}", why),
|
||||
Ok(sdp) => println!("Parsed SDP structure:\n{:#?}", sdp),
|
||||
Ok(sdp) => println!("Parsed SDP structure:\n{sdp:#?}"),
|
||||
}
|
||||
|
||||
if expect_failure {
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ impl fmt::Display for SdpAttributeCandidate {
|
|||
unknown = self
|
||||
.unknown_extensions
|
||||
.iter()
|
||||
.map(|&(ref name, ref value)| format!(" {} {}", name, value))
|
||||
.map(|(name, value)| format!(" {name} {value}"))
|
||||
.collect::<String>()
|
||||
)
|
||||
}
|
||||
|
|
@ -308,9 +308,9 @@ pub enum SdpAttributeDtlsMessage {
|
|||
|
||||
impl fmt::Display for SdpAttributeDtlsMessage {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match *self {
|
||||
SdpAttributeDtlsMessage::Client(ref msg) => format!("client {}", msg),
|
||||
SdpAttributeDtlsMessage::Server(ref msg) => format!("server {}", msg),
|
||||
match self {
|
||||
SdpAttributeDtlsMessage::Client(msg) => format!("client {msg}"),
|
||||
SdpAttributeDtlsMessage::Server(msg) => format!("server {msg}"),
|
||||
}
|
||||
.fmt(f)
|
||||
}
|
||||
|
|
@ -622,7 +622,7 @@ impl fmt::Display for SdpAttributeFmtpParameters {
|
|||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
if let Some(ref rtx) = self.rtx {
|
||||
// rtx
|
||||
return write!(f, "{}", rtx);
|
||||
return write!(f, "{rtx}");
|
||||
}
|
||||
if !self.dtmf_tones.is_empty() {
|
||||
// telephone-event
|
||||
|
|
@ -713,8 +713,7 @@ impl SdpAttributeFingerprintHashType {
|
|||
"sha-384" => Ok(Self::Sha384),
|
||||
"sha-512" => Ok(Self::Sha512),
|
||||
unknown => Err(SdpParserInternalError::Unsupported(format!(
|
||||
"fingerprint contains an unsupported hash algorithm '{}'",
|
||||
unknown
|
||||
"fingerprint contains an unsupported hash algorithm '{unknown}'"
|
||||
))),
|
||||
}
|
||||
}
|
||||
|
|
@ -786,8 +785,7 @@ impl TryFrom<(SdpAttributeFingerprintHashType, Vec<u8>)> for SdpAttributeFingerp
|
|||
fingerprint,
|
||||
}),
|
||||
(a, b) => Err(SdpParserInternalError::Generic(format!(
|
||||
"Hash algoritm expects {} fingerprint bytes not {}",
|
||||
a, b
|
||||
"Hash algoritm expects {a} fingerprint bytes not {b}",
|
||||
))),
|
||||
}
|
||||
}
|
||||
|
|
@ -802,7 +800,7 @@ impl fmt::Display for SdpAttributeFingerprint {
|
|||
fp = self
|
||||
.fingerprint
|
||||
.iter()
|
||||
.map(|byte| format!("{:02X}", byte))
|
||||
.map(|byte| format!("{byte:02X}"))
|
||||
.collect::<Vec<String>>()
|
||||
.join(":")
|
||||
)
|
||||
|
|
@ -846,11 +844,11 @@ impl fmt::Display for SdpAttributeImageAttrXyRange {
|
|||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match *self {
|
||||
SdpAttributeImageAttrXyRange::Range(ref min, ref max, ref step_opt) => {
|
||||
write!(f, "[{}:", min)?;
|
||||
write!(f, "[{min}:")?;
|
||||
if step_opt.is_some() {
|
||||
write!(f, "{}:", step_opt.unwrap())?;
|
||||
}
|
||||
write!(f, "{}]", max)
|
||||
write!(f, "{max}]")
|
||||
}
|
||||
SdpAttributeImageAttrXyRange::DiscreteValues(ref values) => {
|
||||
write!(f, "{}", imageattr_discrete_value_list_to_string(values))
|
||||
|
|
@ -868,9 +866,9 @@ pub enum SdpAttributeImageAttrSRange {
|
|||
|
||||
impl fmt::Display for SdpAttributeImageAttrSRange {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match *self {
|
||||
SdpAttributeImageAttrSRange::Range(ref min, ref max) => write!(f, "[{}-{}]", min, max),
|
||||
SdpAttributeImageAttrSRange::DiscreteValues(ref values) => {
|
||||
match self {
|
||||
SdpAttributeImageAttrSRange::Range(min, max) => write!(f, "[{min}-{max}]"),
|
||||
SdpAttributeImageAttrSRange::DiscreteValues(values) => {
|
||||
write!(f, "{}", imageattr_discrete_value_list_to_string(values))
|
||||
}
|
||||
}
|
||||
|
|
@ -1110,7 +1108,7 @@ impl fmt::Display for SdpAttributeRid {
|
|||
.as_str()
|
||||
{
|
||||
"" => "".to_string(),
|
||||
x => format!(" {}", x),
|
||||
x => format!(" {x}"),
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
@ -1195,7 +1193,7 @@ impl SdpAttributeSsrc {
|
|||
}
|
||||
|
||||
fn set_attribute(&mut self, a: &str) {
|
||||
if a.find(':') == None {
|
||||
if a.find(':').is_none() {
|
||||
self.attribute = Some(a.to_string());
|
||||
} else {
|
||||
let v: Vec<&str> = a.splitn(2, ':').collect();
|
||||
|
|
@ -1415,8 +1413,7 @@ impl FromStr for SdpAttribute {
|
|||
| "ice-mismatch" | "inactive" | "recvonly" | "rtcp-mux" | "rtcp-mux-only"
|
||||
| "rtcp-rsize" | "sendonly" | "sendrecv" => {
|
||||
return Err(SdpParserInternalError::Generic(format!(
|
||||
"{} attribute is not allowed to have a value",
|
||||
name
|
||||
"{name} attribute is not allowed to have a value",
|
||||
)));
|
||||
}
|
||||
_ => (),
|
||||
|
|
@ -1466,8 +1463,7 @@ impl FromStr for SdpAttribute {
|
|||
"simulcast" => parse_simulcast(val),
|
||||
"ssrc" => parse_ssrc(val),
|
||||
_ => Err(SdpParserInternalError::Unsupported(format!(
|
||||
"Unknown attribute type {}",
|
||||
name
|
||||
"Unknown attribute type {name}",
|
||||
))),
|
||||
}
|
||||
}
|
||||
|
|
@ -1710,8 +1706,7 @@ fn parse_single_direction(to_parse: &str) -> Result<SdpSingleDirection, SdpParse
|
|||
"send" => Ok(SdpSingleDirection::Send),
|
||||
"recv" => Ok(SdpSingleDirection::Recv),
|
||||
x => Err(SdpParserInternalError::Generic(format!(
|
||||
"Unknown direction description found: '{:}'",
|
||||
x
|
||||
"Unknown direction description found: '{x:}'"
|
||||
))),
|
||||
}
|
||||
}
|
||||
|
|
@ -1736,8 +1731,7 @@ fn parse_ssrc_group(to_parse: &str) -> Result<SdpAttribute, SdpParserInternalErr
|
|||
"SIM" => SdpSsrcGroupSemantic::Sim,
|
||||
unknown => {
|
||||
return Err(SdpParserInternalError::Unsupported(format!(
|
||||
"Unknown ssrc semantic '{:?}' found",
|
||||
unknown
|
||||
"Unknown ssrc semantic '{unknown:?}' found"
|
||||
)));
|
||||
}
|
||||
},
|
||||
|
|
@ -1773,8 +1767,7 @@ fn parse_sctp_port(to_parse: &str) -> Result<SdpAttribute, SdpParserInternalErro
|
|||
let port = to_parse.parse()?;
|
||||
if port > 65535 {
|
||||
return Err(SdpParserInternalError::Generic(format!(
|
||||
"Sctpport port {} can only be a bit 16bit number",
|
||||
port
|
||||
"Sctpport port {port} can only be a bit 16bit number"
|
||||
)));
|
||||
}
|
||||
Ok(SdpAttribute::SctpPort(port))
|
||||
|
|
@ -1948,8 +1941,7 @@ fn parse_dtls_message(to_parse: &str) -> Result<SdpAttribute, SdpParserInternalE
|
|||
"server" => SdpAttributeDtlsMessage::Server(tokens[1].to_string()),
|
||||
e => {
|
||||
return Err(SdpParserInternalError::Generic(format!(
|
||||
"dtls-message has unknown role token '{}'",
|
||||
e
|
||||
"dtls-message has unknown role token '{e}'"
|
||||
)));
|
||||
}
|
||||
}))
|
||||
|
|
@ -1991,7 +1983,7 @@ fn parse_extmap(to_parse: &str) -> Result<SdpAttribute, SdpParserInternalError>
|
|||
}
|
||||
let id: u16;
|
||||
let mut direction: Option<SdpAttributeDirection> = None;
|
||||
if tokens[0].find('/') == None {
|
||||
if tokens[0].find('/').is_none() {
|
||||
id = tokens[0].parse::<u16>()?;
|
||||
} else {
|
||||
let id_dir: Vec<&str> = tokens[0].splitn(2, '/').collect();
|
||||
|
|
@ -2121,8 +2113,7 @@ fn parse_fmtp(to_parse: &str) -> Result<SdpAttribute, SdpParserInternalError> {
|
|||
0 => Ok(false),
|
||||
1 => Ok(true),
|
||||
_ => Err(SdpParserInternalError::Generic(format!(
|
||||
"The fmtp parameter '{:}' must be 0 or 1",
|
||||
param_name
|
||||
"The fmtp parameter '{param_name:}' must be 0 or 1"
|
||||
))),
|
||||
}
|
||||
};
|
||||
|
|
@ -2300,8 +2291,7 @@ fn parse_group(to_parse: &str) -> Result<SdpAttribute, SdpParserInternalError> {
|
|||
"BUNDLE" => SdpAttributeGroupSemantic::Bundle,
|
||||
unknown => {
|
||||
return Err(SdpParserInternalError::Unsupported(format!(
|
||||
"Unknown group semantic '{:?}' found",
|
||||
unknown
|
||||
"Unknown group semantic '{unknown:?}' found",
|
||||
)));
|
||||
}
|
||||
},
|
||||
|
|
@ -3052,8 +3042,7 @@ fn parse_rtcp_fb(to_parse: &str) -> Result<SdpAttribute, SdpParserInternalError>
|
|||
"transport-cc" => SdpAttributeRtcpFbType::TransCc,
|
||||
_ => {
|
||||
return Err(SdpParserInternalError::Unsupported(format!(
|
||||
"Unknown rtcpfb feedback type: {:?}",
|
||||
x
|
||||
"Unknown rtcpfb feedback type: {x:?}"
|
||||
)));
|
||||
}
|
||||
},
|
||||
|
|
@ -3071,8 +3060,7 @@ fn parse_rtcp_fb(to_parse: &str) -> Result<SdpAttribute, SdpParserInternalError>
|
|||
"rpsi" | "app" => (*x).to_string(),
|
||||
_ => {
|
||||
return Err(SdpParserInternalError::Unsupported(format!(
|
||||
"Unknown rtcpfb ack parameter: {:?}",
|
||||
x
|
||||
"Unknown rtcpfb ack parameter: {x:?}"
|
||||
)));
|
||||
}
|
||||
},
|
||||
|
|
@ -3087,8 +3075,7 @@ fn parse_rtcp_fb(to_parse: &str) -> Result<SdpAttribute, SdpParserInternalError>
|
|||
"fir" | "tmmbr" | "tstr" | "vbcm" => (*x).to_string(),
|
||||
_ => {
|
||||
return Err(SdpParserInternalError::Unsupported(format!(
|
||||
"Unknown rtcpfb ccm parameter: {:?}",
|
||||
x
|
||||
"Unknown rtcpfb ccm parameter: {x:?}"
|
||||
)));
|
||||
}
|
||||
},
|
||||
|
|
@ -3099,8 +3086,7 @@ fn parse_rtcp_fb(to_parse: &str) -> Result<SdpAttribute, SdpParserInternalError>
|
|||
"sli" | "pli" | "rpsi" | "app" => (*x).to_string(),
|
||||
_ => {
|
||||
return Err(SdpParserInternalError::Unsupported(format!(
|
||||
"Unknown rtcpfb nack parameter: {:?}",
|
||||
x
|
||||
"Unknown rtcpfb nack parameter: {x:?}"
|
||||
)));
|
||||
}
|
||||
},
|
||||
|
|
@ -3111,8 +3097,7 @@ fn parse_rtcp_fb(to_parse: &str) -> Result<SdpAttribute, SdpParserInternalError>
|
|||
_ if x.parse::<u32>().is_ok() => (*x).to_string(),
|
||||
_ => {
|
||||
return Err(SdpParserInternalError::Generic(format!(
|
||||
"Unknown rtcpfb trr-int parameter: {:?}",
|
||||
x
|
||||
"Unknown rtcpfb trr-int parameter: {x:?}"
|
||||
)));
|
||||
}
|
||||
},
|
||||
|
|
@ -3125,8 +3110,7 @@ fn parse_rtcp_fb(to_parse: &str) -> Result<SdpAttribute, SdpParserInternalError>
|
|||
SdpAttributeRtcpFbType::Remb | SdpAttributeRtcpFbType::TransCc => match tokens.get(2) {
|
||||
Some(x) => {
|
||||
return Err(SdpParserInternalError::Unsupported(format!(
|
||||
"Unknown rtcpfb {} parameter: {:?}",
|
||||
feedback_type, x
|
||||
"Unknown rtcpfb {feedback_type} parameter: {x:?}"
|
||||
)));
|
||||
}
|
||||
None => "".to_string(),
|
||||
|
|
@ -3213,8 +3197,7 @@ fn parse_simulcast_version_list(
|
|||
descriptor_versionlist_pair.next().unwrap(),
|
||||
)),
|
||||
descriptor => Err(SdpParserInternalError::Generic(format!(
|
||||
"Simulcast attribute has unknown list descriptor '{:?}'",
|
||||
descriptor
|
||||
"Simulcast attribute has unknown list descriptor '{descriptor:?}'"
|
||||
))),
|
||||
}
|
||||
} else {
|
||||
|
|
@ -3249,7 +3232,7 @@ fn parse_simulcast_version_list(
|
|||
// ; rid-id defined in [I-D.ietf-mmusic-rid]
|
||||
fn parse_simulcast(to_parse: &str) -> Result<SdpAttribute, SdpParserInternalError> {
|
||||
// TODO: Bug 1225877: Stop accepting all kinds of whitespace here, and only accept SP
|
||||
let mut tokens = to_parse.trim().split_whitespace();
|
||||
let mut tokens = to_parse.split_whitespace();
|
||||
let first_direction = match tokens.next() {
|
||||
Some(x) => parse_single_direction(x)?,
|
||||
None => {
|
||||
|
|
|
|||
85
third_party/rust/webrtc-sdp/src/error.rs
vendored
85
third_party/rust/webrtc-sdp/src/error.rs
vendored
|
|
@ -36,27 +36,25 @@ impl fmt::Display for SdpParserInternalError {
|
|||
match *self {
|
||||
SdpParserInternalError::UnknownAddressType(ref unknown) => write!(
|
||||
f,
|
||||
"{}: {}",
|
||||
INTERNAL_ERROR_MESSAGE_UNKNOWN_ADDRESS_TYPE, unknown
|
||||
"{INTERNAL_ERROR_MESSAGE_UNKNOWN_ADDRESS_TYPE}: {unknown}"
|
||||
),
|
||||
SdpParserInternalError::AddressTypeMismatch { found, expected } => write!(
|
||||
f,
|
||||
"{}: {}, {}",
|
||||
INTERNAL_ERROR_MESSAGE_ADDRESS_TYPE_MISMATCH, found, expected
|
||||
"{INTERNAL_ERROR_MESSAGE_ADDRESS_TYPE_MISMATCH}: {found}, {expected}"
|
||||
),
|
||||
SdpParserInternalError::Generic(ref message) => write!(f, "Parsing error: {}", message),
|
||||
SdpParserInternalError::Generic(ref message) => write!(f, "Parsing error: {message}"),
|
||||
SdpParserInternalError::Unsupported(ref message) => {
|
||||
write!(f, "Unsupported parsing error: {}", message)
|
||||
write!(f, "Unsupported parsing error: {message}")
|
||||
}
|
||||
SdpParserInternalError::Integer(ref error) => {
|
||||
write!(f, "Integer parsing error: {}", error)
|
||||
write!(f, "Integer parsing error: {error}")
|
||||
}
|
||||
SdpParserInternalError::Float(ref error) => write!(f, "Float parsing error: {}", error),
|
||||
SdpParserInternalError::Float(ref error) => write!(f, "Float parsing error: {error}"),
|
||||
SdpParserInternalError::Domain(ref error) => {
|
||||
write!(f, "Domain name parsing error: {}", error)
|
||||
write!(f, "Domain name parsing error: {error}")
|
||||
}
|
||||
SdpParserInternalError::IpAddress(ref error) => {
|
||||
write!(f, "IP address parsing error: {}", error)
|
||||
write!(f, "IP address parsing error: {error}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -101,33 +99,25 @@ impl Serialize for SdpParserError {
|
|||
{
|
||||
let mut state = serializer.serialize_struct(
|
||||
"error",
|
||||
match *self {
|
||||
match self {
|
||||
SdpParserError::Sequence { .. } => 3,
|
||||
_ => 4,
|
||||
},
|
||||
)?;
|
||||
match *self {
|
||||
SdpParserError::Line {
|
||||
ref error,
|
||||
ref line,
|
||||
..
|
||||
} => {
|
||||
match self {
|
||||
SdpParserError::Line { error, line, .. } => {
|
||||
state.serialize_field("type", "Line")?;
|
||||
state.serialize_field("message", &format!("{}", error))?;
|
||||
state.serialize_field("line", &line)?
|
||||
state.serialize_field("message", &format!("{error}"))?;
|
||||
state.serialize_field("line", line)?
|
||||
}
|
||||
SdpParserError::Unsupported {
|
||||
ref error,
|
||||
ref line,
|
||||
..
|
||||
} => {
|
||||
SdpParserError::Unsupported { error, line, .. } => {
|
||||
state.serialize_field("type", "Unsupported")?;
|
||||
state.serialize_field("message", &format!("{}", error))?;
|
||||
state.serialize_field("line", &line)?
|
||||
state.serialize_field("message", &format!("{error}"))?;
|
||||
state.serialize_field("line", line)?
|
||||
}
|
||||
SdpParserError::Sequence { ref message, .. } => {
|
||||
SdpParserError::Sequence { message, .. } => {
|
||||
state.serialize_field("type", "Sequence")?;
|
||||
state.serialize_field("message", &message)?;
|
||||
state.serialize_field("message", message)?;
|
||||
}
|
||||
};
|
||||
state.serialize_field(
|
||||
|
|
@ -144,38 +134,31 @@ impl Serialize for SdpParserError {
|
|||
|
||||
impl fmt::Display for SdpParserError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match *self {
|
||||
match self {
|
||||
SdpParserError::Line {
|
||||
ref error,
|
||||
ref line,
|
||||
ref line_number,
|
||||
} => write!(
|
||||
f,
|
||||
"Line error: {} in line({}): {}",
|
||||
error, line_number, line
|
||||
),
|
||||
error,
|
||||
line,
|
||||
line_number,
|
||||
} => write!(f, "Line error: {error} in line({line_number}): {line}"),
|
||||
SdpParserError::Unsupported {
|
||||
ref error,
|
||||
ref line,
|
||||
ref line_number,
|
||||
} => write!(
|
||||
f,
|
||||
"Unsupported: {} in line({}): {}",
|
||||
error, line_number, line
|
||||
),
|
||||
error,
|
||||
line,
|
||||
line_number,
|
||||
} => write!(f, "Unsupported: {error} in line({line_number}): {line}",),
|
||||
SdpParserError::Sequence {
|
||||
ref message,
|
||||
ref line_number,
|
||||
} => write!(f, "Sequence error in line({}): {}", line_number, message),
|
||||
message,
|
||||
line_number,
|
||||
} => write!(f, "Sequence error in line({line_number}): {message}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Error for SdpParserError {
|
||||
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
|
||||
match *self {
|
||||
SdpParserError::Line { ref error, .. }
|
||||
| SdpParserError::Unsupported { ref error, .. } => Some(error),
|
||||
match self {
|
||||
SdpParserError::Line { error, .. } | SdpParserError::Unsupported { error, .. } => {
|
||||
Some(error)
|
||||
}
|
||||
// Can't tell much more about our internal errors
|
||||
_ => None,
|
||||
}
|
||||
|
|
|
|||
26
third_party/rust/webrtc-sdp/src/error_tests.rs
vendored
26
third_party/rust/webrtc-sdp/src/error_tests.rs
vendored
|
|
@ -9,7 +9,7 @@ use std::str::FromStr;
|
|||
fn test_sdp_parser_internal_error_unknown_address_type() {
|
||||
let error = SdpParserInternalError::UnknownAddressType("foo".to_string());
|
||||
assert_eq!(
|
||||
format!("{}", error),
|
||||
format!("{error}"),
|
||||
format!("{}: {}", INTERNAL_ERROR_MESSAGE_UNKNOWN_ADDRESS_TYPE, "foo")
|
||||
);
|
||||
assert!(error.source().is_none());
|
||||
|
|
@ -21,7 +21,7 @@ fn test_sdp_parser_internal_error_address_type_mismatch() {
|
|||
expected: AddressType::IpV6,
|
||||
};
|
||||
assert_eq!(
|
||||
format!("{}", error),
|
||||
format!("{error}"),
|
||||
format!(
|
||||
"{}: {}, {}",
|
||||
INTERNAL_ERROR_MESSAGE_ADDRESS_TYPE_MISMATCH,
|
||||
|
|
@ -35,7 +35,7 @@ fn test_sdp_parser_internal_error_address_type_mismatch() {
|
|||
#[test]
|
||||
fn test_sdp_parser_internal_error_generic() {
|
||||
let generic = SdpParserInternalError::Generic("generic message".to_string());
|
||||
assert_eq!(format!("{}", generic), "Parsing error: generic message");
|
||||
assert_eq!(format!("{generic}"), "Parsing error: generic message");
|
||||
assert!(generic.source().is_none());
|
||||
}
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ fn test_sdp_parser_internal_error_unsupported() {
|
|||
let unsupported =
|
||||
SdpParserInternalError::Unsupported("unsupported internal message".to_string());
|
||||
assert_eq!(
|
||||
format!("{}", unsupported),
|
||||
format!("{unsupported}"),
|
||||
"Unsupported parsing error: unsupported internal message"
|
||||
);
|
||||
assert!(unsupported.source().is_none());
|
||||
|
|
@ -57,10 +57,10 @@ fn test_sdp_parser_internal_error_integer() {
|
|||
assert!(integer.is_err());
|
||||
let int_err = SdpParserInternalError::Integer(integer.err().unwrap());
|
||||
assert_eq!(
|
||||
format!("{}", int_err),
|
||||
format!("{int_err}"),
|
||||
"Integer parsing error: invalid digit found in string"
|
||||
);
|
||||
assert!(!int_err.source().is_none());
|
||||
assert!(int_err.source().is_some());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -70,10 +70,10 @@ fn test_sdp_parser_internal_error_float() {
|
|||
assert!(float.is_err());
|
||||
let int_err = SdpParserInternalError::Float(float.err().unwrap());
|
||||
assert_eq!(
|
||||
format!("{}", int_err),
|
||||
format!("{int_err}"),
|
||||
"Float parsing error: invalid float literal"
|
||||
);
|
||||
assert!(!int_err.source().is_none());
|
||||
assert!(int_err.source().is_some());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -81,10 +81,10 @@ fn test_sdp_parser_internal_error_address() {
|
|||
let v = "127.0.0.500";
|
||||
let addr_err = Address::from_str(v).err().unwrap();
|
||||
assert_eq!(
|
||||
format!("{}", addr_err),
|
||||
format!("{addr_err}"),
|
||||
"Domain name parsing error: invalid IPv4 address"
|
||||
);
|
||||
assert!(!addr_err.source().is_none());
|
||||
assert!(addr_err.source().is_some());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -95,7 +95,7 @@ fn test_sdp_parser_error_line() {
|
|||
line_number: 13,
|
||||
};
|
||||
assert_eq!(
|
||||
format!("{}", line1),
|
||||
format!("{line1}"),
|
||||
"Line error: Parsing error: test message in line(13): test line"
|
||||
);
|
||||
assert!(line1.source().is_some());
|
||||
|
|
@ -109,7 +109,7 @@ fn test_sdp_parser_error_unsupported() {
|
|||
line_number: 21,
|
||||
};
|
||||
assert_eq!(
|
||||
format!("{}", unsupported1),
|
||||
format!("{unsupported1}"),
|
||||
"Unsupported: Parsing error: unsupported value in line(21): unsupported line"
|
||||
);
|
||||
assert!(unsupported1.source().is_some());
|
||||
|
|
@ -122,7 +122,7 @@ fn test_sdp_parser_error_sequence() {
|
|||
line_number: 42,
|
||||
};
|
||||
assert_eq!(
|
||||
format!("{}", sequence1),
|
||||
format!("{sequence1}"),
|
||||
"Sequence error in line(42): sequence message"
|
||||
);
|
||||
assert!(sequence1.source().is_none());
|
||||
|
|
|
|||
37
third_party/rust/webrtc-sdp/src/lib.rs
vendored
37
third_party/rust/webrtc-sdp/src/lib.rs
vendored
|
|
@ -58,7 +58,7 @@ impl fmt::Display for SdpBandwidth {
|
|||
SdpBandwidth::Tias(ref x) => ("TIAS", x),
|
||||
SdpBandwidth::Unknown(ref tp, ref x) => (&tp[..], x),
|
||||
};
|
||||
write!(f, "{tp}:{val}", tp = tp_string, val = value)
|
||||
write!(f, "{tp_string}:{value}")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -292,8 +292,7 @@ impl SdpSession {
|
|||
pub fn add_attribute(&mut self, a: SdpAttribute) -> Result<(), SdpParserInternalError> {
|
||||
if !a.allowed_at_session_level() {
|
||||
return Err(SdpParserInternalError::Generic(format!(
|
||||
"{} not allowed at session level",
|
||||
a
|
||||
"{a} not allowed at session level"
|
||||
)));
|
||||
};
|
||||
self.attribute.push(a);
|
||||
|
|
@ -312,7 +311,7 @@ impl SdpSession {
|
|||
let _line_number = line.line_number;
|
||||
self.add_attribute(a).map_err(|e: SdpParserInternalError| {
|
||||
SdpParserError::Sequence {
|
||||
message: format!("{}", e),
|
||||
message: format!("{e}"),
|
||||
line_number: _line_number,
|
||||
}
|
||||
})?
|
||||
|
|
@ -408,8 +407,7 @@ fn parse_version(value: &str) -> Result<SdpType, SdpParserInternalError> {
|
|||
let ver = value.parse::<u64>()?;
|
||||
if ver != 0 {
|
||||
return Err(SdpParserInternalError::Generic(format!(
|
||||
"version type contains unsupported value {}",
|
||||
ver
|
||||
"version type contains unsupported value {ver}"
|
||||
)));
|
||||
};
|
||||
trace!("version: {}", ver);
|
||||
|
|
@ -493,7 +491,7 @@ fn parse_connection(value: &str) -> Result<SdpType, SdpParserInternalError> {
|
|||
let mut ttl = None;
|
||||
let mut amount = None;
|
||||
let mut addr_token = cv[2];
|
||||
if addr_token.find('/') != None {
|
||||
if addr_token.find('/').is_some() {
|
||||
let addr_tokens: Vec<&str> = addr_token.split('/').collect();
|
||||
if addr_tokens.len() >= 3 {
|
||||
amount = Some(addr_tokens[2].parse::<u32>()?);
|
||||
|
|
@ -544,7 +542,7 @@ fn parse_timing(value: &str) -> Result<SdpType, SdpParserInternalError> {
|
|||
}
|
||||
|
||||
pub fn parse_sdp_line(line: &str, line_number: usize) -> Result<SdpLine, SdpParserError> {
|
||||
if line.find('=') == None {
|
||||
if line.find('=').is_none() {
|
||||
return Err(SdpParserError::Line {
|
||||
error: SdpParserInternalError::Generic("missing = character in line".to_string()),
|
||||
line: line.to_string(),
|
||||
|
|
@ -605,37 +603,30 @@ pub fn parse_sdp_line(line: &str, line_number: usize) -> Result<SdpLine, SdpPars
|
|||
"b" => parse_bandwidth(line_value),
|
||||
"c" => parse_connection(line_value),
|
||||
"e" => Err(SdpParserInternalError::Generic(format!(
|
||||
"unsupported type email: {}",
|
||||
line_value
|
||||
"unsupported type email: {line_value}"
|
||||
))),
|
||||
"i" => Err(SdpParserInternalError::Generic(format!(
|
||||
"unsupported type information: {}",
|
||||
line_value
|
||||
"unsupported type information: {line_value}"
|
||||
))),
|
||||
"k" => Err(SdpParserInternalError::Generic(format!(
|
||||
"unsupported insecure key exchange: {}",
|
||||
line_value
|
||||
"unsupported insecure key exchange: {line_value}"
|
||||
))),
|
||||
"m" => parse_media(line_value),
|
||||
"o" => parse_origin(line_value),
|
||||
"p" => Err(SdpParserInternalError::Generic(format!(
|
||||
"unsupported type phone: {}",
|
||||
line_value
|
||||
"unsupported type phone: {line_value}"
|
||||
))),
|
||||
"r" => Err(SdpParserInternalError::Generic(format!(
|
||||
"unsupported type repeat: {}",
|
||||
line_value
|
||||
"unsupported type repeat: {line_value}"
|
||||
))),
|
||||
"s" => parse_session(untrimmed_line_value),
|
||||
"t" => parse_timing(line_value),
|
||||
"u" => Err(SdpParserInternalError::Generic(format!(
|
||||
"unsupported type uri: {}",
|
||||
line_value
|
||||
"unsupported type uri: {line_value}"
|
||||
))),
|
||||
"v" => parse_version(line_value),
|
||||
"z" => Err(SdpParserInternalError::Generic(format!(
|
||||
"unsupported type zone: {}",
|
||||
line_value
|
||||
"unsupported type zone: {line_value}"
|
||||
))),
|
||||
_ => Err(SdpParserInternalError::Generic(
|
||||
"unknown sdp type".to_string(),
|
||||
|
|
@ -749,7 +740,7 @@ fn sanity_check_sdp_session(session: &SdpSession) -> Result<(), SdpParserError>
|
|||
}
|
||||
}
|
||||
|
||||
if let Some(&SdpAttribute::Simulcast(ref simulcast)) =
|
||||
if let Some(SdpAttribute::Simulcast(simulcast)) =
|
||||
msection.get_attribute(SdpAttributeType::Simulcast)
|
||||
{
|
||||
let check_defined_rids =
|
||||
|
|
|
|||
25
third_party/rust/webrtc-sdp/src/media_type.rs
vendored
25
third_party/rust/webrtc-sdp/src/media_type.rs
vendored
|
|
@ -196,8 +196,7 @@ impl SdpMedia {
|
|||
pub fn add_attribute(&mut self, attr: SdpAttribute) -> Result<(), SdpParserInternalError> {
|
||||
if !attr.allowed_at_media_level() {
|
||||
return Err(SdpParserInternalError::Generic(format!(
|
||||
"{} not allowed at media level",
|
||||
attr
|
||||
"{attr} not allowed at media level"
|
||||
)));
|
||||
}
|
||||
self.attribute.push(attr);
|
||||
|
|
@ -318,8 +317,7 @@ fn parse_media_token(value: &str) -> Result<SdpMediaValue, SdpParserInternalErro
|
|||
"application" => SdpMediaValue::Application,
|
||||
_ => {
|
||||
return Err(SdpParserInternalError::Unsupported(format!(
|
||||
"unsupported media value: {}",
|
||||
value
|
||||
"unsupported media value: {value}"
|
||||
)));
|
||||
}
|
||||
})
|
||||
|
|
@ -340,8 +338,7 @@ fn parse_protocol_token(value: &str) -> Result<SdpProtocolValue, SdpParserIntern
|
|||
"TCP/DTLS/SCTP" => SdpProtocolValue::TcpDtlsSctp,
|
||||
_ => {
|
||||
return Err(SdpParserInternalError::Unsupported(format!(
|
||||
"unsupported protocol value: {}",
|
||||
value
|
||||
"unsupported protocol value: {value}"
|
||||
)));
|
||||
}
|
||||
})
|
||||
|
|
@ -380,15 +377,11 @@ pub fn parse_media(value: &str) -> Result<SdpType, SdpParserInternalError> {
|
|||
let mut fmt_vec: Vec<u32> = vec![];
|
||||
for num in fmt_slice {
|
||||
let fmt_num = num.parse::<u32>()?;
|
||||
match fmt_num {
|
||||
0 | // PCMU
|
||||
8 | // PCMA
|
||||
9 | // G722
|
||||
13 | // Comfort Noise
|
||||
35 ..= 63 | 96 ..= 127 => (), // dynamic range
|
||||
_ => return Err(SdpParserInternalError::Generic(
|
||||
"format number in media line is out of range".to_string()))
|
||||
};
|
||||
if matches!(fmt_num, 1 | 2 | 19 | 64..=95 | 128 .. ) {
|
||||
return Err(SdpParserInternalError::Generic(
|
||||
"format number in media line is out of range".to_string(),
|
||||
));
|
||||
}
|
||||
fmt_vec.push(fmt_num);
|
||||
}
|
||||
SdpFormatList::Integers(fmt_vec)
|
||||
|
|
@ -459,7 +452,7 @@ pub fn parse_media_vector(lines: &mut Vec<SdpLine>) -> Result<Vec<SdpMedia>, Sdp
|
|||
_ => sdp_media.add_attribute(a),
|
||||
}
|
||||
.map_err(|e: SdpParserInternalError| SdpParserError::Sequence {
|
||||
message: format!("{}", e),
|
||||
message: format!("{e}"),
|
||||
line_number: _line_number,
|
||||
})?
|
||||
}
|
||||
|
|
|
|||
4
third_party/rust/webrtc-sdp/src/network.rs
vendored
4
third_party/rust/webrtc-sdp/src/network.rs
vendored
|
|
@ -9,8 +9,8 @@ use std::str::FromStr;
|
|||
|
||||
pub fn ip_address_to_string(addr: IpAddr) -> String {
|
||||
match addr {
|
||||
IpAddr::V4(ipv4) => format!("IN IP4 {}", ipv4),
|
||||
IpAddr::V6(ipv6) => format!("IN IP6 {}", ipv6),
|
||||
IpAddr::V4(ipv4) => format!("IN IP4 {ipv4}"),
|
||||
IpAddr::V6(ipv6) => format!("IN IP6 {ipv6}"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -311,9 +311,9 @@ a=ssrc:2709871439 cname:{735484ea-4f6c-f74a-bd66-7425f8476c2e}";
|
|||
assert!(msection
|
||||
.get_attribute(webrtc_sdp::attribute_type::SdpAttributeType::Recvonly)
|
||||
.is_some());
|
||||
assert!(!msection
|
||||
assert!(msection
|
||||
.get_attribute(webrtc_sdp::attribute_type::SdpAttributeType::Extmap)
|
||||
.is_some());
|
||||
.is_none());
|
||||
assert_eq!(
|
||||
msection
|
||||
.get_attributes_of_type(webrtc_sdp::attribute_type::SdpAttributeType::Fmtp)
|
||||
|
|
@ -332,9 +332,9 @@ a=ssrc:2709871439 cname:{735484ea-4f6c-f74a-bd66-7425f8476c2e}";
|
|||
assert!(msection
|
||||
.get_attribute(webrtc_sdp::attribute_type::SdpAttributeType::Mid)
|
||||
.is_some());
|
||||
assert!(!msection
|
||||
assert!(msection
|
||||
.get_attribute(webrtc_sdp::attribute_type::SdpAttributeType::Msid)
|
||||
.is_some());
|
||||
.is_none());
|
||||
assert_eq!(
|
||||
msection
|
||||
.get_attributes_of_type(webrtc_sdp::attribute_type::SdpAttributeType::Rtcpfb)
|
||||
|
|
@ -402,9 +402,9 @@ fn parse_firefox_datachannel_offer() {
|
|||
assert!(msection
|
||||
.get_attribute(webrtc_sdp::attribute_type::SdpAttributeType::Sendrecv)
|
||||
.is_some());
|
||||
assert!(!msection
|
||||
assert!(msection
|
||||
.get_attribute(webrtc_sdp::attribute_type::SdpAttributeType::Extmap)
|
||||
.is_some());
|
||||
.is_none());
|
||||
assert!(msection
|
||||
.get_attribute(webrtc_sdp::attribute_type::SdpAttributeType::IcePwd)
|
||||
.is_some());
|
||||
|
|
@ -417,18 +417,18 @@ fn parse_firefox_datachannel_offer() {
|
|||
assert!(msection
|
||||
.get_attribute(webrtc_sdp::attribute_type::SdpAttributeType::Mid)
|
||||
.is_some());
|
||||
assert!(!msection
|
||||
assert!(msection
|
||||
.get_attribute(webrtc_sdp::attribute_type::SdpAttributeType::Msid)
|
||||
.is_some());
|
||||
assert!(!msection
|
||||
.is_none());
|
||||
assert!(msection
|
||||
.get_attribute(webrtc_sdp::attribute_type::SdpAttributeType::Rtcpfb)
|
||||
.is_some());
|
||||
assert!(!msection
|
||||
.is_none());
|
||||
assert!(msection
|
||||
.get_attribute(webrtc_sdp::attribute_type::SdpAttributeType::RtcpMux)
|
||||
.is_some());
|
||||
assert!(!msection
|
||||
.is_none());
|
||||
assert!(msection
|
||||
.get_attribute(webrtc_sdp::attribute_type::SdpAttributeType::Rtpmap)
|
||||
.is_some());
|
||||
.is_none());
|
||||
assert!(msection
|
||||
.get_attribute(webrtc_sdp::attribute_type::SdpAttributeType::Sctpmap)
|
||||
.is_some());
|
||||
|
|
|
|||
Loading…
Reference in a new issue