Simplified throughput estimator

Add interface for AcknowledgedBitrateEstimator
Add simplified throughput estimator, implementing the same interface.
The choice of estimator implementation can be controlled by a field trial.

Bug: webrtc:10274
Change-Id: I6bef090a8a6a1783f3f5750a2ee56189f562a9c8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/158892
Commit-Queue: Björn Terelius <terelius@webrtc.org>
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29761}
diff --git a/rtc_tools/rtc_event_log_visualizer/analyzer.cc b/rtc_tools/rtc_event_log_visualizer/analyzer.cc
index 106e8da..1ab7eb9 100644
--- a/rtc_tools/rtc_event_log_visualizer/analyzer.cc
+++ b/rtc_tools/rtc_event_log_visualizer/analyzer.cc
@@ -1269,14 +1269,14 @@
   FieldTrialBasedConfig field_trial_config_;
   // The event_log_visualizer should normally not be compiled with
   // BWE_TEST_LOGGING_COMPILE_TIME_ENABLE since the normal plots won't work.
-  // However, compiling with BWE_TEST_LOGGING, running with --plot_sendside_bwe
+  // However, compiling with BWE_TEST_LOGGING, running with --plot=sendside_bwe
   // and piping the output to plot_dynamics.py can be used as a hack to get the
   // internal state of various BWE components. In this case, it is important
   // we don't instantiate the AcknowledgedBitrateEstimator both here and in
   // GoogCcNetworkController since that would lead to duplicate outputs.
-  AcknowledgedBitrateEstimator acknowledged_bitrate_estimator(
-      &field_trial_config_,
-      std::make_unique<BitrateEstimator>(&field_trial_config_));
+  std::unique_ptr<AcknowledgedBitrateEstimatorInterface>
+      acknowledged_bitrate_estimator(
+          AcknowledgedBitrateEstimatorInterface::Create(&field_trial_config_));
 #endif  // !(BWE_TEST_LOGGING_COMPILE_TIME_ENABLE)
   int64_t time_us =
       std::min({NextRtpTime(), NextRtcpTime(), NextProcessTime()});
@@ -1321,7 +1321,8 @@
             feedback_msg->SortedByReceiveTime();
         if (!feedback.empty()) {
 #if !(BWE_TEST_LOGGING_COMPILE_TIME_ENABLE)
-          acknowledged_bitrate_estimator.IncomingPacketFeedbackVector(feedback);
+          acknowledged_bitrate_estimator->IncomingPacketFeedbackVector(
+              feedback);
 #endif  // !(BWE_TEST_LOGGING_COMPILE_TIME_ENABLE)
           for (const PacketResult& packet : feedback)
             acked_bitrate.Update(packet.sent_packet.size.bytes(),
@@ -1334,7 +1335,7 @@
       float y = bitrate_bps.value_or(0) / 1000;
       acked_time_series.points.emplace_back(x, y);
 #if !(BWE_TEST_LOGGING_COMPILE_TIME_ENABLE)
-      y = acknowledged_bitrate_estimator.bitrate()
+      y = acknowledged_bitrate_estimator->bitrate()
               .value_or(DataRate::Zero())
               .kbps();
       acked_estimate_time_series.points.emplace_back(x, y);