Bug 1474712: Added support for whitespace seperacted ssrc-values in the Rust parser, r=bwc

Added support for whitespace in source-level attributes
Extended C++ unti test CheckSsrc
Extended Rust unti test for ssrc

MozReview-Commit-ID: 1xiYyZBYf5o

--HG--
extra : rebase_source : 26d8ee11592e40fa1c25021b86953c72b14636a7
This commit is contained in:
Johannes Willbold 2018-07-11 11:13:56 -07:00
parent 29c0e06cd6
commit ea1567d09c
2 changed files with 9 additions and 2 deletions

View File

@ -1904,6 +1904,7 @@ const std::string kBasicAudioVideoOffer =
"a=end-of-candidates" CRLF
"a=ssrc:1111 foo" CRLF
"a=ssrc:1111 foo:bar" CRLF
"a=ssrc:1111 msid:1d0cdb4e-5934-4f0f-9f88-40392cb60d31 315b086a-5cb6-4221-89de-caf0b038c79d" CRLF
"a=imageattr:120 send * recv *" CRLF
"a=imageattr:121 send [x=640,y=480] recv [x=640,y=480]" CRLF
"a=rid:bar recv pt=120;max-width=800;max-height=600" CRLF
@ -2157,11 +2158,15 @@ TEST_P(NewSdpTest, CheckSsrc)
ASSERT_TRUE(mSdp->GetMediaSection(1).GetAttributeList().HasAttribute(
SdpAttribute::kSsrcAttribute));
ssrcs = mSdp->GetMediaSection(1).GetAttributeList().GetSsrc().mSsrcs;
ASSERT_EQ(2U, ssrcs.size());
ASSERT_EQ(3U, ssrcs.size());
ASSERT_EQ(1111U, ssrcs[0].ssrc);
ASSERT_EQ("foo", ssrcs[0].attribute);
ASSERT_EQ(1111U, ssrcs[1].ssrc);
ASSERT_EQ("foo:bar", ssrcs[1].attribute);
ASSERT_EQ(1111U, ssrcs[2].ssrc);
ASSERT_EQ("msid:1d0cdb4e-5934-4f0f-9f88-40392cb60d31 "
"315b086a-5cb6-4221-89de-caf0b038c79d",
ssrcs[2].attribute);
}
TEST_P(NewSdpTest, CheckRtpmap) {

View File

@ -1602,7 +1602,7 @@ fn parse_simulcast(to_parse: &str) -> Result<SdpAttribute, SdpParserInternalErro
}
fn parse_ssrc(to_parse: &str) -> Result<SdpAttribute, SdpParserInternalError> {
let mut tokens = to_parse.split_whitespace();
let mut tokens = to_parse.splitn(2,' ');
let ssrc_id = match tokens.next() {
None => {
return Err(SdpParserInternalError::Generic("Ssrc attribute is missing ssrc-id value"
@ -2101,6 +2101,8 @@ fn test_parse_attribute_ssrc() {
assert!(parse_attribute("ssrc:2655508255 foo").is_ok());
assert!(parse_attribute("ssrc:2655508255 cname:{735484ea-4f6c-f74a-bd66-7425f8476c2e}")
.is_ok());
assert!(parse_attribute("ssrc:2082260239 msid:1d0cdb4e-5934-4f0f-9f88-40392cb60d31 315b086a-5cb6-4221-89de-caf0b038c79d")
.is_ok());
assert!(parse_attribute("ssrc:").is_err());
assert!(parse_attribute("ssrc:foo").is_err());