This source file includes following definitions.
- GetLossDetectionType
 
- DetectLostPackets
 
- GetLossTimeout
 
#include "net/quic/congestion_control/tcp_loss_algorithm.h"
#include "net/quic/congestion_control/rtt_stats.h"
#include "net/quic/quic_protocol.h"
namespace net {
namespace {
static const size_t kNumberOfNacksBeforeRetransmission = 3;
static const double kEarlyRetransmitLossDelayMultiplier = 1.25;
}
TCPLossAlgorithm::TCPLossAlgorithm()
    : loss_detection_timeout_(QuicTime::Zero()) { }
LossDetectionType TCPLossAlgorithm::GetLossDetectionType() const {
  return kNack;
}
SequenceNumberSet TCPLossAlgorithm::DetectLostPackets(
    const QuicUnackedPacketMap& unacked_packets,
    const QuicTime& time,
    QuicPacketSequenceNumber largest_observed,
    const RttStats& rtt_stats) {
  SequenceNumberSet lost_packets;
  loss_detection_timeout_ = QuicTime::Zero();
  QuicTime::Delta loss_delay =
      rtt_stats.SmoothedRtt().Multiply(kEarlyRetransmitLossDelayMultiplier);
  for (QuicUnackedPacketMap::const_iterator it = unacked_packets.begin();
       it != unacked_packets.end() && it->first <= largest_observed; ++it) {
    if (!it->second.pending) {
      continue;
    }
    LOG_IF(DFATAL, it->second.nack_count == 0)
        << "All packets less than largest observed should have been nacked.";
    if (it->second.nack_count >= kNumberOfNacksBeforeRetransmission) {
      lost_packets.insert(it->first);
      continue;
    }
    
    
    
    if (it->second.retransmittable_frames &&
        unacked_packets.largest_sent_packet() == largest_observed) {
      
      
      if (time >= it->second.sent_time.Add(loss_delay)) {
        lost_packets.insert(it->first);
      } else {
        
        
        loss_detection_timeout_ = it->second.sent_time.Add(loss_delay);
        break;
      }
    }
  }
  return lost_packets;
}
QuicTime TCPLossAlgorithm::GetLossTimeout() const {
  return loss_detection_timeout_;
}
}