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

Unified Diff: net/quic/quic_packet_creator.cc

Issue 241483004: Fixed a bug in QuicPacketCreator when FEC was used for unsupported (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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_packet_creator.h ('k') | net/quic/quic_packet_creator_test.cc » ('j') | 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 d21b33876fca1b36971357bc5e9338d85fcdba7b..8c1e0e1a86b3d02822fdd42b741f2a8efea0fce7 100644
--- a/net/quic/quic_packet_creator.cc
+++ b/net/quic/quic_packet_creator.cc
@@ -89,9 +89,7 @@ bool QuicPacketCreator::ShouldSendFec(bool force_close) const {
}
InFecGroup QuicPacketCreator::MaybeStartFEC() {
- // Don't send FEC until QUIC_VERSION_15.
- if (framer_->version() != QUIC_VERSION_13 &&
- options_.max_packets_per_fec_group > 0 && fec_group_.get() == NULL) {
+ if (IsFecEnabled() && fec_group_.get() == NULL) {
DCHECK(queued_frames_.empty());
// Set the fec group number to the sequence number of the next packet.
fec_group_number_ = sequence_number() + 1;
@@ -133,11 +131,9 @@ bool QuicPacketCreator::HasRoomForStreamFrame(QuicStreamId id,
// TODO(jri): This is a simple safe decision for now, but make
// is_in_fec_group a parameter. Same as with all public methods in
// QuicPacketCreator.
- InFecGroup is_in_fec_group = options_.max_packets_per_fec_group == 0 ?
- NOT_IN_FEC_GROUP : IN_FEC_GROUP;
return BytesFree() >
QuicFramer::GetMinStreamFrameSize(framer_->version(), id, offset, true,
- is_in_fec_group);
+ IsFecEnabled());
}
// static
@@ -277,6 +273,12 @@ size_t QuicPacketCreator::BytesFree() const {
+ ExpansionOnNewFrame());
}
+InFecGroup QuicPacketCreator::IsFecEnabled() const {
+ return (framer_->version() == QUIC_VERSION_13 ||
+ options_.max_packets_per_fec_group == 0) ?
+ NOT_IN_FEC_GROUP : IN_FEC_GROUP;
+}
+
size_t QuicPacketCreator::PacketSize() const {
if (queued_frames_.empty()) {
// Only adjust the sequence number length when the FEC group is not open,
@@ -288,8 +290,7 @@ size_t QuicPacketCreator::PacketSize() const {
packet_size_ = GetPacketHeaderSize(options_.send_connection_id_length,
send_version_in_packet_,
sequence_number_length_,
- options_.max_packets_per_fec_group == 0 ?
- NOT_IN_FEC_GROUP : IN_FEC_GROUP);
+ IsFecEnabled());
}
return packet_size_;
}
@@ -333,7 +334,12 @@ SerializedPacket QuicPacketCreator::SerializePacket() {
}
SerializedPacket QuicPacketCreator::SerializeFec() {
- DCHECK_LT(0u, fec_group_->NumReceivedPackets());
+ if (fec_group_.get() == NULL || fec_group_->NumReceivedPackets() <= 0) {
+ LOG(DFATAL) << "SerializeFEC called but no group or zero packets in group.";
+ // TODO(jri): Make this a public method of framer?
+ SerializedPacket kNoPacket(0, PACKET_1BYTE_SEQUENCE_NUMBER, NULL, 0, NULL);
+ return kNoPacket;
+ }
DCHECK_EQ(0u, queued_frames_.size());
QuicPacketHeader header;
FillPacketHeader(fec_group_number_, true, &header);
« no previous file with comments | « net/quic/quic_packet_creator.h ('k') | net/quic/quic_packet_creator_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698