diff options
Diffstat (limited to 'chromium/net/quic/congestion_control/inter_arrival_sender.cc')
-rw-r--r-- | chromium/net/quic/congestion_control/inter_arrival_sender.cc | 77 |
1 files changed, 49 insertions, 28 deletions
diff --git a/chromium/net/quic/congestion_control/inter_arrival_sender.cc b/chromium/net/quic/congestion_control/inter_arrival_sender.cc index 5640a731ae9..632a41612be 100644 --- a/chromium/net/quic/congestion_control/inter_arrival_sender.cc +++ b/chromium/net/quic/congestion_control/inter_arrival_sender.cc @@ -24,15 +24,16 @@ static const int kMinBitrateSmoothingPeriodMs = 500; InterArrivalSender::InterArrivalSender(const QuicClock* clock) : probing_(true), + max_segment_size_(kDefaultMaxPacketSize), current_bandwidth_(QuicBandwidth::Zero()), smoothed_rtt_(QuicTime::Delta::Zero()), channel_estimator_(new ChannelEstimator()), bitrate_ramp_up_(new InterArrivalBitrateRampUp(clock)), overuse_detector_(new InterArrivalOveruseDetector()), - probe_(new InterArrivalProbe()), + probe_(new InterArrivalProbe(max_segment_size_)), state_machine_(new InterArrivalStateMachine(clock)), paced_sender_(new PacedSender(QuicBandwidth::FromKBytesPerSecond( - kProbeBitrateKBytesPerSecond))), + kProbeBitrateKBytesPerSecond), max_segment_size_)), accumulated_number_of_lost_packets_(0), bandwidth_usage_state_(kBandwidthSteady), back_down_time_(QuicTime::Zero()), @@ -43,6 +44,16 @@ InterArrivalSender::InterArrivalSender(const QuicClock* clock) InterArrivalSender::~InterArrivalSender() { } +void InterArrivalSender::SetFromConfig(const QuicConfig& config, + bool is_server) { +} + +void InterArrivalSender::SetMaxPacketSize(QuicByteCount max_packet_size) { + max_segment_size_ = max_packet_size; + paced_sender_->set_max_segment_size(max_segment_size_); + probe_->set_max_segment_size(max_segment_size_); +} + // TODO(pwestin): this is really inefficient (4% CPU on the GFE loadtest). // static QuicBandwidth InterArrivalSender::CalculateSentBandwidth( @@ -62,11 +73,11 @@ QuicBandwidth InterArrivalSender::CalculateSentBandwidth( QuicTime::Delta max_diff = QuicTime::Delta::Zero(); for (; history_rit != sent_packets_map.rend(); ++history_rit) { QuicTime::Delta diff = - feedback_receive_time.Subtract(history_rit->second->SendTimestamp()); + feedback_receive_time.Subtract(history_rit->second->send_timestamp()); if (diff > kBitrateSmoothingPeriod) { break; } - sum_bytes_sent += history_rit->second->BytesSent(); + sum_bytes_sent += history_rit->second->bytes_sent(); max_diff = diff; } if (max_diff < kMinBitrateSmoothingPeriod) { @@ -98,13 +109,13 @@ void InterArrivalSender::OnIncomingQuicCongestionFeedbackFrame( SentPacketsMap::const_iterator sent_it = sent_packets.find(sequence_number); if (sent_it == sent_packets.end()) { // Too old data; ignore and move forward. - DLOG(INFO) << "Too old feedback move forward, sequence_number:" + DVLOG(1) << "Too old feedback move forward, sequence_number:" << sequence_number; continue; } QuicTime time_received = received_it->second; - QuicTime time_sent = sent_it->second->SendTimestamp(); - QuicByteCount bytes_sent = sent_it->second->BytesSent(); + QuicTime time_sent = sent_it->second->send_timestamp(); + QuicByteCount bytes_sent = sent_it->second->bytes_sent(); channel_estimator_->OnAcknowledgedPacket( sequence_number, bytes_sent, time_sent, time_received); @@ -118,7 +129,7 @@ void InterArrivalSender::OnIncomingQuicCongestionFeedbackFrame( // No more sent packets; hence this must be the last. last_of_send_time = true; } else { - if (time_sent != next_sent_it->second->SendTimestamp()) { + if (time_sent != next_sent_it->second->send_timestamp()) { // Next sent packet have a different send time. last_of_send_time = true; } @@ -189,7 +200,7 @@ bool InterArrivalSender::ProbingPhase(QuicTime feedback_receive_time) { current_bandwidth_ = new_rate; paced_sender_->UpdateBandwidthEstimate(feedback_receive_time, new_rate); - DLOG(INFO) << "Probe result; new rate:" + DVLOG(1) << "Probe result; new rate:" << new_rate.ToKBitsPerSecond() << " Kbits/s " << " available estimate:" << available_channel_estimate.ToKBitsPerSecond() << " Kbits/s " @@ -198,7 +209,7 @@ bool InterArrivalSender::ProbingPhase(QuicTime feedback_receive_time) { return false; } -void InterArrivalSender::OnIncomingAck( +void InterArrivalSender::OnPacketAcked( QuicPacketSequenceNumber /*acked_sequence_number*/, QuicByteCount acked_bytes, QuicTime::Delta rtt) { @@ -223,7 +234,9 @@ void InterArrivalSender::OnIncomingAck( state_machine_->set_rtt(smoothed_rtt_); } -void InterArrivalSender::OnIncomingLoss(QuicTime ack_receive_time) { +void InterArrivalSender::OnPacketLost( + QuicPacketSequenceNumber /*sequence_number*/, + QuicTime ack_receive_time) { // Packet loss was reported. if (!probing_) { if (!state_machine_->PacketLossEvent()) { @@ -235,20 +248,24 @@ void InterArrivalSender::OnIncomingLoss(QuicTime ack_receive_time) { } } -bool InterArrivalSender::SentPacket( +bool InterArrivalSender::OnPacketSent( QuicTime sent_time, QuicPacketSequenceNumber sequence_number, QuicByteCount bytes, - Retransmission /*is_retransmit*/, + TransmissionType /*transmission_type*/, HasRetransmittableData /*has_retransmittable_data*/) { if (probing_) { - probe_->OnSentPacket(bytes); + probe_->OnPacketSent(bytes); } - paced_sender_->SentPacket(sent_time, bytes); + paced_sender_->OnPacketSent(sent_time, bytes); return true; } -void InterArrivalSender::AbandoningPacket( +void InterArrivalSender::OnRetransmissionTimeout() { + // TODO(ianswett): Decrease the available bandwidth. +} + +void InterArrivalSender::OnPacketAbandoned( QuicPacketSequenceNumber /*sequence_number*/, QuicByteCount abandoned_bytes) { // TODO(pwestin): use for out outer_congestion_window_ logic. @@ -259,7 +276,7 @@ void InterArrivalSender::AbandoningPacket( QuicTime::Delta InterArrivalSender::TimeUntilSend( QuicTime now, - Retransmission /*retransmit*/, + TransmissionType /*transmission_type*/, HasRetransmittableData has_retransmittable_data, IsHandshake /*handshake*/) { // TODO(pwestin): implement outer_congestion_window_ logic. @@ -307,23 +324,27 @@ void InterArrivalSender::EstimateDelayBandwidth(QuicTime feedback_receive_time, bandwidth_usage_state_ = new_bandwidth_usage_state; } -QuicBandwidth InterArrivalSender::BandwidthEstimate() { +QuicBandwidth InterArrivalSender::BandwidthEstimate() const { return current_bandwidth_; } -QuicTime::Delta InterArrivalSender::SmoothedRtt() { +QuicTime::Delta InterArrivalSender::SmoothedRtt() const { if (smoothed_rtt_.IsZero()) { return QuicTime::Delta::FromMilliseconds(kInitialRttMs); } return smoothed_rtt_; } -QuicTime::Delta InterArrivalSender::RetransmissionDelay() { +QuicTime::Delta InterArrivalSender::RetransmissionDelay() const { // TODO(pwestin): Calculate and return retransmission delay. // Use 2 * the smoothed RTT for now. return smoothed_rtt_.Add(smoothed_rtt_); } +QuicByteCount InterArrivalSender::GetCongestionWindow() const { + return 0; +} + void InterArrivalSender::EstimateNewBandwidth(QuicTime feedback_receive_time, QuicBandwidth sent_bandwidth) { QuicBandwidth new_bandwidth = bitrate_ramp_up_->GetNewBitrate(sent_bandwidth); @@ -342,7 +363,7 @@ void InterArrivalSender::EstimateNewBandwidth(QuicTime feedback_receive_time, } paced_sender_->UpdateBandwidthEstimate(feedback_receive_time, current_bandwidth_); - DLOG(INFO) << "New bandwidth estimate in steady state:" + DVLOG(1) << "New bandwidth estimate in steady state:" << current_bandwidth_.ToKBitsPerSecond() << " Kbits/s"; } @@ -354,12 +375,12 @@ void InterArrivalSender::EstimateNewBandwidthAfterDraining( if (current_bandwidth_ > back_down_bandwidth_) { // Do nothing, our current bandwidth is higher than our bandwidth at the // previous back down. - DLOG(INFO) << "Current bandwidth estimate is higher than before draining"; + DVLOG(1) << "Current bandwidth estimate is higher than before draining"; return; } if (estimated_congestion_delay >= back_down_congestion_delay_) { // Do nothing, our estimated delay have increased. - DLOG(INFO) << "Current delay estimate is higher than before draining"; + DVLOG(1) << "Current delay estimate is higher than before draining"; return; } DCHECK(back_down_time_.IsInitialized()); @@ -389,7 +410,7 @@ void InterArrivalSender::EstimateNewBandwidthAfterDraining( new_estimate = std::max(current_bandwidth_, current_bandwidth_.Add(draining_rate).Scale( 1.0f - kMinBitrateReduction)); - DLOG(INFO) << "Draining calculation; current rate:" + DVLOG(1) << "Draining calculation; current rate:" << current_bandwidth_.ToKBitsPerSecond() << " Kbits/s " << "draining rate:" << draining_rate.ToKBitsPerSecond() << " Kbits/s " @@ -425,7 +446,7 @@ void InterArrivalSender::EstimateNewBandwidthAfterDraining( state_machine_->IncreaseBitrateDecision(); paced_sender_->UpdateBandwidthEstimate(feedback_receive_time, new_estimate); current_bandwidth_ = new_estimate; - DLOG(INFO) << "New bandwidth estimate after draining:" + DVLOG(1) << "New bandwidth estimate after draining:" << new_estimate.ToKBitsPerSecond() << " Kbits/s"; } @@ -452,12 +473,12 @@ void InterArrivalSender::EstimateBandwidthAfterDelayEvent( // While in delay sensing mode send at least one packet per RTT. QuicBandwidth min_delay_bitrate = - QuicBandwidth::FromBytesAndTimeDelta(kMaxPacketSize, SmoothedRtt()); + QuicBandwidth::FromBytesAndTimeDelta(max_segment_size_, SmoothedRtt()); new_target_bitrate = std::max(new_target_bitrate, min_delay_bitrate); ResetCurrentBandwidth(feedback_receive_time, new_target_bitrate); - DLOG(INFO) << "New bandwidth estimate after delay event:" + DVLOG(1) << "New bandwidth estimate after delay event:" << current_bandwidth_.ToKBitsPerSecond() << " Kbits/s min delay bitrate:" << min_delay_bitrate.ToKBitsPerSecond() @@ -470,7 +491,7 @@ void InterArrivalSender::EstimateBandwidthAfterLossEvent( QuicTime feedback_receive_time) { ResetCurrentBandwidth(feedback_receive_time, current_bandwidth_.Scale(kPacketLossBitrateReduction)); - DLOG(INFO) << "New bandwidth estimate after loss event:" + DVLOG(1) << "New bandwidth estimate after loss event:" << current_bandwidth_.ToKBitsPerSecond() << " Kbits/s"; } |