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}
This commit is contained in:
Sebastian Jansson 2019-06-27 15:59:03 +02:00 committed by Commit Bot
parent 2efae7786e
commit 49167de0be
9 changed files with 39 additions and 8 deletions

View File

@ -84,6 +84,8 @@ class NetworkControllerInterface {
// 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

View File

@ -503,6 +503,11 @@ NetworkControlUpdate BbrNetworkController::OnReceivedPacket(
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());

View File

@ -165,6 +165,8 @@ class BbrNetworkController : public NetworkControllerInterface {
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;

View File

@ -253,10 +253,9 @@ NetworkControlUpdate GoogCcNetworkController::OnSentPacket(
}
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 @@ NetworkControlUpdate GoogCcNetworkController::OnTransportPacketsFeedback(
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 @@ NetworkControlUpdate GoogCcNetworkController::OnTransportPacketsFeedback(
return update;
}
NetworkControlUpdate GoogCcNetworkController::OnNetworkStateEstimate(
NetworkStateEstimate msg) {
estimate_ = msg;
return NetworkControlUpdate();
}
NetworkControlUpdate GoogCcNetworkController::GetNetworkState(
Timestamp at_time) const {
DataRate bandwidth = use_stable_bandwidth_estimate_

View File

@ -64,6 +64,8 @@ class GoogCcNetworkController : public NetworkControllerInterface {
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 @@ class GoogCcNetworkController : public NetworkControllerInterface {
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;

View File

@ -381,5 +381,10 @@ NetworkControlUpdate PccNetworkController::OnReceivedPacket(
return NetworkControlUpdate();
}
NetworkControlUpdate PccNetworkController::OnNetworkStateEstimate(
NetworkStateEstimate msg) {
return NetworkControlUpdate();
}
} // namespace pcc
} // namespace webrtc

View File

@ -78,6 +78,8 @@ class PccNetworkController : public NetworkControllerInterface {
NetworkControlUpdate OnRoundTripTimeUpdate(RoundTripTimeUpdate msg) override;
NetworkControlUpdate OnTransportLossReport(TransportLossReport msg) override;
NetworkControlUpdate OnReceivedPacket(ReceivedPacket msg) override;
NetworkControlUpdate OnNetworkStateEstimate(
NetworkStateEstimate msg) override;
private:
void UpdateSendingRateAndMode();

View File

@ -132,6 +132,11 @@ NetworkControlUpdate NetworkControleUpdateCache::OnTransportPacketsFeedback(
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_;
}

View File

@ -52,6 +52,8 @@ class NetworkControleUpdateCache : public NetworkControllerInterface {
NetworkControlUpdate OnTransportLossReport(TransportLossReport msg) override;
NetworkControlUpdate OnTransportPacketsFeedback(
TransportPacketsFeedback msg) override;
NetworkControlUpdate OnNetworkStateEstimate(
NetworkStateEstimate msg) override;
NetworkControlUpdate update_state() const;