Bug 1646838: Rewrite this to use c++ structured bindings, and pick better names. r=mjf
authorByron Campen [:bwc] <docfaraday@gmail.com>
Thu, 18 Jun 2020 23:46:13 +0000
changeset 536427 fab65df8e9c81e829a317dda92e40a79c676df04
parent 536426 44ab1e4eae15d988aa94b30130def46d16ff3697
child 536428 1d58c168c2cc57cab49c1ad84f702f5865381c04
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: Rewrite this to use c++ structured bindings, and pick better names. r=mjf Depends on D80275 Differential Revision: https://phabricator.services.mozilla.com/D80277
media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp
media/webrtc/signaling/src/sdp/SdpHelper.h
--- a/media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp
+++ b/media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp
@@ -921,24 +921,23 @@ nsresult JsepSessionImpl::HandleNegotiat
 
   const Sdp& answer = *mIsPendingOfferer ? *remote : *local;
 
   SdpHelper::BundledMids bundledMids;
   nsresult rv = mSdpHelper.GetBundledMids(answer, &bundledMids);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // First, set the bundle level on the transceivers
-  for (auto& midAndMaster : bundledMids) {
-    JsepTransceiver* bundledTransceiver =
-        GetTransceiverForMid(midAndMaster.first);
+  for (auto& [mid, transportOwner] : bundledMids) {
+    JsepTransceiver* bundledTransceiver = GetTransceiverForMid(mid);
     if (!bundledTransceiver) {
-      JSEP_SET_ERROR("No transceiver for bundled mid " << midAndMaster.first);
+      JSEP_SET_ERROR("No transceiver for bundled mid " << mid);
       return NS_ERROR_INVALID_ARG;
     }
-    bundledTransceiver->SetBundleLevel(midAndMaster.second->GetLevel());
+    bundledTransceiver->SetBundleLevel(transportOwner->GetLevel());
   }
 
   // Now walk through the m-sections, perform negotiation, and update the
   // transceivers.
   for (size_t i = 0; i < local->GetMediaSectionCount(); ++i) {
     JsepTransceiver* transceiver(GetTransceiverForLevel(i));
     if (!transceiver) {
       MOZ_ASSERT(false);
--- a/media/webrtc/signaling/src/sdp/SdpHelper.h
+++ b/media/webrtc/signaling/src/sdp/SdpHelper.h
@@ -37,17 +37,17 @@ class SdpHelper {
                                   const Sdp& offerersPreviousSdp,
                                   const Sdp& newOffer, size_t level);
   bool IceCredentialsDiffer(const SdpMediaSection& msection1,
                             const SdpMediaSection& msection2);
 
   bool MsectionIsDisabled(const SdpMediaSection& msection) const;
   static void DisableMsection(Sdp* sdp, SdpMediaSection* msection);
 
-  // Maps each mid to the m-section that is the master of its bundle.
+  // Maps each mid to the m-section that owns its bundle transport.
   // 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 HasOwnTransport(const Sdp& localSdp, uint16_t level);
   void GetBundleGroups(const Sdp& sdp,
                        std::vector<SdpGroupAttributeList::Group>* groups) const;