Bug 1247656: Make sure that remote reoffer does not change the media type of an m-line. r=drno
authorByron Campen [:bwc] <docfaraday@gmail.com>
Thu, 11 Feb 2016 13:00:58 -0600
changeset 334729 b0da28952e5ba757afd5c7098d633e09ce929b60
parent 334691 525acdb20f3ae457cd7d05e2a4c4fafa63dab73d
child 334730 0e868ee89abc73e4142af02b51c80681c0960293
push id11625
push usercykesiopka.bmo@gmail.com
push dateThu, 25 Feb 2016 23:32:13 +0000
reviewersdrno
bugs1247656
milestone47.0a1
Bug 1247656: Make sure that remote reoffer does not change the media type of an m-line. r=drno MozReview-Commit-ID: DFXgLuSW6nM
media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp
--- a/media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp
+++ b/media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp
@@ -1844,16 +1844,23 @@ JsepSessionImpl::ValidateRemoteDescripti
   for (size_t i = 0;
        i < mCurrentRemoteDescription->GetMediaSectionCount();
        ++i) {
     if (mSdpHelper.MsectionIsDisabled(description.GetMediaSection(i)) ||
         mSdpHelper.MsectionIsDisabled(mCurrentRemoteDescription->GetMediaSection(i))) {
       continue;
     }
 
+    if (mCurrentRemoteDescription->GetMediaSection(i).GetMediaType() !=
+        description.GetMediaSection(i).GetMediaType()) {
+      JSEP_SET_ERROR("Remote description changes the media type of m-line "
+                     << i);
+      return NS_ERROR_INVALID_ARG;
+    }
+
     const SdpAttributeList& newAttrs(
         description.GetMediaSection(i).GetAttributeList());
     const SdpAttributeList& oldAttrs(
         mCurrentRemoteDescription->GetMediaSection(i).GetAttributeList());
 
     if ((newAttrs.GetIceUfrag() != oldAttrs.GetIceUfrag()) ||
         (newAttrs.GetIcePwd() != oldAttrs.GetIcePwd())) {
       JSEP_SET_ERROR("ICE restart is unsupported at this time "