Fix GoogCcNetworkController::OnNetworkStateEstimate behaviour

Ensure OnNetworkStateEstimate behaves the same way as internal networks state updates.
Also, ignore OnNetworkStateEstimate if an internal estimator exist.

Bug: webrtc:10742
Change-Id: I7967d202381250c406824fb2d0574bb95d2cd592
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/354102
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Reviewed-by: Diep Bui <diepbp@google.com>
Cr-Commit-Position: refs/heads/main@{#42456}
This commit is contained in:
Per K 2024-06-10 09:36:11 +00:00 committed by WebRTC LUCI CQ
parent 63c3809186
commit 41b934fe37
3 changed files with 17 additions and 13 deletions

View File

@ -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<RtcEventRemoteEstimate>(
estimate.link_capacity_lower, estimate.link_capacity_upper));
estimate.update_time = Timestamp::Millis(env_.clock().TimeInMilliseconds());
if (controller_)
PostUpdates(controller_->OnNetworkStateEstimate(estimate));

View File

@ -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<RtcEventRemoteEstimate>(
estimate_->link_capacity_lower, estimate_->link_capacity_upper));
probe_controller_->SetNetworkStateEstimate(*estimate_);
}
SetNetworkStateEstimate(network_estimator_->GetCurrentEstimate());
}
absl::optional<DataRate> 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<NetworkStateEstimate> 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<RtcEventRemoteEstimate>(
estimate_->link_capacity_lower, estimate_->link_capacity_upper));
probe_controller_->SetNetworkStateEstimate(*estimate_);
}
}
NetworkControlUpdate GoogCcNetworkController::GetNetworkState(
Timestamp at_time) const {
NetworkControlUpdate update;

View File

@ -83,6 +83,7 @@ class GoogCcNetworkController : public NetworkControllerInterface {
Timestamp at_time);
void UpdateCongestionWindowSize();
PacerConfig GetPacingRates(Timestamp at_time) const;
void SetNetworkStateEstimate(absl::optional<NetworkStateEstimate> estimate);
const Environment env_;
const bool packet_feedback_only_;