Adds interface for remote network estimates to NetworkControllerInterface.
Bug: webrtc:10742
Change-Id: I593fc17ce5d42c5dc17fd289f0621230319f9752
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/144039
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28405}
diff --git a/api/transport/network_control.h b/api/transport/network_control.h
index 9c60ccb..11cda46 100644
--- a/api/transport/network_control.h
+++ b/api/transport/network_control.h
@@ -84,6 +84,8 @@
// Called with per packet feedback regarding receive time.
virtual NetworkControlUpdate OnTransportPacketsFeedback(
TransportPacketsFeedback) = 0;
+ // Called with network state estimate updates.
+ virtual NetworkControlUpdate OnNetworkStateEstimate(NetworkStateEstimate) = 0;
};
// NetworkControllerFactoryInterface is an interface for creating a network
diff --git a/modules/congestion_controller/bbr/bbr_network_controller.cc b/modules/congestion_controller/bbr/bbr_network_controller.cc
index 2e395e9..c64152c 100644
--- a/modules/congestion_controller/bbr/bbr_network_controller.cc
+++ b/modules/congestion_controller/bbr/bbr_network_controller.cc
@@ -503,6 +503,11 @@
return NetworkControlUpdate();
}
+NetworkControlUpdate BbrNetworkController::OnNetworkStateEstimate(
+ NetworkStateEstimate msg) {
+ return NetworkControlUpdate();
+}
+
TimeDelta BbrNetworkController::GetMinRtt() const {
return !min_rtt_.IsZero() ? min_rtt_
: TimeDelta::us(rtt_stats_.initial_rtt_us());
diff --git a/modules/congestion_controller/bbr/bbr_network_controller.h b/modules/congestion_controller/bbr/bbr_network_controller.h
index 8598cad..e99452a 100644
--- a/modules/congestion_controller/bbr/bbr_network_controller.h
+++ b/modules/congestion_controller/bbr/bbr_network_controller.h
@@ -165,6 +165,8 @@
NetworkControlUpdate OnRoundTripTimeUpdate(RoundTripTimeUpdate msg) override;
NetworkControlUpdate OnTransportLossReport(TransportLossReport msg) override;
NetworkControlUpdate OnReceivedPacket(ReceivedPacket msg) override;
+ NetworkControlUpdate OnNetworkStateEstimate(
+ NetworkStateEstimate msg) override;
NetworkControlUpdate CreateRateUpdate(Timestamp at_time) const;
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 8bd3cfb..ddc5ca3 100644
--- a/modules/congestion_controller/goog_cc/goog_cc_network_control.cc
+++ b/modules/congestion_controller/goog_cc/goog_cc_network_control.cc
@@ -253,10 +253,9 @@
}
bandwidth_estimation_->OnSentPacket(sent_packet);
bool network_changed = false;
- if (network_estimator_ && overuse_predictor_.Enabled()) {
+ if (overuse_predictor_.Enabled()) {
overuse_predictor_.OnSentPacket(sent_packet);
- auto estimate = network_estimator_->GetCurrentEstimate();
- if (estimate && overuse_predictor_.PredictOveruse(*estimate)) {
+ if (estimate_ && overuse_predictor_.PredictOveruse(*estimate_)) {
DataRate new_target = delay_based_bwe_->TriggerOveruse(
sent_packet.send_time, acknowledged_bitrate_estimator_->bitrate());
bandwidth_estimation_->UpdateDelayBasedEstimate(sent_packet.send_time,
@@ -510,19 +509,18 @@
report.feedback_time);
bandwidth_estimation_->IncomingPacketFeedbackVector(report);
- if (network_estimator_)
+ if (network_estimator_) {
network_estimator_->OnTransportPacketsFeedback(report);
+ estimate_ = network_estimator_->GetCurrentEstimate();
+ }
NetworkControlUpdate update;
bool recovered_from_overuse = false;
bool backoff_in_alr = false;
DelayBasedBwe::Result result;
- absl::optional<NetworkStateEstimate> network_estimate =
- network_estimator_ ? network_estimator_->GetCurrentEstimate()
- : absl::nullopt;
result = delay_based_bwe_->IncomingPacketFeedbackVector(
- report, acknowledged_bitrate, probe_bitrate, network_estimate,
+ report, acknowledged_bitrate, probe_bitrate, estimate_,
alr_start_time.has_value());
if (result.updated) {
@@ -568,6 +566,12 @@
return update;
}
+NetworkControlUpdate GoogCcNetworkController::OnNetworkStateEstimate(
+ NetworkStateEstimate msg) {
+ estimate_ = msg;
+ return NetworkControlUpdate();
+}
+
NetworkControlUpdate GoogCcNetworkController::GetNetworkState(
Timestamp at_time) const {
DataRate bandwidth = use_stable_bandwidth_estimate_
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 ef75d7a..5b24d14 100644
--- a/modules/congestion_controller/goog_cc/goog_cc_network_control.h
+++ b/modules/congestion_controller/goog_cc/goog_cc_network_control.h
@@ -64,6 +64,8 @@
NetworkControlUpdate OnTransportLossReport(TransportLossReport msg) override;
NetworkControlUpdate OnTransportPacketsFeedback(
TransportPacketsFeedback msg) override;
+ NetworkControlUpdate OnNetworkStateEstimate(
+ NetworkStateEstimate msg) override;
NetworkControlUpdate GetNetworkState(Timestamp at_time) const;
@@ -110,6 +112,8 @@
bool first_packet_sent_ = false;
+ absl::optional<NetworkStateEstimate> estimate_;
+
Timestamp next_loss_update_ = Timestamp::MinusInfinity();
int lost_packets_since_last_loss_update_ = 0;
int expected_packets_since_last_loss_update_ = 0;
diff --git a/modules/congestion_controller/pcc/pcc_network_controller.cc b/modules/congestion_controller/pcc/pcc_network_controller.cc
index a284710..c6fac49 100644
--- a/modules/congestion_controller/pcc/pcc_network_controller.cc
+++ b/modules/congestion_controller/pcc/pcc_network_controller.cc
@@ -381,5 +381,10 @@
return NetworkControlUpdate();
}
+NetworkControlUpdate PccNetworkController::OnNetworkStateEstimate(
+ NetworkStateEstimate msg) {
+ return NetworkControlUpdate();
+}
+
} // namespace pcc
} // namespace webrtc
diff --git a/modules/congestion_controller/pcc/pcc_network_controller.h b/modules/congestion_controller/pcc/pcc_network_controller.h
index befabbf..c70684a 100644
--- a/modules/congestion_controller/pcc/pcc_network_controller.h
+++ b/modules/congestion_controller/pcc/pcc_network_controller.h
@@ -78,6 +78,8 @@
NetworkControlUpdate OnRoundTripTimeUpdate(RoundTripTimeUpdate msg) override;
NetworkControlUpdate OnTransportLossReport(TransportLossReport msg) override;
NetworkControlUpdate OnReceivedPacket(ReceivedPacket msg) override;
+ NetworkControlUpdate OnNetworkStateEstimate(
+ NetworkStateEstimate msg) override;
private:
void UpdateSendingRateAndMode();
diff --git a/test/scenario/call_client.cc b/test/scenario/call_client.cc
index fe77e7a..f366997 100644
--- a/test/scenario/call_client.cc
+++ b/test/scenario/call_client.cc
@@ -132,6 +132,11 @@
TransportPacketsFeedback msg) {
return Update(controller_->OnTransportPacketsFeedback(msg));
}
+NetworkControlUpdate NetworkControleUpdateCache::OnNetworkStateEstimate(
+ NetworkStateEstimate msg) {
+ return Update(controller_->OnNetworkStateEstimate(msg));
+}
+
NetworkControlUpdate NetworkControleUpdateCache::update_state() const {
return update_state_;
}
diff --git a/test/scenario/call_client.h b/test/scenario/call_client.h
index 37efad6..e863e60 100644
--- a/test/scenario/call_client.h
+++ b/test/scenario/call_client.h
@@ -52,6 +52,8 @@
NetworkControlUpdate OnTransportLossReport(TransportLossReport msg) override;
NetworkControlUpdate OnTransportPacketsFeedback(
TransportPacketsFeedback msg) override;
+ NetworkControlUpdate OnNetworkStateEstimate(
+ NetworkStateEstimate msg) override;
NetworkControlUpdate update_state() const;