Glue code and tests for NACK in new VideoEngine API.

The test works by randomly dropping small bursts of packets until enough
NACKs have been sent back by the receiver. Retransmitted packets are
never dropped in order to assure that all packets are eventually
delivered. When enough NACK packets have been received and all dropped
packets retransmitted, the test waits for the receiving side to send a
number of RTCP packets without NACK lists to assure that the receiving
side stops sending NACKs once packets have been retransmitted.

BUG=2043
R=stefan@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@4482 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/video_engine/internal/video_send_stream.cc b/video_engine/internal/video_send_stream.cc
index b2401da..305d08f 100644
--- a/video_engine/internal/video_send_stream.cc
+++ b/video_engine/internal/video_send_stream.cc
@@ -94,6 +94,7 @@
 
   assert(config_.rtp.ssrcs.size() == 1);
   rtp_rtcp_->SetLocalSSRC(channel_, config_.rtp.ssrcs[0]);
+  rtp_rtcp_->SetNACKStatus(channel_, config_.rtp.nack.rtp_history_ms > 0);
 
   capture_ = ViECapture::GetInterface(video_engine);
   capture_->AllocateExternalCaptureDevice(capture_id_, external_capture_);
@@ -168,11 +169,15 @@
 void VideoSendStream::StartSend() {
   if (video_engine_base_->StartSend(channel_) != 0)
     abort();
+  if (video_engine_base_->StartReceive(channel_) != 0)
+    abort();
 }
 
 void VideoSendStream::StopSend() {
   if (video_engine_base_->StopSend(channel_) != 0)
     abort();
+  if (video_engine_base_->StopReceive(channel_) != 0)
+    abort();
 }
 
 bool VideoSendStream::SetTargetBitrate(
@@ -206,5 +211,10 @@
   return success ? 0 : -1;
 }
 
+bool VideoSendStream::DeliverRtcp(const uint8_t* packet, size_t length) {
+  return network_->ReceivedRTCPPacket(
+      channel_, packet, static_cast<int>(length));
+}
+
 }  // namespace internal
 }  // namespace webrtc