Remove 'secondary sink' concept from webrtc::VideoReceiveStream.

In practice, support for multiple sinks is not needed and supporting
the API that allows for dynamically adding/removing sinks at runtime,
adds to the complexity of the implementation.

This CL removes that Add/Remove methods for secondary sinks as well
as vectors of callback pointers (which were either of size 0 or 1).
Instead, an optional callback pointer is added to the config struct
for VideoReceiveStream, that an implementation can consider to be
const and there's not a need to do thread synchronization for that
pointer for every network packet.

As part of webrtc:11993, this simplifies the work towards keeping
the processing of network packets on the network thread. The secondary
sinks, currently operate on the worker thread.

Bug: webrtc:11993
Change-Id: I10c473e57d3809527a1b689f4352e903a4c78168
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/207421
Commit-Queue: Tommi <tommi@webrtc.org>
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33272}
diff --git a/test/call_test.cc b/test/call_test.cc
index dd7c576..0ba947c 100644
--- a/test/call_test.cc
+++ b/test/call_test.cc
@@ -447,8 +447,10 @@
   config.remote_ssrc = send_config.rtp.flexfec.ssrc;
   config.protected_media_ssrcs = send_config.rtp.flexfec.protected_media_ssrcs;
   config.local_ssrc = kReceiverLocalVideoSsrc;
-  if (!video_receive_configs_.empty())
+  if (!video_receive_configs_.empty()) {
     video_receive_configs_[0].rtp.protected_by_flexfec = true;
+    video_receive_configs_[0].rtp.packet_sink_ = this;
+  }
   flexfec_receive_configs_.push_back(config);
 }
 
@@ -510,8 +512,6 @@
     video_receive_streams_.push_back(receiver_call_->CreateVideoReceiveStream(
         video_receive_configs_[i].Copy()));
   }
-
-  AssociateFlexfecStreamsWithVideoStreams();
 }
 
 void CallTest::CreateVideoSendStreams() {
@@ -572,8 +572,6 @@
         receiver_call_->CreateFlexfecReceiveStream(
             flexfec_receive_configs_[i]));
   }
-
-  AssociateFlexfecStreamsWithVideoStreams();
 }
 
 void CallTest::ConnectVideoSourcesToStreams() {
@@ -582,23 +580,6 @@
                                       degradation_preference_);
 }
 
-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::Start() {
   StartVideoStreams();
   if (audio_send_stream_) {
@@ -632,8 +613,6 @@
 }
 
 void CallTest::DestroyStreams() {
-  DissociateFlexfecStreamsFromVideoStreams();
-
   if (audio_send_stream_)
     sender_call_->DestroyAudioSendStream(audio_send_stream_);
   audio_send_stream_ = nullptr;
@@ -691,6 +670,12 @@
   return &flexfec_receive_configs_[0];
 }
 
+void CallTest::OnRtpPacket(const RtpPacketReceived& packet) {
+  // All FlexFEC streams protect all of the video streams.
+  for (FlexfecReceiveStream* flexfec_recv_stream : flexfec_receive_streams_)
+    flexfec_recv_stream->OnRtpPacket(packet);
+}
+
 absl::optional<RtpExtension> CallTest::GetRtpExtensionByUri(
     const std::string& uri) const {
   for (const auto& extension : rtp_extensions_) {