New api function CreateVideoStreamEncoder.

Bug: webrtc:8830
Change-Id: I01de86f601e48f76e6b41b4182ce006d397a190c
Reviewed-on: https://webrtc-review.googlesource.com/78260
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24079}
diff --git a/video/video_stream_encoder.h b/video/video_stream_encoder.h
index e9558ba..8d228a4 100644
--- a/video/video_stream_encoder.h
+++ b/video/video_stream_encoder.h
@@ -21,23 +21,19 @@
 #include "api/video/video_rotation.h"
 #include "api/video/video_sink_interface.h"
 #include "api/video/video_stream_encoder_interface.h"
+#include "api/video/video_stream_encoder_observer.h"
+#include "api/video/video_stream_encoder_settings.h"
 #include "api/video_codecs/video_encoder.h"
-#include "call/video_send_stream.h"
-#include "common_types.h"  // NOLINT(build/include)
-#include "modules/video_coding/include/video_coding_defines.h"
 #include "modules/video_coding/utility/quality_scaler.h"
 #include "modules/video_coding/video_coding_impl.h"
 #include "rtc_base/criticalsection.h"
 #include "rtc_base/event.h"
 #include "rtc_base/sequenced_task_checker.h"
 #include "rtc_base/task_queue.h"
-#include "typedefs.h"  // NOLINT(build/include)
 #include "video/overuse_frame_detector.h"
 
 namespace webrtc {
 
-class SendStatisticsProxy;
-
 // VideoStreamEncoder represent a video encoder that accepts raw video frames as
 // input and produces an encoded bit stream.
 // Usage:
@@ -51,15 +47,9 @@
                            // Protected only to provide access to tests.
                            protected AdaptationObserverInterface {
  public:
-  // Number of resolution and framerate reductions (-1: disabled).
-  struct AdaptCounts {
-    int resolution = 0;
-    int fps = 0;
-  };
-
   VideoStreamEncoder(uint32_t number_of_cores,
-                     SendStatisticsProxy* stats_proxy,
-                     const VideoSendStream::Config::EncoderSettings& settings,
+                     VideoStreamEncoderObserver* encoder_stats_observer,
+                     const VideoStreamEncoderSettings& settings,
                      rtc::VideoSinkInterface<VideoFrame>* pre_encode_callback,
                      std::unique_ptr<OveruseFrameDetector> overuse_detector);
   ~VideoStreamEncoder() override;
@@ -149,7 +139,7 @@
     ~AdaptCounter();
 
     // Get number of adaptation downscales for |reason|.
-    AdaptCounts Counts(int reason) const;
+    VideoStreamEncoderObserver::AdaptationSteps Counts(int reason) const;
 
     std::string ToString() const;
 
@@ -182,7 +172,8 @@
   AdaptCounter& GetAdaptCounter() RTC_RUN_ON(&encoder_queue_);
   const AdaptCounter& GetConstAdaptCounter() RTC_RUN_ON(&encoder_queue_);
   void UpdateAdaptationStats(AdaptReason reason) RTC_RUN_ON(&encoder_queue_);
-  AdaptCounts GetActiveCounts(AdaptReason reason) RTC_RUN_ON(&encoder_queue_);
+  VideoStreamEncoderObserver::AdaptationSteps GetActiveCounts(
+      AdaptReason reason) RTC_RUN_ON(&encoder_queue_);
 
   rtc::Event shutdown_event_;
 
@@ -194,7 +185,7 @@
 
   const std::unique_ptr<VideoSourceProxy> source_proxy_;
   EncoderSink* sink_;
-  const VideoSendStream::Config::EncoderSettings settings_;
+  const VideoStreamEncoderSettings settings_;
 
   vcm::VideoSender video_sender_ RTC_GUARDED_BY(&encoder_queue_);
   const std::unique_ptr<OveruseFrameDetector> overuse_detector_
@@ -202,7 +193,7 @@
   std::unique_ptr<QualityScaler> quality_scaler_ RTC_GUARDED_BY(&encoder_queue_)
       RTC_PT_GUARDED_BY(&encoder_queue_);
 
-  SendStatisticsProxy* const stats_proxy_;
+  VideoStreamEncoderObserver* const encoder_stats_observer_;
   rtc::VideoSinkInterface<VideoFrame>* const pre_encode_callback_;
   // |thread_checker_| checks that public methods that are related to lifetime
   // of VideoStreamEncoder are called on the same thread.