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 331231 d2cb189066ea16c0ff0b0840b5848b5328e49ac6
parent 331230 9d5fa6d7558a415d38b979452c99f65dddc3a667
child 331232 9eeb24ae183dbbd9965c16b5f5ee995331568ac2
push id10938
push userBogdan.Postelnicu@softvision.ro
push dateTue, 16 Feb 2016 15:52:05 +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 "