| Index: net/quic/quic_fec_group.cc
|
| diff --git a/net/quic/quic_fec_group.cc b/net/quic/quic_fec_group.cc
|
| index 51194d1212378247f8f40551c6e01c12564775a5..c9aaa812c1414ababe56416733f92b6c07433319 100644
|
| --- a/net/quic/quic_fec_group.cc
|
| +++ b/net/quic/quic_fec_group.cc
|
| @@ -118,13 +118,31 @@ size_t QuicFecGroup::Revive(QuicPacketHeader* header,
|
| return payload_parity_len_;
|
| }
|
|
|
| -bool QuicFecGroup::ProtectsPacketsBefore(QuicPacketNumber num) const {
|
| - if (has_received_fec_packet()) {
|
| - return max_protected_packet_ < num;
|
| +bool QuicFecGroup::IsWaitingForPacketBefore(QuicPacketNumber num) const {
|
| + // Entire range is larger than the threshold.
|
| + if (min_protected_packet_ >= num) {
|
| + return false;
|
| + }
|
| +
|
| + // Entire range is smaller than the threshold.
|
| + if (received_packets_.size() > 0 ? *received_packets_.rbegin() + 1 < num
|
| + : min_protected_packet_ < num) {
|
| + return true;
|
| + }
|
| +
|
| + // Range spans the threshold so look for a missing packet below the threshold.
|
| + QuicPacketNumber target = min_protected_packet_;
|
| + for (QuicPacketNumber packet : received_packets_) {
|
| + if (target++ != packet) {
|
| + return true;
|
| + }
|
| + if (target >= num) {
|
| + return false;
|
| + }
|
| }
|
| - // Since we might not yet have received the FEC packet, we must check
|
| - // the packets we have received.
|
| - return *received_packets_.begin() < num;
|
| +
|
| + // No missing packets below the threshold.
|
| + return false;
|
| }
|
|
|
| bool QuicFecGroup::UpdateParity(StringPiece payload) {
|
|
|