Index: net/quic/congestion_control/cubic.cc |
diff --git a/net/quic/congestion_control/cubic.cc b/net/quic/congestion_control/cubic.cc |
index 55ce8037cedb0c8ede254df8023f89286814f61a..58b538576a85ec7cd857b01086fe460bb7407e4f 100644 |
--- a/net/quic/congestion_control/cubic.cc |
+++ b/net/quic/congestion_control/cubic.cc |
@@ -4,12 +4,14 @@ |
#include "net/quic/congestion_control/cubic.h" |
+#include <math.h> |
#include <algorithm> |
#include "base/basictypes.h" |
#include "base/logging.h" |
#include "base/time/time.h" |
#include "net/quic/congestion_control/cube_root.h" |
+#include "net/quic/quic_flags.h" |
#include "net/quic/quic_protocol.h" |
using std::max; |
@@ -80,7 +82,6 @@ void Cubic::Reset() { |
void Cubic::UpdateCongestionControlStats(QuicPacketCount new_cubic_mode_cwnd, |
QuicPacketCount new_reno_mode_cwnd) { |
- |
QuicPacketCount highest_new_cwnd = max(new_cubic_mode_cwnd, |
new_reno_mode_cwnd); |
if (last_congestion_window_ < highest_new_cwnd) { |
@@ -135,8 +136,17 @@ QuicPacketCount Cubic::CongestionWindowAfterAck( |
time_to_origin_point_ = 0; |
origin_point_congestion_window_ = current_congestion_window; |
} else { |
- time_to_origin_point_ = CubeRoot::Root(kCubeFactor * |
- (last_max_congestion_window_ - current_congestion_window)); |
+ if (FLAGS_quic_use_std_cbrt) { |
+ time_to_origin_point_ = static_cast<uint32>( |
+ cbrt(kCubeFactor * |
+ (last_max_congestion_window_ - current_congestion_window))); |
+ } else { |
+ // TODO(rjshade): Remove CubeRoot source when removing |
+ // FLAGS_quic_use_std_cbrt. |
+ time_to_origin_point_ = |
+ CubeRoot::Root(kCubeFactor * (last_max_congestion_window_ - |
+ current_congestion_window)); |
+ } |
origin_point_congestion_window_ = |
last_max_congestion_window_; |
} |