Bug 1341995 - Make ULPFEC and RED payload types configurable in VideoCodecConfig; r=jesup
authorDan Minor <dminor@mozilla.com>
Fri, 24 Feb 2017 13:45:07 -0500
changeset 374415 706398e37dbba13604d924820340e9ecb37b20b1
parent 374414 47ae8eb50ef42d3d67d7b6420ae4bd5728af2d69
child 374416 47c6c4caad99d65ff37e5494e253fd7d408d617b
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
bugs1341995
milestone54.0a1
Bug 1341995 - Make ULPFEC and RED payload types configurable in VideoCodecConfig; r=jesup MozReview-Commit-ID: 74ncVSIYWzS
media/webrtc/signaling/src/media-conduit/CodecConfig.h
media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
--- a/media/webrtc/signaling/src/media-conduit/CodecConfig.h
+++ b/media/webrtc/signaling/src/media-conduit/CodecConfig.h
@@ -85,16 +85,20 @@ public:
   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;
   bool mFECFbSet;
 
+  int mULPFECPayloadType;
+  int mREDPayloadType;
+  int mREDRTXPayloadType;
+
   uint32_t mTias;
   EncodingConstraints mEncodingConstraints;
   struct SimulcastEncoding {
     std::string rid;
     EncodingConstraints constraints;
     bool operator==(const SimulcastEncoding& aOther) const {
       return rid == aOther.rid &&
         constraints == aOther.constraints;
@@ -111,16 +115,19 @@ public:
   bool operator==(const VideoCodecConfig& aRhs) const {
     if (mType != aRhs.mType ||
         mName != aRhs.mName ||
         mAckFbTypes != aRhs.mAckFbTypes ||
         mNackFbTypes != aRhs.mNackFbTypes ||
         mCcmFbTypes != aRhs.mCcmFbTypes ||
         mRembFbSet != aRhs.mRembFbSet ||
         mFECFbSet != aRhs.mFECFbSet ||
+        mULPFECPayloadType != aRhs.mULPFECPayloadType ||
+        mREDPayloadType != aRhs.mREDPayloadType ||
+        mREDRTXPayloadType != aRhs.mREDRTXPayloadType ||
         mTias != aRhs.mTias ||
         !(mEncodingConstraints == aRhs.mEncodingConstraints) ||
         !(mSimulcastEncodings == aRhs.mSimulcastEncodings) ||
         mSpropParameterSets != aRhs.mSpropParameterSets ||
         mProfile != aRhs.mProfile ||
         mConstraints != aRhs.mConstraints ||
         mLevel != aRhs.mLevel ||
         mPacketizationMode != aRhs.mPacketizationMode) {
@@ -132,16 +139,19 @@ public:
 
   VideoCodecConfig(int type,
                    std::string name,
                    const EncodingConstraints& constraints,
                    const struct VideoCodecConfigH264 *h264 = nullptr) :
     mType(type),
     mName(name),
     mFECFbSet(false),
+    mULPFECPayloadType(123),
+    mREDPayloadType(122),
+    mREDRTXPayloadType(-1),
     mTias(0),
     mEncodingConstraints(constraints),
     mProfile(0x42),
     mConstraints(0xE0),
     mLevel(0x0C),
     mPacketizationMode(1)
   {
     if (h264) {
--- a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
+++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
@@ -57,18 +57,16 @@
 
 #define DEFAULT_VIDEO_MAX_FRAMERATE 30
 #define INVALID_RTP_PAYLOAD 255 // valid payload types are 0 to 127
 
 namespace mozilla {
 
 static const char* logTag = "WebrtcVideoSessionConduit";
 
-static const int kUlpFecPayloadType = 123;
-static const int kRedPayloadType = 122;
 static const int kNullPayloadType = -1;
 static const char* kUlpFecPayloadName = "ulpfec";
 static const char* kRedPayloadName = "red";
 
 // Convert (SI) kilobits/sec to (SI) bits/sec
 #define KBPS(kbps) kbps * 1000
 const uint32_t WebrtcVideoConduit::kDefaultMinBitrate_bps =  KBPS(200);
 const uint32_t WebrtcVideoConduit::kDefaultStartBitrate_bps = KBPS(300);
@@ -658,19 +656,19 @@ WebrtcVideoConduit::ConfigureSendMediaCo
   mSendStreamConfig.encoder_settings.payload_type = codecConfig->mType;
   mSendStreamConfig.rtp.rtcp_mode = webrtc::RtcpMode::kCompound;
   mSendStreamConfig.rtp.max_packet_size = kVideoMtu;
   mSendStreamConfig.overuse_callback = mLoadManager.get();
 
   // See Bug 1297058, enabling FEC when basic NACK is to be enabled in H.264 is problematic
   if (codecConfig->RtcpFbFECIsSet() &&
       !(codecConfig->mName == "H264" && codecConfig->RtcpFbNackIsSet(""))) {
-    mSendStreamConfig.rtp.fec.ulpfec_payload_type = kUlpFecPayloadType;
-    mSendStreamConfig.rtp.fec.red_payload_type = kRedPayloadType;
-    mSendStreamConfig.rtp.fec.red_rtx_payload_type = kNullPayloadType;
+    mSendStreamConfig.rtp.fec.ulpfec_payload_type = codecConfig->mULPFECPayloadType;
+    mSendStreamConfig.rtp.fec.red_payload_type = codecConfig->mREDPayloadType;
+    mSendStreamConfig.rtp.fec.red_rtx_payload_type = codecConfig->mREDRTXPayloadType;
   }
 
   mSendStreamConfig.rtp.nack.rtp_history_ms =
     codecConfig->RtcpFbNackIsSet("") ? 1000 : 0;
 
   {
     MutexAutoLock lock(mCodecMutex);
     // Copy the applied config for future reference.