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

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

Issue 12334063: Land recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more EXPECT_FALSE Created 7 years, 10 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
« no previous file with comments | « net/quic/congestion_control/fix_rate_sender.h ('k') | net/quic/congestion_control/fix_rate_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/congestion_control/fix_rate_sender.cc
diff --git a/net/quic/congestion_control/fix_rate_sender.cc b/net/quic/congestion_control/fix_rate_sender.cc
index 2738526c3e2749fbd6f27833440cd31fac480ffd..34addfc265d5b18e4679f9c3d5b301b2d0be9f23 100644
--- a/net/quic/congestion_control/fix_rate_sender.cc
+++ b/net/quic/congestion_control/fix_rate_sender.cc
@@ -18,21 +18,23 @@ namespace net {
FixRateSender::FixRateSender(const QuicClock* clock)
: bitrate_(QuicBandwidth::FromBytesPerSecond(kInitialBitrate)),
- fix_rate_leaky_bucket_(clock, bitrate_),
- paced_sender_(clock, bitrate_),
+ fix_rate_leaky_bucket_(bitrate_),
+ paced_sender_(bitrate_),
data_in_flight_(0) {
DLOG(INFO) << "FixRateSender";
}
void FixRateSender::OnIncomingQuicCongestionFeedbackFrame(
const QuicCongestionFeedbackFrame& feedback,
+ QuicTime feedback_receive_time,
+ QuicBandwidth /*sent_bandwidth*/,
const SentPacketsMap& /*sent_packets*/) {
DCHECK(feedback.type == kFixRate) <<
"Invalid incoming CongestionFeedbackType:" << feedback.type;
if (feedback.type == kFixRate) {
bitrate_ = feedback.fix_rate.bitrate;
- fix_rate_leaky_bucket_.SetDrainingRate(bitrate_);
- paced_sender_.UpdateBandwidthEstimate(bitrate_);
+ fix_rate_leaky_bucket_.SetDrainingRate(feedback_receive_time, bitrate_);
+ paced_sender_.UpdateBandwidthEstimate(feedback_receive_time, bitrate_);
}
// Silently ignore invalid messages in release mode.
}
@@ -44,34 +46,36 @@ void FixRateSender::OnIncomingAck(
data_in_flight_ -= bytes_acked;
}
-void FixRateSender::OnIncomingLoss(int /*number_of_lost_packets*/) {
+void FixRateSender::OnIncomingLoss(QuicTime /*ack_receive_time*/) {
// Ignore losses for fix rate sender.
}
-void FixRateSender::SentPacket(QuicPacketSequenceNumber /*sequence_number*/,
+void FixRateSender::SentPacket(QuicTime sent_time,
+ QuicPacketSequenceNumber /*sequence_number*/,
QuicByteCount bytes,
bool is_retransmission) {
- fix_rate_leaky_bucket_.Add(bytes);
- paced_sender_.SentPacket(bytes);
+ fix_rate_leaky_bucket_.Add(sent_time, bytes);
+ paced_sender_.SentPacket(sent_time, bytes);
if (!is_retransmission) {
data_in_flight_ += bytes;
}
}
-QuicTime::Delta FixRateSender::TimeUntilSend(bool /*is_retransmission*/) {
- if (CongestionWindow() > fix_rate_leaky_bucket_.BytesPending()) {
+QuicTime::Delta FixRateSender::TimeUntilSend(QuicTime now,
+ bool /*is_retransmission*/) {
+ if (CongestionWindow() > fix_rate_leaky_bucket_.BytesPending(now)) {
if (CongestionWindow() <= data_in_flight_) {
// We need an ack before we send more.
return QuicTime::Delta::Infinite();
}
- return paced_sender_.TimeUntilSend(QuicTime::Delta::Zero());
+ return paced_sender_.TimeUntilSend(now, QuicTime::Delta::Zero());
}
- QuicTime::Delta time_remaining = fix_rate_leaky_bucket_.TimeRemaining();
+ QuicTime::Delta time_remaining = fix_rate_leaky_bucket_.TimeRemaining(now);
if (time_remaining.IsZero()) {
// We need an ack before we send more.
return QuicTime::Delta::Infinite();
}
- return paced_sender_.TimeUntilSend(time_remaining);
+ return paced_sender_.TimeUntilSend(now, time_remaining);
}
QuicByteCount FixRateSender::CongestionWindow() {
@@ -81,16 +85,6 @@ QuicByteCount FixRateSender::CongestionWindow() {
return std::max(kMaxPacketSize, window_size_bytes);
}
-QuicByteCount FixRateSender::AvailableCongestionWindow() {
- QuicByteCount congestion_window = CongestionWindow();
- if (data_in_flight_ >= congestion_window) {
- return 0;
- }
- QuicByteCount available_congestion_window = congestion_window -
- data_in_flight_;
- return paced_sender_.AvailableWindow(available_congestion_window);
-}
-
QuicBandwidth FixRateSender::BandwidthEstimate() {
return bitrate_;
}
« no previous file with comments | « net/quic/congestion_control/fix_rate_sender.h ('k') | net/quic/congestion_control/fix_rate_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698