Protected streams report RTP messages directly to the FlexFec streams

In preparation of making RTP packet demuxing many-to-one (one SSRC goes to one sink, but one sink may have multiple SSRCs), we need to remove FlexFEC's dependence on being able to register itself with the demuxer. Instead, we register FlexFEC streams with the streams they protect; when those streams get packets, they'll forward them to their associated FlexFEC streams, too.

BUG=webrtc:7135

Review-Url: https://codereview.webrtc.org/2974453002
Cr-Commit-Position: refs/heads/master@{#19219}
diff --git a/webrtc/test/call_test.cc b/webrtc/test/call_test.cc
index 893d7e0..6e04fd6 100644
--- a/webrtc/test/call_test.cc
+++ b/webrtc/test/call_test.cc
@@ -336,6 +336,8 @@
     video_receive_streams_.push_back(receiver_call_->CreateVideoReceiveStream(
         video_receive_configs_[i].Copy()));
   }
+
+  AssociateFlexfecStreamsWithVideoStreams();
 }
 
 void CallTest::SetFakeVideoCaptureRotation(VideoRotation rotation) {
@@ -356,9 +358,30 @@
         receiver_call_->CreateFlexfecReceiveStream(
             flexfec_receive_configs_[i]));
   }
+
+  AssociateFlexfecStreamsWithVideoStreams();
+}
+
+void CallTest::AssociateFlexfecStreamsWithVideoStreams() {
+  // All FlexFEC streams protect all of the video streams.
+  for (FlexfecReceiveStream* flexfec_recv_stream : flexfec_receive_streams_) {
+    for (VideoReceiveStream* video_recv_stream : video_receive_streams_) {
+      video_recv_stream->AddSecondarySink(flexfec_recv_stream);
+    }
+  }
+}
+
+void CallTest::DissociateFlexfecStreamsFromVideoStreams() {
+  for (FlexfecReceiveStream* flexfec_recv_stream : flexfec_receive_streams_) {
+    for (VideoReceiveStream* video_recv_stream : video_receive_streams_) {
+      video_recv_stream->RemoveSecondarySink(flexfec_recv_stream);
+    }
+  }
 }
 
 void CallTest::DestroyStreams() {
+  DissociateFlexfecStreamsFromVideoStreams();
+
   if (audio_send_stream_)
     sender_call_->DestroyAudioSendStream(audio_send_stream_);
   audio_send_stream_ = nullptr;