Bug 1370562: Don't try to validate attributes on disabled m-sections in answers. r?drno draft
authorByron Campen [:bwc] <docfaraday@gmail.com>
Tue, 27 Mar 2018 14:18:09 -0500
changeset 773277 cc66fffb9f291e117c2bac4c109dec0e0fdcb234
parent 770611 7b55d395bb63165c20a9230f82b3b14da09bcd2d
push id104200
push userbcampen@mozilla.com
push dateTue, 27 Mar 2018 19:36:02 +0000
reviewersdrno
bugs1370562
milestone61.0a1
Bug 1370562: Don't try to validate attributes on disabled m-sections in answers. r?drno MozReview-Commit-ID: 1T7busmzZPZ
media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp
--- a/media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp
+++ b/media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp
@@ -1790,16 +1790,26 @@ JsepSessionImpl::ValidateAnswer(const Sd
     const SdpMediaSection& answerMsection = answer.GetMediaSection(i);
 
     if (offerMsection.GetMediaType() != answerMsection.GetMediaType()) {
       JSEP_SET_ERROR(
           "Answer and offer have different media types at m-line " << i);
       return NS_ERROR_INVALID_ARG;
     }
 
+    if (mSdpHelper.MsectionIsDisabled(answerMsection)) {
+      continue;
+    }
+
+    if (mSdpHelper.MsectionIsDisabled(offerMsection)) {
+      JSEP_SET_ERROR("Answer tried to enable an m-section that was disabled in "
+                     "the offer");
+      return NS_ERROR_INVALID_ARG;
+    }
+
     if (!offerMsection.IsSending() && answerMsection.IsReceiving()) {
       JSEP_SET_ERROR("Answer tried to set recv when offer did not set send");
       return NS_ERROR_INVALID_ARG;
     }
 
     if (!offerMsection.IsReceiving() && answerMsection.IsSending()) {
       JSEP_SET_ERROR("Answer tried to set send when offer did not set recv");
       return NS_ERROR_INVALID_ARG;