Bug 1072388 - Part 2: Don't stomp level assignments on local offer rollback, since those are set by createOffer, not sLD. r=mjf
authorByron Campen [:bwc] <docfaraday@gmail.com>
Wed, 10 Apr 2019 15:57:14 +0000
changeset 469501 ec0a1e5ad360
parent 469500 d9429bdabd04
child 469502 12d67626c02a
push id35873
push userccoroiu@mozilla.com
push dateMon, 15 Apr 2019 21:36:26 +0000
treeherdermozilla-central@b8f49a14c458 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmjf
bugs1072388
milestone68.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 1072388 - Part 2: Don't stomp level assignments on local offer rollback, since those are set by createOffer, not sLD. r=mjf Depends on D26780 Differential Revision: https://phabricator.services.mozilla.com/D26781
media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp
media/webrtc/signaling/src/jsep/JsepTransceiver.h
--- a/media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp
+++ b/media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp
@@ -1548,49 +1548,49 @@ JsepTransceiver* JsepSessionImpl::FindUn
 
   return nullptr;
 }
 
 void JsepSessionImpl::RollbackLocalOffer() {
   for (size_t i = 0; i < mTransceivers.size(); ++i) {
     RefPtr<JsepTransceiver>& transceiver(mTransceivers[i]);
     if (i < mOldTransceivers.size()) {
-      transceiver->Rollback(*mOldTransceivers[i]);
+      transceiver->Rollback(*mOldTransceivers[i], false);
       continue;
     }
 
     RefPtr<JsepTransceiver> temp(
         new JsepTransceiver(transceiver->GetMediaType()));
     temp->mSendTrack.PopulateCodecs(mSupportedCodecs);
     temp->mRecvTrack.PopulateCodecs(mSupportedCodecs);
-    transceiver->Rollback(*temp);
+    transceiver->Rollback(*temp, false);
   }
 
   mOldTransceivers.clear();
 }
 
 void JsepSessionImpl::RollbackRemoteOffer() {
   for (size_t i = 0; i < mTransceivers.size(); ++i) {
     RefPtr<JsepTransceiver>& transceiver(mTransceivers[i]);
     if (i < mOldTransceivers.size()) {
-      transceiver->Rollback(*mOldTransceivers[i]);
+      transceiver->Rollback(*mOldTransceivers[i], true);
       continue;
     }
 
     // New transceiver!
     bool shouldRemove = !transceiver->HasAddTrackMagic() &&
                         transceiver->WasCreatedBySetRemote();
 
     // We rollback even for transceivers we will remove, just to ensure we end
     // up at the starting state.
     RefPtr<JsepTransceiver> temp(
         new JsepTransceiver(transceiver->GetMediaType()));
     temp->mSendTrack.PopulateCodecs(mSupportedCodecs);
     temp->mRecvTrack.PopulateCodecs(mSupportedCodecs);
-    transceiver->Rollback(*temp);
+    transceiver->Rollback(*temp, true);
 
     if (shouldRemove) {
       transceiver->Stop();
       transceiver->SetRemoved();
       mTransceivers.erase(mTransceivers.begin() + i);
       --i;
     }
   }
--- a/media/webrtc/signaling/src/jsep/JsepTransceiver.h
+++ b/media/webrtc/signaling/src/jsep/JsepTransceiver.h
@@ -50,23 +50,25 @@ class JsepTransceiver {
         mAddTrackMagic(orig.mAddTrackMagic),
         mWasCreatedBySetRemote(orig.mWasCreatedBySetRemote),
         mStopped(orig.mStopped),
         mRemoved(orig.mRemoved),
         mNegotiated(orig.mNegotiated) {}
 
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(JsepTransceiver);
 
-  void Rollback(JsepTransceiver& oldTransceiver) {
+  void Rollback(JsepTransceiver& oldTransceiver, bool rollbackLevel) {
     MOZ_ASSERT(oldTransceiver.GetMediaType() == GetMediaType());
     MOZ_ASSERT(!oldTransceiver.IsNegotiated() || !oldTransceiver.HasLevel() ||
                !HasLevel() || oldTransceiver.GetLevel() == GetLevel());
     mTransport = oldTransceiver.mTransport;
-    mLevel = oldTransceiver.mLevel;
-    mBundleLevel = oldTransceiver.mBundleLevel;
+    if (rollbackLevel) {
+      mLevel = oldTransceiver.mLevel;
+      mBundleLevel = oldTransceiver.mBundleLevel;
+    }
     mRecvTrack = oldTransceiver.mRecvTrack;
 
     // stop() caused by a disabled m-section in a remote offer cannot be
     // rolled back.
     if (!IsStopped()) {
       mMid = oldTransceiver.mMid;
     }
   }