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

Unified Diff: net/quic/quic_fec_group.cc

Issue 1417683003: Fix the semantics of QuicFecGroup::ProtectsPacketsBefore into IsWaitingForPacketBefore. Certain ed… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@105435253
Patch Set: Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_fec_group.h ('k') | net/quic/quic_fec_group_interface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « net/quic/quic_fec_group.h ('k') | net/quic/quic_fec_group_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698