[Adaptation] Adding adaptation resources from Call.

This CL adds AddAdaptationResource to Call and
AddAdaptationResource/GetAdaptationResources method to relevant
VideoSendStream and VideoStreamEncoder interfaces and implementations.

Unittests are added to ensure that resources can be added to the Call
both before and after the creation of a VideoSendStream and that the
resources always gets added to the streams.

In a follow-up CL, we will continue to plumb the resources all the way
to PeerConnectionInterface, and an integration test will then be added
to ensure that injected resources are capable of triggering adaptation.

Bug: webrtc:11525
Change-Id: I499e9c23c3e359df943414d420b2e0ce2e9b2d56
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/177002
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Evan Shrubsole <eshr@google.com>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31499}
diff --git a/api/video/BUILD.gn b/api/video/BUILD.gn
index 6b548a0..1f145b7 100644
--- a/api/video/BUILD.gn
+++ b/api/video/BUILD.gn
@@ -259,8 +259,10 @@
     ":video_codec_constants",
     ":video_frame",
     "..:rtp_parameters",
+    "..:scoped_refptr",
     "../:fec_controller_api",
     "../:rtp_parameters",
+    "../adaptation:resource_adaptation_api",
     "../units:data_rate",
     "../video_codecs:video_codecs_api",
   ]
diff --git a/api/video/video_stream_encoder_interface.h b/api/video/video_stream_encoder_interface.h
index 8e1df0f..d8dd8e1 100644
--- a/api/video/video_stream_encoder_interface.h
+++ b/api/video/video_stream_encoder_interface.h
@@ -13,8 +13,10 @@
 
 #include <vector>
 
+#include "api/adaptation/resource.h"
 #include "api/fec_controller_override.h"
 #include "api/rtp_parameters.h"  // For DegradationPreference.
+#include "api/scoped_refptr.h"
 #include "api/units/data_rate.h"
 #include "api/video/video_bitrate_allocator.h"
 #include "api/video/video_sink_interface.h"
@@ -49,6 +51,15 @@
         int min_transmit_bitrate_bps) = 0;
   };
 
+  // If the resource is overusing, the VideoStreamEncoder will try to reduce
+  // resolution or frame rate until no resource is overusing.
+  // TODO(https://crbug.com/webrtc/11565): When the ResourceAdaptationProcessor
+  // is moved to Call this method could be deleted altogether in favor of
+  // Call-level APIs only.
+  virtual void AddAdaptationResource(rtc::scoped_refptr<Resource> resource) = 0;
+  virtual std::vector<rtc::scoped_refptr<Resource>>
+  GetAdaptationResources() = 0;
+
   // Sets the source that will provide video frames to the VideoStreamEncoder's
   // OnFrame method. |degradation_preference| control whether or not resolution
   // or frame rate may be reduced. The VideoStreamEncoder registers itself with