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

Unified Diff: net/quic/quic_packet_creator.cc

Issue 1409813006: Remove QuicPacketCreator::fec_group_number_; replace it with QuicFecGroupInterface::FecGroupNumber(… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@106425553
Patch Set: Created 5 years, 1 month 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_packet_creator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_packet_creator.cc
diff --git a/net/quic/quic_packet_creator.cc b/net/quic/quic_packet_creator.cc
index e5cda5366f6dba13303a76eb00e284a86a461fbb..75f7490ff703c0c4ceac804df1fa1fd0b696bc1a 100644
--- a/net/quic/quic_packet_creator.cc
+++ b/net/quic/quic_packet_creator.cc
@@ -76,7 +76,6 @@ QuicPacketCreator::QuicPacketCreator(QuicConnectionId connection_id,
random_bool_source_(new QuicRandomBoolSource(random_generator)),
packet_number_(0),
should_fec_protect_(false),
- fec_group_number_(0),
send_version_in_packet_(framer->perspective() == Perspective::IS_CLIENT),
max_packet_length_(0),
max_packets_per_fec_group_(kDefaultMaxPacketsPerFecGroup),
@@ -130,6 +129,10 @@ void QuicPacketCreator::set_max_packets_per_fec_group(
DCHECK_LT(0u, max_packets_per_fec_group_);
}
+QuicFecGroupNumber QuicPacketCreator::fec_group_number() {
+ return fec_group_ != nullptr ? fec_group_->FecGroupNumber() : 0;
+}
+
bool QuicPacketCreator::ShouldSendFec(bool force_close) const {
DCHECK(!HasPendingFrames());
return fec_group_.get() != nullptr && fec_group_->NumReceivedPackets() > 0 &&
@@ -175,7 +178,6 @@ void QuicPacketCreator::StopFecProtectingPackets() {
}
DCHECK(should_fec_protect_);
should_fec_protect_ = false;
- fec_group_number_ = 0;
}
bool QuicPacketCreator::IsFecProtected() const {
@@ -205,8 +207,7 @@ InFecGroup QuicPacketCreator::MaybeUpdateLengthsAndStartFec() {
}
// Start a new FEC group since protection is on. Set the fec group number to
// the packet number of the next packet.
- fec_group_number_ = packet_number() + 1;
- fec_group_.reset(new QuicFecGroup(fec_group_number_));
+ fec_group_.reset(new QuicFecGroup(packet_number_ + 1));
return IN_FEC_GROUP;
}
@@ -479,9 +480,12 @@ SerializedPacket QuicPacketCreator::SerializePacket(
DCHECK_LT(0u, encrypted_buffer_len);
LOG_IF(DFATAL, queued_frames_.empty())
<< "Attempt to serialize empty packet";
- DCHECK_GE(packet_number_ + 1, fec_group_number_);
+ if (fec_group_.get() != nullptr) {
+ DCHECK_GE(packet_number_ + 1, fec_group_->FecGroupNumber());
+ }
QuicPacketHeader header;
- FillPacketHeader(should_fec_protect_ ? fec_group_number_ : 0, false, &header);
+ // FillPacketHeader increments packet_number_.
+ FillPacketHeader(fec_group_number(), false, &header);
MaybeAddPadding();
@@ -567,13 +571,14 @@ SerializedPacket QuicPacketCreator::SerializeFec(char* buffer,
}
DCHECK_EQ(0u, queued_frames_.size());
QuicPacketHeader header;
- FillPacketHeader(fec_group_number_, true, &header);
+ FillPacketHeader(fec_group_->FecGroupNumber(), true, &header);
scoped_ptr<QuicPacket> packet(
framer_->BuildFecPacket(header, fec_group_->PayloadParity()));
fec_group_.reset(nullptr);
packet_size_ = 0;
LOG_IF(DFATAL, packet == nullptr)
- << "Failed to serialize fec packet for group:" << fec_group_number_;
+ << "Failed to serialize fec packet for group:"
+ << fec_group_->FecGroupNumber();
DCHECK_GE(max_packet_length_, packet->length());
// Immediately encrypt the packet, to ensure we don't encrypt the same packet
// packet number multiple times.
« no previous file with comments | « net/quic/quic_packet_creator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698