Bug 1641600 - Add SetRtxIsAllowed method to JsepTrack and JsepSession; r=bwc
☠☠ backed out by dd3769eed4d1 ☠ ☠
authorDan Minor <dminor@mozilla.com>
Wed, 03 Jun 2020 20:54:58 +0000
changeset 597945 86c2932e66d3dce463d7047bc63bf7af76221edc
parent 597944 91da551351b59af72d6fc571cfa55bf3dfff3316
child 597946 249782af96bbf82fa5d12ff7101e30c06b4fad92
push id13310
push userffxbld-merge
push dateMon, 29 Jun 2020 14:50:06 +0000
treeherdermozilla-beta@15a59a0afa5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbwc
bugs1641600
milestone79.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 1641600 - Add SetRtxIsAllowed method to JsepTrack and JsepSession; r=bwc Differential Revision: https://phabricator.services.mozilla.com/D77813
media/webrtc/signaling/src/jsep/JsepSession.h
media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp
media/webrtc/signaling/src/jsep/JsepTrack.cpp
media/webrtc/signaling/src/jsep/JsepTrack.h
media/webrtc/signaling/src/jsep/JsepTransceiver.h
--- a/media/webrtc/signaling/src/jsep/JsepSession.h
+++ b/media/webrtc/signaling/src/jsep/JsepSession.h
@@ -202,17 +202,23 @@ class JsepSession {
 
       if (transceiver->mSendTrack.GetActive() ||
           transceiver->GetMediaType() == SdpMediaSection::kApplication) {
         sending[transceiver->mSendTrack.GetMediaType()]++;
       }
     }
   }
 
+  // See Bug 1642419, this can be removed when all sites are working with RTX.
+  void SetRtxIsAllowed(bool aRtxIsAllowed) { mRtxIsAllowed = aRtxIsAllowed; }
+
  protected:
   const std::string mName;
   JsepSignalingState mState;
   uint32_t mNegotiations;
+
+  // See Bug 1642419, this can be removed when all sites are working with RTX.
+  bool mRtxIsAllowed = true;
 };
 
 }  // namespace mozilla
 
 #endif
--- a/media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp
+++ b/media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp
@@ -402,17 +402,18 @@ std::vector<SdpExtmapAttributeList::Extm
       mediaType = JsepMediaType::kVideo;
       if (msection.GetAttributeList().HasAttribute(
               SdpAttribute::kRidAttribute)) {
         // We need RID support
         // TODO: Would it be worth checking that the direction is sane?
         AddVideoRtpExtension(webrtc::RtpExtension::kRtpStreamIdUri,
                              SdpDirectionAttribute::kSendonly);
 
-        if (Preferences::GetBool("media.peerconnection.video.use_rtx", false)) {
+        if (mRtxIsAllowed &&
+            Preferences::GetBool("media.peerconnection.video.use_rtx", false)) {
           AddVideoRtpExtension(webrtc::RtpExtension::kRepairedRtpStreamIdUri,
                                SdpDirectionAttribute::kSendonly);
         }
       }
       break;
     default:;
   }
   if (mediaType != JsepMediaType::kNone) {
@@ -1944,16 +1945,17 @@ void JsepSessionImpl::SetupDefaultCodecs
 
   mSupportedCodecs.emplace_back(
       new JsepAudioCodecDescription("8", "PCMA", 8000, 1));
 
   mSupportedCodecs.emplace_back(
       new JsepAudioCodecDescription("101", "telephone-event", 8000, 1));
 
   bool useRtx =
+      mRtxIsAllowed &&
       Preferences::GetBool("media.peerconnection.video.use_rtx", false);
   // Supported video codecs.
   // Note: order here implies priority for building offers!
   UniquePtr<JsepVideoCodecDescription> vp8(
       new JsepVideoCodecDescription("120", "VP8", 90000));
   // Defaults for mandatory params
   vp8->mConstraints.maxFs = 12288;  // Enough for 2048x1536
   vp8->mConstraints.maxFps = 60;
--- a/media/webrtc/signaling/src/jsep/JsepTrack.cpp
+++ b/media/webrtc/signaling/src/jsep/JsepTrack.cpp
@@ -446,16 +446,17 @@ std::vector<UniquePtr<JsepCodecDescripti
 
         // Remember whether we negotiated rtx and the associated pt for later.
         if (codec->mType == SdpMediaSection::kVideo) {
           JsepVideoCodecDescription* videoCodec =
               static_cast<JsepVideoCodecDescription*>(codec.get());
           JsepVideoCodecDescription* cloneVideoCodec =
               static_cast<JsepVideoCodecDescription*>(clone.get());
           bool useRtx =
+              mRtxIsAllowed &&
               Preferences::GetBool("media.peerconnection.video.use_rtx", false);
           videoCodec->mRtxEnabled = useRtx && cloneVideoCodec->mRtxEnabled;
           videoCodec->mRtxPayloadType = cloneVideoCodec->mRtxPayloadType;
         }
 
         // Moves the codec out of mPrototypeCodecs, leaving an empty
         // UniquePtr, so we don't use it again. Also causes successfully
         // negotiated codecs to be placed up front in the future.
--- a/media/webrtc/signaling/src/jsep/JsepTrack.h
+++ b/media/webrtc/signaling/src/jsep/JsepTrack.h
@@ -193,17 +193,18 @@ class JsepTrack {
   virtual void SetCNAME(const std::string& cname) { mCNAME = cname; }
 
   virtual sdp::Direction GetDirection() const { return mDirection; }
 
   virtual const std::vector<uint32_t>& GetSsrcs() const { return mSsrcs; }
 
   virtual std::vector<uint32_t> GetRtxSsrcs() const {
     std::vector<uint32_t> result;
-    if (Preferences::GetBool("media.peerconnection.video.use_rtx", false)) {
+    if (mRtxIsAllowed &&
+        Preferences::GetBool("media.peerconnection.video.use_rtx", false)) {
       std::for_each(
           mSsrcToRtxSsrc.begin(), mSsrcToRtxSsrc.end(),
           [&result](const auto& pair) { result.push_back(pair.second); });
     }
     return result;
   }
 
   virtual void EnsureSsrcs(SsrcGenerator& ssrcGenerator, size_t aNumber);
@@ -273,16 +274,19 @@ class JsepTrack {
     MOZ_ASSERT(outConstraintsList);
     *outConstraintsList = mJsEncodeConstraints;
   }
 
   void AddToMsection(const std::vector<JsConstraints>& constraintsList,
                      sdp::Direction direction, SsrcGenerator& ssrcGenerator,
                      bool requireRtxSsrcs, SdpMediaSection* msection);
 
+  // See Bug 1642419, this can be removed when all sites are working with RTX.
+  void SetRtxIsAllowed(bool aRtxIsAllowed) { mRtxIsAllowed = aRtxIsAllowed; }
+
  private:
   std::vector<UniquePtr<JsepCodecDescription>> GetCodecClones() const;
   static void EnsureNoDuplicatePayloadTypes(
       std::vector<UniquePtr<JsepCodecDescription>>* codecs);
   static void GetPayloadTypes(
       const std::vector<UniquePtr<JsepCodecDescription>>& codecs,
       std::vector<uint16_t>* pts);
   void AddToMsection(const std::vector<UniquePtr<JsepCodecDescription>>& codecs,
@@ -320,13 +324,16 @@ class JsepTrack {
   // multiple of these. If there are none, we assume unconstrained unicast with
   // no rid.
   std::vector<JsConstraints> mJsEncodeConstraints;
   UniquePtr<JsepTrackNegotiatedDetails> mNegotiatedDetails;
   std::vector<uint32_t> mSsrcs;
   std::map<uint32_t, uint32_t> mSsrcToRtxSsrc;
   bool mActive;
   bool mRemoteSetSendBit;
+
+  // See Bug 1642419, this can be removed when all sites are working with RTX.
+  bool mRtxIsAllowed = true;
 };
 
 }  // namespace mozilla
 
 #endif
--- a/media/webrtc/signaling/src/jsep/JsepTransceiver.h
+++ b/media/webrtc/signaling/src/jsep/JsepTransceiver.h
@@ -172,16 +172,22 @@ class JsepTransceiver {
   bool HasOwnTransport() const {
     if (mTransport.mComponents &&
         (!HasBundleLevel() || (GetLevel() == BundleLevel()))) {
       return true;
     }
     return false;
   }
 
+  // See Bug 1642419, this can be removed when all sites are working with RTX.
+  void SetRtxIsAllowed(bool aRtxIsAllowed) {
+    mSendTrack.SetRtxIsAllowed(aRtxIsAllowed);
+    mRecvTrack.SetRtxIsAllowed(aRtxIsAllowed);
+  }
+
   // This is the direction JS wants. It might not actually happen.
   SdpDirectionAttribute::Direction mJsDirection;
 
   JsepTrack mSendTrack;
   JsepTrack mRecvTrack;
   JsepTransport mTransport;
 
  private: