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

Side by Side Diff: net/quic/congestion_control/fix_rate_sender.cc

Issue 424903002: Remove FixRate congestion frame type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_quic_version_15_71718286
Patch Set: Created 6 years, 4 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "net/quic/congestion_control/fix_rate_sender.h"
6
7 #include <math.h>
8
9 #include <algorithm>
10
11 #include "base/logging.h"
12 #include "net/quic/congestion_control/rtt_stats.h"
13 #include "net/quic/quic_protocol.h"
14
15 using std::max;
16
17 namespace {
18 const int kInitialBitrate = 100000; // In bytes per second.
19 const uint64 kWindowSizeUs = 10000; // 10 ms.
20 }
21
22 namespace net {
23
24 FixRateSender::FixRateSender(const RttStats* rtt_stats)
25 : rtt_stats_(rtt_stats),
26 bitrate_(QuicBandwidth::FromBytesPerSecond(kInitialBitrate)),
27 max_segment_size_(kDefaultMaxPacketSize),
28 fix_rate_leaky_bucket_(bitrate_),
29 latest_rtt_(QuicTime::Delta::Zero()) {
30 DVLOG(1) << "FixRateSender";
31 }
32
33 FixRateSender::~FixRateSender() {
34 }
35
36 void FixRateSender::SetFromConfig(const QuicConfig& config, bool is_server) {
37 }
38
39 void FixRateSender::OnIncomingQuicCongestionFeedbackFrame(
40 const QuicCongestionFeedbackFrame& feedback,
41 QuicTime feedback_receive_time) {
42 LOG_IF(DFATAL, feedback.type != kFixRate) <<
43 "Invalid incoming CongestionFeedbackType:" << feedback.type;
44 if (feedback.type == kFixRate) {
45 bitrate_ = feedback.fix_rate.bitrate;
46 fix_rate_leaky_bucket_.SetDrainingRate(feedback_receive_time, bitrate_);
47 }
48 // Silently ignore invalid messages in release mode.
49 }
50
51 void FixRateSender::OnCongestionEvent(bool rtt_updated,
52 QuicByteCount bytes_in_flight,
53 const CongestionMap& acked_packets,
54 const CongestionMap& lost_packets) {
55 }
56
57 bool FixRateSender::OnPacketSent(
58 QuicTime sent_time,
59 QuicByteCount /*bytes_in_flight*/,
60 QuicPacketSequenceNumber /*sequence_number*/,
61 QuicByteCount bytes,
62 HasRetransmittableData /*has_retransmittable_data*/) {
63 fix_rate_leaky_bucket_.Add(sent_time, bytes);
64
65 return true;
66 }
67
68 void FixRateSender::OnRetransmissionTimeout(bool packets_retransmitted) {}
69
70 void FixRateSender::RevertRetransmissionTimeout() {}
71
72 QuicTime::Delta FixRateSender::TimeUntilSend(
73 QuicTime now,
74 QuicByteCount /*bytes_in_flight*/,
75 HasRetransmittableData /*has_retransmittable_data*/) const {
76 return fix_rate_leaky_bucket_.TimeRemaining(now);
77 }
78
79 QuicByteCount FixRateSender::CongestionWindow() const {
80 QuicByteCount window_size_bytes = bitrate_.ToBytesPerPeriod(
81 QuicTime::Delta::FromMicroseconds(kWindowSizeUs));
82 // Make sure window size is not less than a packet.
83 return max(kDefaultMaxPacketSize, window_size_bytes);
84 }
85
86 QuicBandwidth FixRateSender::BandwidthEstimate() const {
87 return bitrate_;
88 }
89
90 bool FixRateSender::HasReliableBandwidthEstimate() const {
91 return true;
92 }
93
94 QuicTime::Delta FixRateSender::RetransmissionDelay() const {
95 // TODO(pwestin): Calculate and return retransmission delay.
96 // Use 2 * the latest RTT for now.
97 return latest_rtt_.Add(latest_rtt_);
98 }
99
100 QuicByteCount FixRateSender::GetCongestionWindow() const {
101 return 0;
102 }
103
104 bool FixRateSender::InSlowStart() const {
105 return false;
106 }
107
108 QuicByteCount FixRateSender::GetSlowStartThreshold() const {
109 return 0;
110 }
111
112 CongestionControlType FixRateSender::GetCongestionControlType() const {
113 return kFixRateCongestionControl;
114 }
115
116 } // namespace net
OLDNEW
« 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