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.
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
12 #ifndef NET_QUIC_CONGESTION_CONTROL_INTER_ARRIVAL_BITRATE_RAMP_UP_H_
13 #define NET_QUIC_CONGESTION_CONTROL_INTER_ARRIVAL_BITRATE_RAMP_UP_H_
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"
23 class NET_EXPORT_PRIVATE InterArrivalBitrateRampUp {
25 explicit InterArrivalBitrateRampUp(const QuicClock* clock);
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);
32 // Call everytime we get a new channel estimate.
33 void UpdateChannelEstimate(QuicBandwidth channel_estimate);
35 // Compute a new send pace to use.
36 QuicBandwidth GetNewBitrate(QuicBandwidth sent_bitrate);
39 uint32 CalcuateTimeToOriginPoint(QuicBandwidth rate_difference) const;
41 static const QuicTime::Delta MaxCubicTimeInterval() {
42 return QuicTime::Delta::FromMilliseconds(30);
45 const QuicClock* clock_;
47 QuicBandwidth current_rate_;
48 QuicBandwidth channel_estimate_;
49 QuicBandwidth available_channel_estimate_;
50 QuicBandwidth halfway_point_;
52 // Time when this cycle started, after a Reset.
55 // Time when we updated current_rate_.
56 QuicTime last_update_time_;
58 // Time to origin point of cubic function in 2^10 fractions of a second.
59 uint32 time_to_origin_point_;
61 DISALLOW_COPY_AND_ASSIGN(InterArrivalBitrateRampUp);
66 #endif // NET_QUIC_CONGESTION_CONTROL_INTER_ARRIVAL_BITRATE_RAMP_UP_H_