Bug 1344556 - Part 5: Fix bug where sendonly extmaps would be configured on recv tracks, and vice versa. r?drno draft
authorByron Campen [:bwc] <docfaraday@gmail.com>
Wed, 08 Mar 2017 15:02:01 -0600
changeset 551896 192421c4036d3508ded0ab6deb1391635e95fc4e
parent 551895 a0c504bafd8bfe32f16f08054a276c1d0e2936be
child 551897 e6acef51ccfb161e81c033c1df4e71cd08c754f6
push id51186
push userbcampen@mozilla.com
push dateMon, 27 Mar 2017 16:29:37 +0000
reviewersdrno
bugs1344556
milestone55.0a1
Bug 1344556 - Part 5: Fix bug where sendonly extmaps would be configured on recv tracks, and vice versa. r?drno MozReview-Commit-ID: DMwDGCnUTYX
media/webrtc/signaling/src/jsep/JsepTrack.cpp
--- a/media/webrtc/signaling/src/jsep/JsepTrack.cpp
+++ b/media/webrtc/signaling/src/jsep/JsepTrack.cpp
@@ -461,17 +461,25 @@ JsepTrack::Negotiate(const SdpMediaSecti
 
   UniquePtr<JsepTrackNegotiatedDetails> negotiatedDetails =
       MakeUnique<JsepTrackNegotiatedDetails>();
 
   CreateEncodings(remote, negotiatedCodecs.values, negotiatedDetails.get());
 
   if (answer.GetAttributeList().HasAttribute(SdpAttribute::kExtmapAttribute)) {
     for (auto& extmapAttr : answer.GetAttributeList().GetExtmap().mExtmaps) {
-      negotiatedDetails->mExtmap[extmapAttr.extensionname] = extmapAttr;
+      SdpDirectionAttribute::Direction direction = extmapAttr.direction;
+      if (&remote == &answer) {
+        // Answer is remote, we need to flip this.
+        direction = ~direction;
+      }
+
+      if (direction & mDirection) {
+        negotiatedDetails->mExtmap[extmapAttr.extensionname] = extmapAttr;
+      }
     }
   }
 
   if (mDirection == sdp::kRecv) {
     mSsrcs.clear();
     if (remote.GetAttributeList().HasAttribute(SdpAttribute::kSsrcAttribute)) {
       for (auto& ssrcAttr : remote.GetAttributeList().GetSsrc().mSsrcs) {
         AddSsrc(ssrcAttr.ssrc);