Bug 1507413 - Increase number of media streams supported by sipcc; r=bwc
authorDan Minor <dminor@mozilla.com>
Wed, 21 Nov 2018 20:00:19 +0000
changeset 504128 240b08a258e907a50403beb079e2afbcd456a3f8
parent 504127 3691033d6e78b3481438c6d75b6a1e4200591388
child 504129 5b09820ac9bd607d41c64386ce7be1b15d70e959
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbwc
bugs1507413
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1507413 - Increase number of media streams supported by sipcc; r=bwc This also removes SDP_MAX_LINE_LEN which is unused. Differential Revision: https://phabricator.services.mozilla.com/D12472
media/webrtc/signaling/gtest/sdp_unittests.cpp
media/webrtc/signaling/src/sdp/sipcc/sdp.h
--- a/media/webrtc/signaling/gtest/sdp_unittests.cpp
+++ b/media/webrtc/signaling/gtest/sdp_unittests.cpp
@@ -2876,17 +2876,16 @@ TEST_P(NewSdpTest, CheckMsid) {
   ASSERT_EQ("WMS", semantics[0].semantic);
   ASSERT_EQ(2U, semantics[0].msids.size());
   ASSERT_EQ("stream", semantics[0].msids[0]);
   ASSERT_EQ("streama", semantics[0].msids[1]);
   ASSERT_EQ("foo", semantics[1].semantic);
   ASSERT_EQ(1U, semantics[1].msids.size());
   ASSERT_EQ("stream", semantics[1].msids[0]);
 
-
   const SdpMsidAttributeList& msids1 =
       mSdp->GetMediaSection(0).GetAttributeList().GetMsid();
   ASSERT_EQ(1U, msids1.mMsids.size());
   ASSERT_EQ("stream", msids1.mMsids[0].identifier);
   ASSERT_EQ("track", msids1.mMsids[0].appdata);
   const SdpMsidAttributeList& msids2 =
       mSdp->GetMediaSection(1).GetAttributeList().GetMsid();
   ASSERT_EQ(2U, msids2.mMsids.size());
@@ -2896,16 +2895,47 @@ TEST_P(NewSdpTest, CheckMsid) {
   ASSERT_EQ("trackb", msids2.mMsids[1].appdata);
   const SdpMsidAttributeList& msids3 =
       mSdp->GetMediaSection(2).GetAttributeList().GetMsid();
   ASSERT_EQ(1U, msids3.mMsids.size());
   ASSERT_EQ("noappdata", msids3.mMsids[0].identifier);
   ASSERT_EQ("", msids3.mMsids[0].appdata);
 }
 
+TEST_P(NewSdpTest, CheckManyMsidSemantics) {
+  if (::testing::get<0>(GetParam())) {return;}
+  std::ostringstream msid;
+  msid << "a=msid-semantic: foo";
+  for (size_t i = 0; i < SDP_MAX_MEDIA_STREAMS + 1; ++i) {
+    msid << " " << i;
+  }
+  msid << CRLF;
+
+  std::string offer =
+    "v=0" CRLF
+    "o=- 4294967296 2 IN IP4 127.0.0.1" CRLF
+    "s=SIP Call" CRLF
+    "c=IN IP4 198.51.100.7" CRLF
+    "t=0 0" CRLF;
+  offer += msid.str();
+  offer +=
+    "m=video 56436 RTP/SAVPF 120" CRLF
+    "b=CT:1000" CRLF
+    "a=rtpmap:120 VP8/90000" CRLF;
+
+  ParseSdp(offer);
+  auto semantics = mSdp->GetAttributeList().GetMsidSemantic().mMsidSemantics;
+  ASSERT_EQ(1U, semantics.size());
+
+  // Only sipcc is limited by SDP_MAX_MEDIA_STREAMS, the Rust parser
+  // will parse all of the msids.
+  ASSERT_GE(semantics[0].msids.size(),
+            static_cast<size_t>(SDP_MAX_MEDIA_STREAMS));
+}
+
 TEST_P(NewSdpTest, CheckRid) {
   ParseSdp(kBasicAudioVideoOffer);
   ASSERT_TRUE(!!mSdp);
   ASSERT_EQ(3U, mSdp->GetMediaSectionCount()) << "Wrong number of media sections";
 
   ASSERT_FALSE(mSdp->GetAttributeList().HasAttribute(
         SdpAttribute::kRidAttribute));
   ASSERT_FALSE(mSdp->GetMediaSection(0).GetAttributeList().HasAttribute(
@@ -2985,16 +3015,46 @@ TEST_P(NewSdpTest, CheckGroups) {
 
   const SdpGroupAttributeList::Group& group3 = group.mGroups[2];
   ASSERT_EQ(SdpGroupAttributeList::kLs, group3.semantics);
   ASSERT_EQ(2U, group3.tags.size());
   ASSERT_EQ("first", group3.tags[0]);
   ASSERT_EQ("third", group3.tags[1]);
 }
 
+TEST_P(NewSdpTest, CheckManyGroups) {
+  std::ostringstream bundle;
+  bundle << "a=group:BUNDLE";
+  for (size_t i = 0; i < SDP_MAX_MEDIA_STREAMS + 1; ++i) {
+    bundle << " " << i;
+  }
+  bundle << CRLF;
+
+  std::string offer =
+    "v=0" CRLF
+    "o=- 4294967296 2 IN IP4 127.0.0.1" CRLF
+    "s=SIP Call" CRLF
+    "c=IN IP4 198.51.100.7" CRLF
+    "t=0 0" CRLF;
+  offer += bundle.str();
+  offer +=
+    "m=video 56436 RTP/SAVPF 120" CRLF
+    "b=CT:1000" CRLF
+    "a=rtpmap:120 VP8/90000" CRLF;
+
+  ParseSdp(offer);
+  const SdpGroupAttributeList& group = mSdp->GetAttributeList().GetGroup();
+  const SdpGroupAttributeList::Group& group1 = group.mGroups[0];
+  ASSERT_EQ(SdpGroupAttributeList::kBundle, group1.semantics);
+
+  // Only sipcc is limited by SDP_MAX_MEDIA_STREAMS, the Rust parser
+  // will parse all of the groups.
+  ASSERT_GE(group1.tags.size(), static_cast<size_t>(SDP_MAX_MEDIA_STREAMS));
+}
+
 // SDP from a basic A/V call with data channel FFX/FFX
 const std::string kBasicAudioVideoDataOffer =
 "v=0" CRLF
 "o=Mozilla-SIPUA-35.0a1 27987 0 IN IP4 0.0.0.0" CRLF
 "s=SIP Call" CRLF
 "t=0 0" CRLF
 "a=ice-ufrag:8a39d2ae" CRLF
 "a=ice-pwd:601d53aba51a318351b3ecf5ee00048f" CRLF
--- a/media/webrtc/signaling/src/sdp/sipcc/sdp.h
+++ b/media/webrtc/signaling/src/sdp/sipcc/sdp.h
@@ -563,20 +563,19 @@ typedef enum sdp_srtp_crypto_suite_t_ {
 #define SDP_INVALID_PACKETIZATION_MODE_VALUE 255
 
 #define SDP_MAX_LEVEL_ASYMMETRY_ALLOWED_VALUE 1 /* max level asymmetry allowed value for H.264 */
 #define SDP_DEFAULT_LEVEL_ASYMMETRY_ALLOWED_VALUE 0 /* default level asymmetry allowed value for H.264 */
 #define SDP_INVALID_LEVEL_ASYMMETRY_ALLOWED_VALUE 2 /* invalid value for level-asymmetry-allowed param for H.264 */
 
 
 /* Max number of stream ids that can be grouped together */
-#define SDP_MAX_MEDIA_STREAMS 32
+#define SDP_MAX_MEDIA_STREAMS 128
 
 #define SDP_UNSUPPORTED         "Unsupported"
-#define SDP_MAX_LINE_LEN   256 /* Max len for SDP Line */
 
 #define SDP_MAX_PROFILE_VALUE  10
 #define SDP_MAX_LEVEL_VALUE    100
 #define SDP_MIN_PROFILE_LEVEL_VALUE 0
 #define SDP_MAX_TTL_VALUE  255
 #define SDP_MIN_MCAST_ADDR_HI_BIT_VAL 224
 #define SDP_MAX_MCAST_ADDR_HI_BIT_VAL 239