Bug 1155435 - connected negotiated REMB from sdp into VideoConduit, r=drno, r=jesup
authorMichael Froman <mfroman@mozilla.com>
Thu, 19 May 2016 10:23:45 -0500
changeset 298723 0a63c85e816e70ce7aac7c7461ad661fa8b47aea
parent 298722 6fa9a68064b369d7c44053486b2a023cbc63c955
child 298724 9fa7e2a17ee96abc884352ec5482642b5da30a57
push id30285
push usercbook@mozilla.com
push dateWed, 25 May 2016 13:06:07 +0000
treeherdermozilla-central@d6d4e8417d2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdrno, jesup
bugs1155435
milestone49.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 1155435 - connected negotiated REMB from sdp into VideoConduit, r=drno, r=jesup MozReview-Commit-ID: 7B2V4JoltOx
media/webrtc/signaling/src/jsep/JsepCodecDescription.h
media/webrtc/signaling/src/media-conduit/CodecConfig.h
media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.cpp
--- a/media/webrtc/signaling/src/jsep/JsepCodecDescription.h
+++ b/media/webrtc/signaling/src/jsep/JsepCodecDescription.h
@@ -626,16 +626,27 @@ class JsepVideoCodecDescription : public
           GetSubprofile(mProfileLevelId)) {
         return false;
       }
     }
 
     return true;
   }
 
+  virtual bool
+  RtcpFbRembIsSet() const
+  {
+    for (const auto& fb : mOtherFbTypes) {
+      if (fb.type == SdpRtcpFbAttributeList::kRemb) {
+        return true;
+      }
+    }
+    return false;
+  }
+
   JSEP_CODEC_CLONE(JsepVideoCodecDescription)
 
   std::vector<std::string> mAckFbTypes;
   std::vector<std::string> mNackFbTypes;
   std::vector<std::string> mCcmFbTypes;
   std::vector<SdpRtcpFbAttributeList::Feedback> mOtherFbTypes;
   bool mTmmbrEnabled;
   bool mRembEnabled;
--- a/media/webrtc/signaling/src/media-conduit/CodecConfig.h
+++ b/media/webrtc/signaling/src/media-conduit/CodecConfig.h
@@ -75,16 +75,19 @@ public:
    * corresponding webrtc::VideoCodec data-types.
    */
   int mType; // payload type
   std::string mName;
 
   std::vector<std::string> mAckFbTypes;
   std::vector<std::string> mNackFbTypes;
   std::vector<std::string> mCcmFbTypes;
+  // Don't pass mOtherFbTypes from JsepVideoCodecDescription because we'd have
+  // to drag SdpRtcpFbAttributeList::Feedback along too.
+  bool mRembFbSet;
 
   EncodingConstraints mEncodingConstraints;
   struct SimulcastEncoding {
     std::string rid;
     EncodingConstraints constraints;
   };
   std::vector<SimulcastEncoding> mSimulcastEncodings;
   std::string mSpropParameterSets;
@@ -141,11 +144,14 @@ public:
   {
     for (auto i = mCcmFbTypes.begin(); i != mCcmFbTypes.end(); ++i) {
       if (*i == type) {
         return true;
       }
     }
     return false;
   }
+
+  bool RtcpFbRembIsSet() const { return mRembFbSet; }
+
 };
 }
 #endif
--- a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
+++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
@@ -785,16 +785,17 @@ WebrtcVideoConduit::ConfigureRecvMediaCo
   {
     CSFLogError(logTag, "%s Zero number of codecs to configure", __FUNCTION__);
     return kMediaConduitMalformedArgument;
   }
 
   webrtc::ViEKeyFrameRequestMethod kf_request = webrtc::kViEKeyFrameRequestNone;
   bool use_nack_basic = false;
   bool use_tmmbr = false;
+  bool use_remb = false;
 
   //Try Applying the codecs in the list
   // we treat as success if atleast one codec was applied and reception was
   // started successfully.
   for(std::vector<VideoCodecConfig*>::size_type i=0;i < codecConfigList.size();i++)
   {
     //if the codec param is invalid or diplicate, return error
     if((condError = ValidateCodecConfig(codecConfigList[i],false)) != kMediaConduitNoError)
@@ -819,16 +820,21 @@ WebrtcVideoConduit::ConfigureRecvMediaCo
       use_nack_basic = true;
     }
 
     // Check whether TMMBR is requested
     if (codecConfigList[i]->RtcpFbCcmIsSet("tmmbr")) {
       use_tmmbr = true;
     }
 
+    // Check whether REMB is requested
+    if (codecConfigList[i]->RtcpFbRembIsSet()) {
+      use_remb = true;
+    }
+
     webrtc::VideoCodec  video_codec;
 
     memset(&video_codec, 0, sizeof(webrtc::VideoCodec));
 
     if (mExternalRecvCodec &&
         codecConfigList[i]->mType == mExternalRecvCodec->mType) {
       CSFLogError(logTag, "%s Configuring External H264 Receive Codec", __FUNCTION__);
 
@@ -967,17 +973,19 @@ WebrtcVideoConduit::ConfigureRecvMediaCo
   mUsingTmmbr = use_tmmbr;
 
   condError = StartReceiving();
   if (condError != kMediaConduitNoError) {
     return condError;
   }
 
   // by now we should be successfully started the reception
-  mPtrRTP->SetRembStatus(mChannel, false, true);
+  CSFLogDebug(logTag, "REMB enabled for video stream %s",
+              (use_remb ? "yes" : "no"));
+  mPtrRTP->SetRembStatus(mChannel, use_remb, true);
   DumpCodecDB();
   return kMediaConduitNoError;
 }
 
 template<typename T>
 T MinIgnoreZero(const T& a, const T& b)
 {
   return std::min(a? a:b, b? b:a);
--- a/media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.cpp
+++ b/media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.cpp
@@ -142,16 +142,17 @@ JsepCodecDescToCodecConfig(const JsepCod
 
   VideoCodecConfig* configRaw;
   configRaw = new VideoCodecConfig(
       pt, desc.mName, desc.mConstraints, h264Config.get());
 
   configRaw->mAckFbTypes = desc.mAckFbTypes;
   configRaw->mNackFbTypes = desc.mNackFbTypes;
   configRaw->mCcmFbTypes = desc.mCcmFbTypes;
+  configRaw->mRembFbSet = desc.RtcpFbRembIsSet();
 
   *aConfig = configRaw;
   return NS_OK;
 }
 
 static nsresult
 NegotiatedDetailsToVideoCodecConfigs(const JsepTrackNegotiatedDetails& aDetails,
                                      PtrVector<VideoCodecConfig>* aConfigs)