Bug 1474712: Added support for whitespace seperacted ssrc-values in the Rust parser, r=bwc draft
authorJohannes Willbold <j.willbold@mozilla.com>
Wed, 11 Jul 2018 11:13:56 -0700
changeset 818008 c443dd798ec222c498f33f5304d867290624bf26
parent 816856 aff060ad3204234adae2d59b3776207c6687ebfc
push id116239
push userbmo:johannes.willbold@rub.de
push dateFri, 13 Jul 2018 20:13:56 +0000
reviewersbwc
bugs1474712
milestone63.0a1
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
media/webrtc/signaling/gtest/sdp_unittests.cpp
media/webrtc/signaling/src/sdp/rsdparsa/src/attribute_type.rs
--- a/media/webrtc/signaling/gtest/sdp_unittests.cpp
+++ b/media/webrtc/signaling/gtest/sdp_unittests.cpp
@@ -1899,16 +1899,17 @@ const std::string kBasicAudioVideoOffer 
 "a=candidate:6 1 UDP 16515071 162.222.183.171 64800 typ relay raddr 162.222.183.171 rport 64800" CRLF
 "a=candidate:2 1 UDP 1694236671 24.6.134.204 59530 typ srflx raddr 10.0.0.36 rport 59530" CRLF
 "a=candidate:3 1 UDP 100401151 162.222.183.171 62935 typ relay raddr 162.222.183.171 rport 62935" CRLF
 "a=candidate:3 2 UDP 100401150 162.222.183.171 61026 typ relay raddr 162.222.183.171 rport 61026" CRLF
 "a=rtcp:61026" CRLF
 "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
 "a=rid:bar123 recv max-width=1920;max-height=1080" CRLF
 "a=simulcast:recv rid=bar;bar123" CRLF
 "m=audio 9 RTP/SAVPF 0" CRLF
 "a=mid:third" CRLF
 "a=rtpmap:0 PCMU/8000" CRLF
@@ -2157,16 +2158,20 @@ 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(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) {
   ParseSdp(kBasicAudioVideoOffer);
   ASSERT_TRUE(!!mSdp) << "Parse failed: " << GetParseErrors();
   ASSERT_EQ(3U, mSdp->GetMediaSectionCount())
     << "Wrong number of media sections";
 
--- a/media/webrtc/signaling/src/sdp/rsdparsa/src/attribute_type.rs
+++ b/media/webrtc/signaling/src/sdp/rsdparsa/src/attribute_type.rs
@@ -1597,17 +1597,17 @@ fn parse_simulcast(to_parse: &str) -> Re
         SdpSingleDirection::Recv => SdpAttributeSimulcast {
             send: second_version_list,
             receive: first_version_list,
         },
     }))
 }
 
 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"
                                                            .to_string()))
         }
         Some(x) => x.parse::<u32>()?,
     };
     let mut ssrc = SdpAttributeSsrc::new(ssrc_id);
@@ -2073,16 +2073,18 @@ fn test_parse_attribute_simulcast() {
 }
 
 #[test]
 fn test_parse_attribute_ssrc() {
     assert!(parse_attribute("ssrc:2655508255").is_ok());
     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());
 }
 
 #[test]
 fn test_parse_attribute_ssrc_group() {
     assert!(parse_attribute("ssrc-group:FID 3156517279 2673335628").is_ok())