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

Side by Side Diff: net/quic/quic_sent_packet_manager.cc

Issue 490263003: When talking >=QUIC_VERSION_22, regularly send updated bandwidth (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/quic_sent_packet_manager.h" 5 #include "net/quic/quic_sent_packet_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 // we only update rtt when the largest observed gets acked. 183 // we only update rtt when the largest observed gets acked.
184 bool largest_observed_acked = MaybeUpdateRTT(ack_frame, ack_receive_time); 184 bool largest_observed_acked = MaybeUpdateRTT(ack_frame, ack_receive_time);
185 if (largest_observed_ < ack_frame.largest_observed) { 185 if (largest_observed_ < ack_frame.largest_observed) {
186 largest_observed_ = ack_frame.largest_observed; 186 largest_observed_ = ack_frame.largest_observed;
187 unacked_packets_.IncreaseLargestObserved(largest_observed_); 187 unacked_packets_.IncreaseLargestObserved(largest_observed_);
188 } 188 }
189 HandleAckForSentPackets(ack_frame); 189 HandleAckForSentPackets(ack_frame);
190 InvokeLossDetection(ack_receive_time); 190 InvokeLossDetection(ack_receive_time);
191 MaybeInvokeCongestionEvent(largest_observed_acked, bytes_in_flight); 191 MaybeInvokeCongestionEvent(largest_observed_acked, bytes_in_flight);
192 192
193 sustained_bandwidth_recorder_.RecordEstimate(
194 send_algorithm_->InRecovery(),
195 send_algorithm_->InSlowStart(),
196 send_algorithm_->BandwidthEstimate(),
197 ack_receive_time,
198 clock_->WallNow(),
199 rtt_stats_.SmoothedRtt());
200
193 // If we have received a truncated ack, then we need to clear out some 201 // If we have received a truncated ack, then we need to clear out some
194 // previous transmissions to allow the peer to actually ACK new packets. 202 // previous transmissions to allow the peer to actually ACK new packets.
195 if (ack_frame.is_truncated) { 203 if (ack_frame.is_truncated) {
196 unacked_packets_.ClearPreviousRetransmissions( 204 unacked_packets_.ClearPreviousRetransmissions(
197 ack_frame.missing_packets.size() / 2); 205 ack_frame.missing_packets.size() / 2);
198 } 206 }
199 207
200 // Anytime we are making forward progress and have a new RTT estimate, reset 208 // Anytime we are making forward progress and have a new RTT estimate, reset
201 // the backoff counters. 209 // the backoff counters.
202 if (largest_observed_acked) { 210 if (largest_observed_acked) {
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 } 852 }
845 853
846 QuicBandwidth QuicSentPacketManager::BandwidthEstimate() const { 854 QuicBandwidth QuicSentPacketManager::BandwidthEstimate() const {
847 return send_algorithm_->BandwidthEstimate(); 855 return send_algorithm_->BandwidthEstimate();
848 } 856 }
849 857
850 bool QuicSentPacketManager::HasReliableBandwidthEstimate() const { 858 bool QuicSentPacketManager::HasReliableBandwidthEstimate() const {
851 return send_algorithm_->HasReliableBandwidthEstimate(); 859 return send_algorithm_->HasReliableBandwidthEstimate();
852 } 860 }
853 861
862 const QuicSustainedBandwidthRecorder&
863 QuicSentPacketManager::SustainedBandwidthRecorder() const {
864 return sustained_bandwidth_recorder_;
865 }
866
854 QuicByteCount QuicSentPacketManager::GetCongestionWindow() const { 867 QuicByteCount QuicSentPacketManager::GetCongestionWindow() const {
855 return send_algorithm_->GetCongestionWindow(); 868 return send_algorithm_->GetCongestionWindow();
856 } 869 }
857 870
858 QuicByteCount QuicSentPacketManager::GetSlowStartThreshold() const { 871 QuicByteCount QuicSentPacketManager::GetSlowStartThreshold() const {
859 return send_algorithm_->GetSlowStartThreshold(); 872 return send_algorithm_->GetSlowStartThreshold();
860 } 873 }
861 874
862 void QuicSentPacketManager::EnablePacing() { 875 void QuicSentPacketManager::EnablePacing() {
863 if (using_pacing_) { 876 if (using_pacing_) {
864 return; 877 return;
865 } 878 }
866 879
867 // Set up a pacing sender with a 5 millisecond alarm granularity. 880 // Set up a pacing sender with a 5 millisecond alarm granularity.
868 using_pacing_ = true; 881 using_pacing_ = true;
869 send_algorithm_.reset( 882 send_algorithm_.reset(
870 new PacingSender(send_algorithm_.release(), 883 new PacingSender(send_algorithm_.release(),
871 QuicTime::Delta::FromMilliseconds(5), 884 QuicTime::Delta::FromMilliseconds(5),
872 kInitialUnpacedBurst)); 885 kInitialUnpacedBurst));
873 } 886 }
874 887
875 } // namespace net 888 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698