Bug 1341995 - Make ULPFEC and RED payload types configurable in VideoCodecConfig; r=jesup draft
authorDan Minor <dminor@mozilla.com>
Fri, 24 Feb 2017 13:45:07 -0500
changeset 490467 588ae3dc4a2475f683e248cb60cda7c3fa7e81de
parent 489193 be661bae6cb9a53935c5b87744bf68879d9ebcc5
child 490468 45acdf4d19a51cc82c56f0e1c302604609c97f28
push id47104
push userdminor@mozilla.com
push dateTue, 28 Feb 2017 14:02:00 +0000
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.