From 0d162c327d0ea044ad341f9acdc853912c749ca5 Mon Sep 17 00:00:00 2001 From: "Byron Campen [:bwc]" Date: Thu, 18 Jun 2020 23:47:47 +0000 Subject: [PATCH] Bug 1646838: Replace this function with a better named one. r=mjf Depends on D80272 Differential Revision: https://phabricator.services.mozilla.com/D80275 --- .../signaling/gtest/jsep_session_unittest.cpp | 2 +- media/webrtc/signaling/src/sdp/SdpHelper.cpp | 14 +++++++------- media/webrtc/signaling/src/sdp/SdpHelper.h | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/media/webrtc/signaling/gtest/jsep_session_unittest.cpp b/media/webrtc/signaling/gtest/jsep_session_unittest.cpp index 90c1b6a366ce..cd3441abb4f8 100644 --- a/media/webrtc/signaling/gtest/jsep_session_unittest.cpp +++ b/media/webrtc/signaling/gtest/jsep_session_unittest.cpp @@ -1432,7 +1432,7 @@ class JsepSessionTest : public JsepSessionTestBase, ValidateDisabledMSection(&msection); continue; } - if (!mSdpHelper.IsBundleSlave(*sdp, i)) { + if (mSdpHelper.HasOwnTransport(*sdp, i)) { const SdpAttributeList& attrs = msection.GetAttributeList(); ASSERT_FALSE(attrs.GetIceUfrag().empty()); diff --git a/media/webrtc/signaling/src/sdp/SdpHelper.cpp b/media/webrtc/signaling/src/sdp/SdpHelper.cpp index 848a674dfbf8..0d9897652a64 100644 --- a/media/webrtc/signaling/src/sdp/SdpHelper.cpp +++ b/media/webrtc/signaling/src/sdp/SdpHelper.cpp @@ -83,7 +83,7 @@ bool SdpHelper::AreOldTransportParamsValid(const Sdp& oldAnswer, 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; @@ -91,7 +91,7 @@ bool SdpHelper::AreOldTransportParamsValid(const Sdp& oldAnswer, 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; @@ -237,12 +237,12 @@ nsresult SdpHelper::GetBundledMids(const Sdp& sdp, BundledMids* bundledMids) { 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()); @@ -251,15 +251,15 @@ bool SdpHelper::IsBundleSlave(const Sdp& sdp, uint16_t level) { 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, diff --git a/media/webrtc/signaling/src/sdp/SdpHelper.h b/media/webrtc/signaling/src/sdp/SdpHelper.h index 2d07901b7a18..c0a33af39617 100644 --- a/media/webrtc/signaling/src/sdp/SdpHelper.h +++ b/media/webrtc/signaling/src/sdp/SdpHelper.h @@ -48,7 +48,7 @@ class SdpHelper { 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* groups) const;