mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 18:04:46 +00:00
Bug 1807193: Update our copy of webrtc-sdp to 0.3.10. r=ng,supply-chain-reviewers
This is primarily to pick up https://github.com/mozilla/webrtc-sdp/pull/268 Depends on D165991 Differential Revision: https://phabricator.services.mozilla.com/D166107
This commit is contained in:
parent
3bd616841f
commit
e4f5497456
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -6269,9 +6269,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "webrtc-sdp"
|
||||
version = "0.3.9"
|
||||
version = "0.3.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "99abde0f90c17b56ccc3c105f719d61535003862bdb357465f04181ca667ca16"
|
||||
checksum = "b27cfe685c697666a76932399d55026bf2a5a205d91d277fd16346f0c65a7c06"
|
||||
dependencies = [
|
||||
"log",
|
||||
"url",
|
||||
|
@ -8,5 +8,5 @@ license = "MPL-2.0"
|
||||
[dependencies]
|
||||
libc = "^0.2.0"
|
||||
log = "0.4"
|
||||
rsdparsa = {package = "webrtc-sdp", version = "0.3.9"}
|
||||
rsdparsa = {package = "webrtc-sdp", version = "0.3.10"}
|
||||
nserror = { path = "../../../../../xpcom/rust/nserror" }
|
||||
|
@ -2367,6 +2367,11 @@ criteria = "safe-to-deploy"
|
||||
version = "0.46.0"
|
||||
notes = "Maintained by the DevTools team at Mozilla and has no unsafe code."
|
||||
|
||||
[[audits.webrtc-sdp]]
|
||||
who = "Byron Campen <docfaraday@gmail.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.3.9 -> 0.3.10"
|
||||
|
||||
[[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.10] - 2023-01-05
|
||||
- Permit inconsistent simulcast directions
|
||||
## [0.3.9] - 2022-01-12
|
||||
- Add support for RFC8858 rtcp-mux-only
|
||||
- Correct seperation of tokens in FMTP parameters
|
||||
|
2
third_party/rust/webrtc-sdp/Cargo.lock
generated
vendored
2
third_party/rust/webrtc-sdp/Cargo.lock
generated
vendored
@ -169,7 +169,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "webrtc-sdp"
|
||||
version = "0.3.9"
|
||||
version = "0.3.10"
|
||||
dependencies = [
|
||||
"log",
|
||||
"serde",
|
||||
|
26
third_party/rust/webrtc-sdp/Cargo.toml
vendored
26
third_party/rust/webrtc-sdp/Cargo.toml
vendored
@ -11,14 +11,25 @@
|
||||
|
||||
[package]
|
||||
name = "webrtc-sdp"
|
||||
version = "0.3.9"
|
||||
authors = ["Nicolas Grunbaum <na-g+github@nostrum.com>", "Nils Ohlmeier <github@ohlmeier.org>"]
|
||||
version = "0.3.10"
|
||||
authors = [
|
||||
"Nicolas Grunbaum <na-g+github@nostrum.com>",
|
||||
"Nils Ohlmeier <github@ohlmeier.org>",
|
||||
]
|
||||
description = "webrtc-sdp parses strings in the format of the Session Description Protocol according to RFC4566. It specifically supports the subset of features required to support WebRTC according to the JSEP draft."
|
||||
readme = "README.md"
|
||||
keywords = ["webrtc", "sdp", "jsep"]
|
||||
categories = ["parsing", "network-programming"]
|
||||
keywords = [
|
||||
"webrtc",
|
||||
"sdp",
|
||||
"jsep",
|
||||
]
|
||||
categories = [
|
||||
"parsing",
|
||||
"network-programming",
|
||||
]
|
||||
license = "MPL-2.0"
|
||||
repository = "https://github.com/mozilla/webrtc-sdp"
|
||||
|
||||
[dependencies.log]
|
||||
version = "0.4"
|
||||
|
||||
@ -32,13 +43,18 @@ optional = true
|
||||
|
||||
[dependencies.url]
|
||||
version = "2.1.0"
|
||||
|
||||
[dev-dependencies.serde_json]
|
||||
version = "1.0"
|
||||
|
||||
[features]
|
||||
default = ["enhanced_debug"]
|
||||
enhanced_debug = []
|
||||
serialize = ["serde", "serde_derive"]
|
||||
serialize = [
|
||||
"serde",
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[badges.codecov]
|
||||
branch = "master"
|
||||
repository = "mozilla/webrtc-sdp"
|
||||
|
127
third_party/rust/webrtc-sdp/src/attribute_type.rs
vendored
127
third_party/rust/webrtc-sdp/src/attribute_type.rs
vendored
@ -693,7 +693,7 @@ impl fmt::Display for SdpAttributeFmtp {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "serialize", derive(Serialize))]
|
||||
#[cfg_attr(feature = "enhanced_debug", derive(Debug))]
|
||||
pub enum SdpAttributeFingerprintHashType {
|
||||
@ -704,6 +704,55 @@ pub enum SdpAttributeFingerprintHashType {
|
||||
Sha512,
|
||||
}
|
||||
|
||||
impl SdpAttributeFingerprintHashType {
|
||||
pub fn try_from_name(name: &str) -> Result<Self, SdpParserInternalError> {
|
||||
match name {
|
||||
"sha-1" => Ok(Self::Sha1),
|
||||
"sha-224" => Ok(Self::Sha224),
|
||||
"sha-256" => Ok(Self::Sha256),
|
||||
"sha-384" => Ok(Self::Sha384),
|
||||
"sha-512" => Ok(Self::Sha512),
|
||||
unknown => Err(SdpParserInternalError::Unsupported(format!(
|
||||
"fingerprint contains an unsupported hash algorithm '{}'",
|
||||
unknown
|
||||
))),
|
||||
}
|
||||
}
|
||||
pub fn octet_count(&self) -> usize {
|
||||
match self {
|
||||
Self::Sha1 => 20,
|
||||
Self::Sha224 => 28,
|
||||
Self::Sha256 => 32,
|
||||
Self::Sha384 => 48,
|
||||
Self::Sha512 => 64,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn parse_octets(&self, octets_string: &str) -> Result<Vec<u8>, SdpParserInternalError> {
|
||||
let bytes = octets_string
|
||||
.split(':')
|
||||
.map(|byte_token| {
|
||||
if byte_token.len() != 2 {
|
||||
return Err(SdpParserInternalError::Generic(
|
||||
"fingerpint's byte tokens must have 2 hexdigits".to_string(),
|
||||
));
|
||||
}
|
||||
Ok(u8::from_str_radix(byte_token, 16)?)
|
||||
})
|
||||
.collect::<Result<Vec<u8>, _>>()?;
|
||||
|
||||
if bytes.len() != self.octet_count() {
|
||||
return Err(SdpParserInternalError::Generic(format!(
|
||||
"fingerprint has {} bytes but should have {} bytes",
|
||||
bytes.len(),
|
||||
self.octet_count(),
|
||||
)));
|
||||
}
|
||||
|
||||
Ok(bytes)
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for SdpAttributeFingerprintHashType {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match *self {
|
||||
@ -717,7 +766,7 @@ impl fmt::Display for SdpAttributeFingerprintHashType {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "serialize", derive(Serialize))]
|
||||
#[cfg_attr(feature = "enhanced_debug", derive(Debug))]
|
||||
pub struct SdpAttributeFingerprint {
|
||||
@ -725,6 +774,25 @@ pub struct SdpAttributeFingerprint {
|
||||
pub fingerprint: Vec<u8>,
|
||||
}
|
||||
|
||||
impl TryFrom<(SdpAttributeFingerprintHashType, Vec<u8>)> for SdpAttributeFingerprint {
|
||||
type Error = SdpParserInternalError;
|
||||
fn try_from(
|
||||
parts: (SdpAttributeFingerprintHashType, Vec<u8>),
|
||||
) -> Result<Self, SdpParserInternalError> {
|
||||
let (hash_algorithm, fingerprint) = parts;
|
||||
match (hash_algorithm.octet_count(), fingerprint.len()) {
|
||||
(a, b) if a == b => Ok(Self {
|
||||
hash_algorithm,
|
||||
fingerprint,
|
||||
}),
|
||||
(a, b) => Err(SdpParserInternalError::Generic(format!(
|
||||
"Hash algoritm expects {} fingerprint bytes not {}",
|
||||
a, b
|
||||
))),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for SdpAttributeFingerprint {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(
|
||||
@ -1983,57 +2051,10 @@ fn parse_fingerprint(to_parse: &str) -> Result<SdpAttribute, SdpParserInternalEr
|
||||
));
|
||||
}
|
||||
|
||||
let fingerprint_token = tokens[1].to_string();
|
||||
let parse_tokens = |expected_len| -> Result<Vec<u8>, SdpParserInternalError> {
|
||||
let bytes = fingerprint_token
|
||||
.split(':')
|
||||
.map(|byte_token| {
|
||||
if byte_token.len() != 2 {
|
||||
return Err(SdpParserInternalError::Generic(
|
||||
"fingerpint's byte tokens must have 2 hexdigits".to_string(),
|
||||
));
|
||||
}
|
||||
Ok(u8::from_str_radix(byte_token, 16)?)
|
||||
})
|
||||
.collect::<Result<Vec<u8>, _>>()?;
|
||||
|
||||
if bytes.len() != expected_len {
|
||||
return Err(SdpParserInternalError::Generic(format!(
|
||||
"fingerprint has {} bytes but should have {} bytes",
|
||||
bytes.len(),
|
||||
expected_len
|
||||
)));
|
||||
}
|
||||
|
||||
Ok(bytes)
|
||||
};
|
||||
|
||||
let hash_algorithm = match tokens[0] {
|
||||
"sha-1" => SdpAttributeFingerprintHashType::Sha1,
|
||||
"sha-224" => SdpAttributeFingerprintHashType::Sha224,
|
||||
"sha-256" => SdpAttributeFingerprintHashType::Sha256,
|
||||
"sha-384" => SdpAttributeFingerprintHashType::Sha384,
|
||||
"sha-512" => SdpAttributeFingerprintHashType::Sha512,
|
||||
unknown => {
|
||||
return Err(SdpParserInternalError::Unsupported(format!(
|
||||
"fingerprint contains an unsupported hash algorithm '{}'",
|
||||
unknown
|
||||
)));
|
||||
}
|
||||
};
|
||||
|
||||
let fingerprint = match hash_algorithm {
|
||||
SdpAttributeFingerprintHashType::Sha1 => parse_tokens(20)?,
|
||||
SdpAttributeFingerprintHashType::Sha224 => parse_tokens(28)?,
|
||||
SdpAttributeFingerprintHashType::Sha256 => parse_tokens(32)?,
|
||||
SdpAttributeFingerprintHashType::Sha384 => parse_tokens(48)?,
|
||||
SdpAttributeFingerprintHashType::Sha512 => parse_tokens(64)?,
|
||||
};
|
||||
|
||||
Ok(SdpAttribute::Fingerprint(SdpAttributeFingerprint {
|
||||
hash_algorithm,
|
||||
fingerprint,
|
||||
}))
|
||||
let hash_algorithm = SdpAttributeFingerprintHashType::try_from_name(tokens[0])?;
|
||||
let bytes = hash_algorithm.parse_octets(tokens[1])?;
|
||||
let fingerprint = SdpAttributeFingerprint::try_from((hash_algorithm, bytes))?;
|
||||
Ok(SdpAttribute::Fingerprint(fingerprint))
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
25
third_party/rust/webrtc-sdp/src/lib.rs
vendored
25
third_party/rust/webrtc-sdp/src/lib.rs
vendored
@ -543,7 +543,7 @@ fn parse_timing(value: &str) -> Result<SdpType, SdpParserInternalError> {
|
||||
Ok(SdpType::Timing(t))
|
||||
}
|
||||
|
||||
fn parse_sdp_line(line: &str, line_number: usize) -> Result<SdpLine, SdpParserError> {
|
||||
pub fn parse_sdp_line(line: &str, line_number: usize) -> Result<SdpLine, SdpParserError> {
|
||||
if line.find('=') == None {
|
||||
return Err(SdpParserError::Line {
|
||||
error: SdpParserInternalError::Generic("missing = character in line".to_string()),
|
||||
@ -697,29 +697,6 @@ fn sanity_check_sdp_session(session: &SdpSession) -> Result<(), SdpParserError>
|
||||
}
|
||||
|
||||
for msection in &session.media {
|
||||
if msection.get_attribute(SdpAttributeType::Sendonly).is_some() {
|
||||
if let Some(&SdpAttribute::Simulcast(ref x)) =
|
||||
msection.get_attribute(SdpAttributeType::Simulcast)
|
||||
{
|
||||
if !x.receive.is_empty() {
|
||||
return Err(make_seq_error(
|
||||
"Simulcast can't define receive parameters for sendonly",
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
if msection.get_attribute(SdpAttributeType::Recvonly).is_some() {
|
||||
if let Some(&SdpAttribute::Simulcast(ref x)) =
|
||||
msection.get_attribute(SdpAttributeType::Simulcast)
|
||||
{
|
||||
if !x.send.is_empty() {
|
||||
return Err(make_seq_error(
|
||||
"Simulcast can't define send parameters for recvonly",
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if msection
|
||||
.get_attribute(SdpAttributeType::RtcpMuxOnly)
|
||||
.is_some()
|
||||
|
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.to_string()),
|
||||
IpAddr::V6(ipv6) => format!("IN IP6 {}", ipv6.to_string()),
|
||||
IpAddr::V4(ipv4) => format!("IN IP4 {}", ipv4),
|
||||
IpAddr::V6(ipv6) => format!("IN IP6 {}", ipv6),
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user