diff --git a/call/rtp_transport_controller_send.cc b/call/rtp_transport_controller_send.cc index f667417239..d22749692c 100644 --- a/call/rtp_transport_controller_send.cc +++ b/call/rtp_transport_controller_send.cc @@ -624,8 +624,6 @@ void RtpTransportControllerSend::OnTransportFeedback( void RtpTransportControllerSend::OnRemoteNetworkEstimate( NetworkStateEstimate estimate) { RTC_DCHECK_RUN_ON(&sequence_checker_); - env_.event_log().Log(std::make_unique( - estimate.link_capacity_lower, estimate.link_capacity_upper)); estimate.update_time = Timestamp::Millis(env_.clock().TimeInMilliseconds()); if (controller_) PostUpdates(controller_->OnNetworkStateEstimate(estimate)); 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 182e79358e..ddc4aa2a5f 100644 --- a/modules/congestion_controller/goog_cc/goog_cc_network_control.cc +++ b/modules/congestion_controller/goog_cc/goog_cc_network_control.cc @@ -517,16 +517,7 @@ NetworkControlUpdate GoogCcNetworkController::OnTransportPacketsFeedback( if (network_estimator_) { network_estimator_->OnTransportPacketsFeedback(report); - auto prev_estimate = estimate_; - estimate_ = network_estimator_->GetCurrentEstimate(); - // TODO(srte): Make OnTransportPacketsFeedback signal whether the state - // changed to avoid the need for this check. - if (estimate_ && (!prev_estimate || estimate_->last_feed_time != - prev_estimate->last_feed_time)) { - env_.event_log().Log(std::make_unique( - estimate_->link_capacity_lower, estimate_->link_capacity_upper)); - probe_controller_->SetNetworkStateEstimate(*estimate_); - } + SetNetworkStateEstimate(network_estimator_->GetCurrentEstimate()); } absl::optional probe_bitrate = probe_bitrate_estimator_->FetchAndResetLastEstimatedBitrate(); @@ -603,10 +594,24 @@ NetworkControlUpdate GoogCcNetworkController::OnTransportPacketsFeedback( NetworkControlUpdate GoogCcNetworkController::OnNetworkStateEstimate( NetworkStateEstimate msg) { - estimate_ = msg; + if (!network_estimator_) { + SetNetworkStateEstimate(msg); + } return NetworkControlUpdate(); } +void GoogCcNetworkController::SetNetworkStateEstimate( + absl::optional estimate) { + auto prev_estimate = estimate_; + estimate_ = estimate; + if (estimate_ && (!prev_estimate || + estimate_->update_time != prev_estimate->update_time)) { + env_.event_log().Log(std::make_unique( + estimate_->link_capacity_lower, estimate_->link_capacity_upper)); + probe_controller_->SetNetworkStateEstimate(*estimate_); + } +} + NetworkControlUpdate GoogCcNetworkController::GetNetworkState( Timestamp at_time) const { NetworkControlUpdate update; diff --git a/modules/congestion_controller/goog_cc/goog_cc_network_control.h b/modules/congestion_controller/goog_cc/goog_cc_network_control.h index f2210c953f..46ef23f432 100644 --- a/modules/congestion_controller/goog_cc/goog_cc_network_control.h +++ b/modules/congestion_controller/goog_cc/goog_cc_network_control.h @@ -83,6 +83,7 @@ class GoogCcNetworkController : public NetworkControllerInterface { Timestamp at_time); void UpdateCongestionWindowSize(); PacerConfig GetPacingRates(Timestamp at_time) const; + void SetNetworkStateEstimate(absl::optional estimate); const Environment env_; const bool packet_feedback_only_;