Adds logging of NetworkStateEstimator estimates.

Bug: webrtc:10498
Change-Id: I4c7e1a28c37066dbc11e8c60ab5d357b20e17119
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/156561
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29468}
diff --git a/modules/congestion_controller/goog_cc/BUILD.gn b/modules/congestion_controller/goog_cc/BUILD.gn
index 8e8d2ba..7454c97 100644
--- a/modules/congestion_controller/goog_cc/BUILD.gn
+++ b/modules/congestion_controller/goog_cc/BUILD.gn
@@ -41,6 +41,7 @@
     "../../../api/units:data_size",
     "../../../api/units:time_delta",
     "../../../api/units:timestamp",
+    "../../../logging:rtc_event_bwe",
     "../../../logging:rtc_event_pacing",
     "../../../rtc_base:checks",
     "../../../rtc_base:logging",
diff --git a/modules/congestion_controller/goog_cc/goog_cc_network_control.cc b/modules/congestion_controller/goog_cc/goog_cc_network_control.cc
index 52b20a1..621fd4c 100644
--- a/modules/congestion_controller/goog_cc/goog_cc_network_control.cc
+++ b/modules/congestion_controller/goog_cc/goog_cc_network_control.cc
@@ -22,6 +22,7 @@
 #include <vector>
 
 #include "api/units/time_delta.h"
+#include "logging/rtc_event_log/events/rtc_event_remote_estimate.h"
 #include "modules/congestion_controller/goog_cc/acknowledged_bitrate_estimator.h"
 #include "modules/congestion_controller/goog_cc/alr_detector.h"
 #include "modules/congestion_controller/goog_cc/probe_controller.h"
@@ -496,7 +497,15 @@
 
   if (network_estimator_) {
     network_estimator_->OnTransportPacketsFeedback(report);
+    auto prev_estimate = estimate_;
     estimate_ = network_estimator_->GetCurrentEstimate();
+    // TODO(srte): Make OnTransportPacketsFeedback signal wether the state
+    // changed to avoid the need for this check.
+    if (estimate_ && (!prev_estimate || estimate_->last_feed_time !=
+                                            prev_estimate->last_feed_time)) {
+      event_log_->Log(std::make_unique<RtcEventRemoteEstimate>(
+          estimate_->link_capacity_lower, estimate_->link_capacity_upper));
+    }
   }
 
   NetworkControlUpdate update;