Bug 1646838: Replace this function with a better named one. r=mjf
authorByron Campen [:bwc] <docfaraday@gmail.com>
Thu, 18 Jun 2020 23:47:47 +0000
changeset 536426 44ab1e4eae15d988aa94b30130def46d16ff3697
parent 536425 420d63a9029c410611587f35fc2931bf66f56392
child 536427 fab65df8e9c81e829a317dda92e40a79c676df04
push id119453
push userbcampen@mozilla.com
push dateFri, 19 Jun 2020 00:01:58 +0000
treeherderautoland@1d58c168c2cc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmjf
bugs1646838
milestone79.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 1646838: Replace this function with a better named one. r=mjf Depends on D80272 Differential Revision: https://phabricator.services.mozilla.com/D80275
media/webrtc/signaling/gtest/jsep_session_unittest.cpp
media/webrtc/signaling/src/sdp/SdpHelper.cpp
media/webrtc/signaling/src/sdp/SdpHelper.h
--- a/media/webrtc/signaling/gtest/jsep_session_unittest.cpp
+++ b/media/webrtc/signaling/gtest/jsep_session_unittest.cpp
@@ -1427,17 +1427,17 @@ class JsepSessionTest : public JsepSessi
       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) {
         ValidateDisabledMSection(&msection);
         continue;
       }
-      if (!mSdpHelper.IsBundleSlave(*sdp, i)) {
+      if (mSdpHelper.HasOwnTransport(*sdp, i)) {
         const SdpAttributeList& attrs = msection.GetAttributeList();
 
         ASSERT_FALSE(attrs.GetIceUfrag().empty());
         ASSERT_FALSE(attrs.GetIcePwd().empty());
         const SdpFingerprintAttributeList& fps = attrs.GetFingerprint();
         for (auto fp = fps.mFingerprints.begin(); fp != fps.mFingerprints.end();
              ++fp) {
           std::string alg_str = "None";
--- a/media/webrtc/signaling/src/sdp/SdpHelper.cpp
+++ b/media/webrtc/signaling/src/sdp/SdpHelper.cpp
@@ -78,25 +78,25 @@ bool SdpHelper::AreOldTransportParamsVal
                                            const Sdp& offerersPreviousSdp,
                                            const Sdp& newOffer, size_t level) {
   if (MsectionIsDisabled(oldAnswer.GetMediaSection(level)) ||
       MsectionIsDisabled(newOffer.GetMediaSection(level))) {
     // Obvious
     return false;
   }
 
-  if (IsBundleSlave(oldAnswer, level)) {
+  if (!HasOwnTransport(oldAnswer, level)) {
     // The transport attributes on this m-section were thrown away, because it
     // was bundled.
     return false;
   }
 
   if (newOffer.GetMediaSection(level).GetAttributeList().HasAttribute(
           SdpAttribute::kBundleOnlyAttribute) &&
-      IsBundleSlave(newOffer, level)) {
+      !HasOwnTransport(newOffer, level)) {
     // It never makes sense to put transport attributes in a bundle-only
     // m-section
     return false;
   }
 
   if (IceCredentialsDiffer(newOffer.GetMediaSection(level),
                            offerersPreviousSdp.GetMediaSection(level))) {
     return false;
@@ -232,39 +232,39 @@ nsresult SdpHelper::GetBundledMids(const
 
       (*bundledMids)[mid] = masterBundleMsection;
     }
   }
 
   return NS_OK;
 }
 
-bool SdpHelper::IsBundleSlave(const Sdp& sdp, uint16_t level) {
+bool SdpHelper::HasOwnTransport(const Sdp& sdp, uint16_t level) {
   auto& msection = sdp.GetMediaSection(level);
 
   if (!msection.GetAttributeList().HasAttribute(SdpAttribute::kMidAttribute)) {
     // No mid, definitely no bundle for this m-section
-    return false;
+    return true;
   }
   std::string mid(msection.GetAttributeList().GetMid());
 
   BundledMids bundledMids;
   nsresult rv = GetBundledMids(sdp, &bundledMids);
   if (NS_FAILED(rv)) {
     // Should have been caught sooner.
     MOZ_ASSERT(false);
-    return false;
+    return true;
   }
 
   if (bundledMids.count(mid) && level != bundledMids[mid]->GetLevel()) {
     // mid is bundled, and isn't the bundle m-section
-    return true;
+    return false;
   }
 
-  return false;
+  return true;
 }
 
 nsresult SdpHelper::GetMidFromLevel(const Sdp& sdp, uint16_t level,
                                     std::string* mid) {
   if (level >= sdp.GetMediaSectionCount()) {
     SDP_SET_ERROR("Index " << level << " out of range");
     return NS_ERROR_INVALID_ARG;
   }
--- a/media/webrtc/signaling/src/sdp/SdpHelper.h
+++ b/media/webrtc/signaling/src/sdp/SdpHelper.h
@@ -43,17 +43,17 @@ class SdpHelper {
   static void DisableMsection(Sdp* sdp, SdpMediaSection* msection);
 
   // Maps each mid to the m-section that is the master of its bundle.
   // Mids that do not appear in an a=group:BUNDLE do not appear here.
   typedef std::map<std::string, const SdpMediaSection*> BundledMids;
 
   nsresult GetBundledMids(const Sdp& sdp, BundledMids* bundledMids);
 
-  bool IsBundleSlave(const Sdp& localSdp, uint16_t level);
+  bool HasOwnTransport(const Sdp& localSdp, uint16_t level);
   void GetBundleGroups(const Sdp& sdp,
                        std::vector<SdpGroupAttributeList::Group>* groups) const;
 
   nsresult GetMidFromLevel(const Sdp& sdp, uint16_t level, std::string* mid);
   nsresult GetIdsFromMsid(const Sdp& sdp, const SdpMediaSection& msection,
                           std::vector<std::string>* streamId);
   nsresult GetMsids(const SdpMediaSection& msection,
                     std::vector<SdpMsidAttributeList::Msid>* msids);