Backed out changeset e4e55af56102 (bug 1325991) on request from mjf
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Mon, 09 Jan 2017 16:09:44 +0100
changeset 457718 e038230119a50d99d696e9a47faf8db32bbeb0af
parent 457717 eabf0117673e41abf14e13a46b5be5f9aadcc3a0
child 457719 28ca0dfe8d723df5c41a5d79114a5e42609e3a3c
push id40874
push userbmo:kmckinley@mozilla.com
push dateMon, 09 Jan 2017 19:01:26 +0000
bugs1325991
milestone53.0a1
backs oute4e55af56102c89813ae8e2ba7fdcf7050036bdf
Backed out changeset e4e55af56102 (bug 1325991) on request from mjf
media/webrtc/signaling/gtest/jsep_session_unittest.cpp
media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp
media/webrtc/signaling/src/sdp/SdpHelper.cpp
--- a/media/webrtc/signaling/gtest/jsep_session_unittest.cpp
+++ b/media/webrtc/signaling/gtest/jsep_session_unittest.cpp
@@ -819,36 +819,31 @@ protected:
         }
       }
 
       void CheckDefaultRtpCandidate(bool expectDefault,
                                     const SdpMediaSection& msection,
                                     size_t transportLevel,
                                     const std::string& context) const
       {
-        Address expectedAddress = "0.0.0.0";
-        Port expectedPort = 9U;
-
         if (expectDefault) {
           // Copy so we can be terse and use []
           auto defaultCandidates = mDefaultCandidates;
-          expectedAddress = defaultCandidates[transportLevel][RTP].first;
-          expectedPort = defaultCandidates[transportLevel][RTP].second;
+          ASSERT_EQ(defaultCandidates[transportLevel][RTP].first,
+                    msection.GetConnection().GetAddress())
+            << context << " (level " << msection.GetLevel() << ")";
+          ASSERT_EQ(defaultCandidates[transportLevel][RTP].second,
+                    msection.GetPort())
+            << context << " (level " << msection.GetLevel() << ")";
+        } else {
+          ASSERT_EQ("0.0.0.0", msection.GetConnection().GetAddress())
+            << context << " (level " << msection.GetLevel() << ")";
+          ASSERT_EQ(9U, msection.GetPort())
+            << context << " (level " << msection.GetLevel() << ")";
         }
-
-        // if bundle-only attribute is present, expect port 0
-        const SdpAttributeList& attrs = msection.GetAttributeList();
-        if (attrs.HasAttribute(SdpAttribute::kBundleOnlyAttribute)) {
-          expectedPort = 0U;
-        }
-
-        ASSERT_EQ(expectedAddress, msection.GetConnection().GetAddress())
-          << context << " (level " << msection.GetLevel() << ")";
-        ASSERT_EQ(expectedPort, msection.GetPort())
-          << context << " (level " << msection.GetLevel() << ")";
       }
 
       void CheckDefaultRtcpCandidate(bool expectDefault,
                                      const SdpMediaSection& msection,
                                      size_t transportLevel,
                                      const std::string& context) const
       {
         if (expectDefault) {
@@ -1074,25 +1069,21 @@ private:
       auto& msection = sdp->GetMediaSection(i);
 
       if (msection.GetMediaType() == SdpMediaSection::kApplication) {
         ASSERT_EQ(SdpMediaSection::kDtlsSctp, msection.GetProtocol());
       } else {
         ASSERT_EQ(SdpMediaSection::kUdpTlsRtpSavpf, msection.GetProtocol());
       }
 
-      const SdpAttributeList& attrs = msection.GetAttributeList();
-      bool bundle_only = attrs.HasAttribute(SdpAttribute::kBundleOnlyAttribute);
-
-      // port 0 only means disabled when the bundle-only attribute is missing
-      if (!bundle_only && msection.GetPort() == 0) {
+      if (msection.GetPort() == 0) {
         ValidateDisabledMSection(&msection);
         continue;
       }
-
+      const SdpAttributeList& attrs = msection.GetAttributeList();
       ASSERT_EQ(source.mIceUfrag, attrs.GetIceUfrag());
       ASSERT_EQ(source.mIcePwd, attrs.GetIcePwd());
       const SdpFingerprintAttributeList& fps = attrs.GetFingerprint();
       for (auto fp = fps.mFingerprints.begin(); fp != fps.mFingerprints.end();
            ++fp) {
         std::string alg_str = "None";
 
         if (fp->hashFunc == SdpFingerprintAttributeList::kSha1) {
@@ -4257,22 +4248,20 @@ TEST_P(JsepSessionTest, TestMaxBundle)
   std::string offer = mSessionOff.GetLocalDescription();
   SipccSdpParser parser;
   UniquePtr<Sdp> parsedOffer = parser.Parse(offer);
   ASSERT_TRUE(parsedOffer.get());
 
   ASSERT_FALSE(
       parsedOffer->GetMediaSection(0).GetAttributeList().HasAttribute(
         SdpAttribute::kBundleOnlyAttribute));
-  ASSERT_NE(0U, parsedOffer->GetMediaSection(0).GetPort());
   for (size_t i = 1; i < parsedOffer->GetMediaSectionCount(); ++i) {
     ASSERT_TRUE(
         parsedOffer->GetMediaSection(i).GetAttributeList().HasAttribute(
           SdpAttribute::kBundleOnlyAttribute));
-    ASSERT_EQ(0U, parsedOffer->GetMediaSection(i).GetPort());
   }
 
 
   CheckPairs(mSessionOff, "Offerer pairs");
   CheckPairs(mSessionAns, "Answerer pairs");
   EXPECT_EQ(1U, GetActiveTransportCount(mSessionOff));
   EXPECT_EQ(1U, GetActiveTransportCount(mSessionAns));
 }
--- a/media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp
+++ b/media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp
@@ -661,18 +661,16 @@ JsepSessionImpl::SetupBundle(Sdp* sdp) c
           // m-section
           useBundleOnly = !mids.empty();
           break;
       }
 
       if (useBundleOnly) {
         attrs.SetAttribute(
             new SdpFlagAttribute(SdpAttribute::kBundleOnlyAttribute));
-        // Set port to 0 for sections with bundle-only attribute. (mjf)
-        sdp->GetMediaSection(i).SetPort(0);
       }
 
       mids.push_back(attrs.GetMid());
     }
   }
 
   if (mids.size() > 1) {
     UniquePtr<SdpGroupAttributeList> groupAttr(new SdpGroupAttributeList);
--- a/media/webrtc/signaling/src/sdp/SdpHelper.cpp
+++ b/media/webrtc/signaling/src/sdp/SdpHelper.cpp
@@ -419,29 +419,24 @@ SdpHelper::SetDefaultAddresses(const std
 void
 SdpHelper::SetDefaultAddresses(const std::string& defaultCandidateAddr,
                                uint16_t defaultCandidatePort,
                                const std::string& defaultRtcpCandidateAddr,
                                uint16_t defaultRtcpCandidatePort,
                                SdpMediaSection* msection)
 {
   msection->GetConnection().SetAddress(defaultCandidateAddr);
-  SdpAttributeList& attrList = msection->GetAttributeList();
-
-  // only set the port if there is no bundle-only attribute
-  if (!attrList.HasAttribute(SdpAttribute::kBundleOnlyAttribute)) {
-    msection->SetPort(defaultCandidatePort);
-  }
+  msection->SetPort(defaultCandidatePort);
 
   if (!defaultRtcpCandidateAddr.empty()) {
     sdp::AddrType ipVersion = sdp::kIPv4;
     if (defaultRtcpCandidateAddr.find(':') != std::string::npos) {
       ipVersion = sdp::kIPv6;
     }
-    attrList.SetAttribute(new SdpRtcpAttribute(
+    msection->GetAttributeList().SetAttribute(new SdpRtcpAttribute(
           defaultRtcpCandidatePort,
           sdp::kInternet,
           ipVersion,
           defaultRtcpCandidateAddr));
   }
 }
 
 nsresult