Enable FEC for VideoSendStream.

Test only checks for FEC without NACK. Test for FEC with NACK postponed
until later.

BUG=2230
R=stefan@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/2246004

git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@4802 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/video_engine/internal/video_send_stream.cc b/video_engine/internal/video_send_stream.cc
index 799cec7..34cafc8 100644
--- a/video_engine/internal/video_send_stream.cc
+++ b/video_engine/internal/video_send_stream.cc
@@ -103,7 +103,6 @@
                               kViEStreamTypeNormal, i);
     }
   }
-  rtp_rtcp_->SetNACKStatus(channel_, config_.rtp.nack.rtp_history_ms > 0);
   rtp_rtcp_->SetTransmissionSmoothingStatus(channel_, config_.pacing);
   if (!config_.rtp.rtx.ssrcs.empty()) {
     assert(config_.rtp.rtx.ssrcs.size() == config_.rtp.ssrcs.size());
@@ -132,6 +131,26 @@
     }
   }
 
+  // Enable NACK, FEC or both.
+  if (config_.rtp.fec.red_payload_type != -1) {
+    assert(config_.rtp.fec.ulpfec_payload_type != -1);
+    if (config_.rtp.nack.rtp_history_ms > 0) {
+      rtp_rtcp_->SetHybridNACKFECStatus(
+          channel_,
+          true,
+          static_cast<unsigned char>(config_.rtp.fec.red_payload_type),
+          static_cast<unsigned char>(config_.rtp.fec.ulpfec_payload_type));
+    } else {
+      rtp_rtcp_->SetFECStatus(
+          channel_,
+          true,
+          static_cast<unsigned char>(config_.rtp.fec.red_payload_type),
+          static_cast<unsigned char>(config_.rtp.fec.ulpfec_payload_type));
+    }
+  } else {
+    rtp_rtcp_->SetNACKStatus(channel_, config_.rtp.nack.rtp_history_ms > 0);
+  }
+
   char rtcp_cname[ViERTP_RTCP::KMaxRTCPCNameLength];
   assert(config_.rtp.c_name.length() < ViERTP_RTCP::KMaxRTCPCNameLength);
   strncpy(rtcp_cname, config_.rtp.c_name.c_str(), sizeof(rtcp_cname) - 1);