1 // Copyright (c) 2013 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 // Ramp up bitrate from a start point normally our "current_rate" as long as we 6 // have no packet loss or delay events. 7 // The first half of the ramp up curve follows a cubic function with its orgin 8 // at the estimated available bandwidth, onece the bitrate pass the halfway 9 // point between the estimated available bandwidth and the estimated max 10 // bandwidth it will follw a new cubic function with its orgin at the estimated 11 // max bandwidth. 12 #ifndef NET_QUIC_CONGESTION_CONTROL_INTER_ARRIVAL_BITRATE_RAMP_UP_H_ 13 #define NET_QUIC_CONGESTION_CONTROL_INTER_ARRIVAL_BITRATE_RAMP_UP_H_ 14 15 #include "base/basictypes.h" 16 #include "net/base/net_export.h" 17 #include "net/quic/quic_bandwidth.h" 18 #include "net/quic/quic_clock.h" 19 #include "net/quic/quic_time.h" 20 21 namespace net { 22 23 class NET_EXPORT_PRIVATE InterArrivalBitrateRampUp { 24 public: 25 explicit InterArrivalBitrateRampUp(const QuicClock* clock); 26 27 // Call after a decision to lower the bitrate and after a probe. 28 void Reset(QuicBandwidth current_rate, 29 QuicBandwidth available_channel_estimate, 30 QuicBandwidth channel_estimate); 31 32 // Call everytime we get a new channel estimate. 33 void UpdateChannelEstimate(QuicBandwidth channel_estimate); 34 35 // Compute a new send pace to use. 36 QuicBandwidth GetNewBitrate(QuicBandwidth sent_bitrate); 37 38 private: 39 uint32 CalcuateTimeToOriginPoint(QuicBandwidth rate_difference) const; 40 MaxCubicTimeInterval()41 static const QuicTime::Delta MaxCubicTimeInterval() { 42 return QuicTime::Delta::FromMilliseconds(30); 43 } 44 45 const QuicClock* clock_; 46 47 QuicBandwidth current_rate_; 48 QuicBandwidth channel_estimate_; 49 QuicBandwidth available_channel_estimate_; 50 QuicBandwidth halfway_point_; 51 52 // Time when this cycle started, after a Reset. 53 QuicTime epoch_; 54 55 // Time when we updated current_rate_. 56 QuicTime last_update_time_; 57 58 // Time to origin point of cubic function in 2^10 fractions of a second. 59 uint32 time_to_origin_point_; 60 61 DISALLOW_COPY_AND_ASSIGN(InterArrivalBitrateRampUp); 62 }; 63 64 } // namespace net 65 #endif // NET_QUIC_CONGESTION_CONTROL_INTER_ARRIVAL_BITRATE_RAMP_UP_H_ 66