Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1366)

Unified Diff: net/quic/congestion_control/inter_arrival_sender.cc

Issue 20227003: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Land Recent QUIC changes Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/quic/congestion_control/inter_arrival_sender.cc
diff --git a/net/quic/congestion_control/inter_arrival_sender.cc b/net/quic/congestion_control/inter_arrival_sender.cc
index c8d2c86ae95773a2b0ec21a84d12a54b12f6f94f..07421ae2b0304aefccf7849b3d69196dfb47a1e0 100644
--- a/net/quic/congestion_control/inter_arrival_sender.cc
+++ b/net/quic/congestion_control/inter_arrival_sender.cc
@@ -14,6 +14,8 @@ const float kMaxBitrateReduction = 0.9f;
const float kMinBitrateReduction = 0.05f;
const uint64 kMinBitrateKbit = 10;
const int kInitialRttMs = 60; // At a typical RTT 60 ms.
+const float kAlpha = 0.125f;
+const float kOneMinusAlpha = 1 - kAlpha;
static const int kBitrateSmoothingPeriodMs = 1000;
static const int kMinBitrateSmoothingPeriodMs = 500;
@@ -200,18 +202,25 @@ void InterArrivalSender::OnIncomingAck(
QuicPacketSequenceNumber /*acked_sequence_number*/,
QuicByteCount acked_bytes,
QuicTime::Delta rtt) {
- DCHECK(!rtt.IsZero());
- DCHECK(!rtt.IsInfinite());
+ // RTT can't be negative.
+ DCHECK_LE(0, rtt.ToMicroseconds());
+
+ if (probing_) {
+ probe_->OnAcknowledgedPacket(acked_bytes);
+ }
+
+ if (rtt.IsInfinite()) {
+ return;
+ }
+
if (smoothed_rtt_.IsZero()) {
smoothed_rtt_ = rtt;
} else {
smoothed_rtt_ = QuicTime::Delta::FromMicroseconds(
- (smoothed_rtt_.ToMicroseconds() * 3 + rtt.ToMicroseconds()) / 4);
- }
- state_machine_->set_rtt(SmoothedRtt());
- if (probing_) {
- probe_->OnAcknowledgedPacket(acked_bytes);
+ kOneMinusAlpha * smoothed_rtt_.ToMicroseconds() +
+ kAlpha * rtt.ToMicroseconds());
}
+ state_machine_->set_rtt(smoothed_rtt_);
}
void InterArrivalSender::OnIncomingLoss(QuicTime ack_receive_time) {
@@ -305,6 +314,12 @@ QuicTime::Delta InterArrivalSender::SmoothedRtt() {
return smoothed_rtt_;
}
+QuicTime::Delta InterArrivalSender::RetransmissionDelay() {
+ // TODO(pwestin): Calculate and return retransmission delay.
+ // Use 2 * the smoothed RTT for now.
+ return smoothed_rtt_.Add(smoothed_rtt_);
+}
+
void InterArrivalSender::EstimateNewBandwidth(QuicTime feedback_receive_time,
QuicBandwidth sent_bandwidth) {
QuicBandwidth new_bandwidth = bitrate_ramp_up_->GetNewBitrate(sent_bandwidth);
« no previous file with comments | « net/quic/congestion_control/inter_arrival_sender.h ('k') | net/quic/congestion_control/quic_congestion_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698