Bug 1628630 - update WEBRTC-SDP to 0.3.5;r=dminor

Differential Revision: https://phabricator.services.mozilla.com/D70339

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nico Grunbaum 2020-04-16 05:35:58 +00:00
parent 4cc133b568
commit 53809171df
8 changed files with 50 additions and 17 deletions

4
Cargo.lock generated
View File

@ -5002,9 +5002,9 @@ dependencies = [
[[package]]
name = "webrtc-sdp"
version = "0.3.4"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbedff74854f271e6e4c47d9fcbc8fbc254d6c153034ba9e0492121035c20cfe"
checksum = "33a041b38913afdc47ea2337fda2bcfdafd2928439422a601bc3bf3cff11a2ee"
dependencies = [
"log",
"url",

View File

@ -7,5 +7,5 @@ authors = ["Paul Ellenbogen <pe5@cs.princeton.edu>",
[dependencies]
libc = "^0.2.0"
log = "0.4"
rsdparsa = {package = "webrtc-sdp", version = "0.3.4"}
rsdparsa = {package = "webrtc-sdp", version = "0.3.5"}
nserror = { path = "../../../../../../xpcom/rust/nserror" }

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,7 @@
# Changelog
## [0.3.5] - 2020-04-07
### Fixed
- RTX apt can now be zero
## [0.3.4] - 2020-03-31
### Fixed
- Fixed new clippy warnings in stable

View File

@ -140,7 +140,7 @@ dependencies = [
[[package]]
name = "webrtc-sdp"
version = "0.3.4"
version = "0.3.5"
dependencies = [
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -12,7 +12,7 @@
[package]
name = "webrtc-sdp"
version = "0.3.4"
version = "0.3.5"
authors = ["Nils Ohlmeier <github@ohlmeier.org>"]
description = "This create 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"

View File

@ -544,6 +544,23 @@ impl fmt::Display for SdpAttributeExtmap {
}
}
#[derive(Clone, Copy)]
#[cfg_attr(feature = "serialize", derive(Serialize))]
pub struct RtxFmtpParameters {
pub apt: u8,
pub rtx_time: Option<u32>,
}
impl fmt::Display for RtxFmtpParameters {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if let Some(rtx_time) = self.rtx_time {
write!(f, "apt={};rtx-time={}", self.apt, rtx_time)
} else {
write!(f, "apt={}", self.apt)
}
}
}
#[derive(Clone)]
#[cfg_attr(feature = "serialize", derive(Serialize))]
pub struct SdpAttributeFmtpParameters {
@ -577,9 +594,8 @@ pub struct SdpAttributeFmtpParameters {
// telephone-event
pub dtmf_tones: String,
// Rtx
pub apt: u8,
pub rtx_time: u32,
// RTX
pub rtx: Option<RtxFmtpParameters>,
// Unknown
pub unknown_tokens: Vec<String>,
@ -587,6 +603,9 @@ pub struct SdpAttributeFmtpParameters {
impl fmt::Display for SdpAttributeFmtpParameters {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if let Some(ref rtx) = self.rtx {
return write!(f, "{}", rtx);
}
write!(
f,
"{parameters}{red}{dtmf}{unknown}",
@ -1982,8 +2001,7 @@ fn parse_fmtp(to_parse: &str) -> Result<SdpAttribute, SdpParserInternalError> {
maxplaybackrate: 48000,
encodings: Vec::new(),
dtmf_tones: "".to_string(),
apt: 0,
rtx_time: 0,
rtx: None,
unknown_tokens: Vec::new(),
};
@ -2064,8 +2082,21 @@ fn parse_fmtp(to_parse: &str) -> Result<SdpAttribute, SdpParserInternalError> {
parameters.useinbandfec = parse_bool(parameter_val, "useinbandfec")?
}
"CBR" => parameters.cbr = parse_bool(parameter_val, "cbr")?,
"APT" => parameters.apt = parameter_val.parse::<u8>()?,
"RTX-TIME" => parameters.rtx_time = parameter_val.parse::<u32>()?,
"APT" => {
parameters.rtx = Some(RtxFmtpParameters {
apt: parameter_val.parse::<u8>()?,
rtx_time: None,
})
}
"RTX-TIME" => {
if let Some(ref mut rtx) = parameters.rtx {
rtx.rtx_time = Some(parameter_val.parse::<u32>()?)
} else {
return Err(SdpParserInternalError::Generic(
"RTX codec must have an APT field".to_string(),
));
}
}
_ => parameters
.unknown_tokens
.push((*parameter_token).to_string()),
@ -3591,8 +3622,8 @@ mod tests {
assert!(
parse_attribute("fmtp:8 x-google-start-bitrate=800; maxplaybackrate=48000;").is_ok()
);
assert!(parse_attribute("fmtp:97 apt=96").is_ok());
assert!(parse_attribute("fmtp:97 apt=96;rtx-time=3000").is_ok());
check_parse_and_serialize("fmtp:97 apt=96");
check_parse_and_serialize("fmtp:97 apt=96;rtx-time=3000");
}
#[test]

View File

@ -542,8 +542,7 @@ mod tests {
maxplaybackrate: 48000,
encodings: Vec::new(),
dtmf_tones: "".to_string(),
apt: 0,
rtx_time: 0,
rtx: None,
unknown_tokens: Vec::new()
}
},))