Index: net/quic/quic_packet_generator.cc |
diff --git a/net/quic/quic_packet_generator.cc b/net/quic/quic_packet_generator.cc |
index 782fa355688e8984146b788d36315e3c2a8c9dc8..175f555f9843d247762bf731e711e62768300f5b 100644 |
--- a/net/quic/quic_packet_generator.cc |
+++ b/net/quic/quic_packet_generator.cc |
@@ -93,6 +93,7 @@ QuicConsumedData QuicPacketGenerator::ConsumeData(QuicStreamId id, |
const IOVector& data_to_write, |
QuicStreamOffset offset, |
bool fin, |
+ FecProtection fec_protection, |
QuicAckNotifier* notifier) { |
IsHandshake handshake = id == kCryptoStreamId ? IS_HANDSHAKE : NOT_HANDSHAKE; |
SendQueuedFrames(false); |
@@ -104,6 +105,10 @@ QuicConsumedData QuicPacketGenerator::ConsumeData(QuicStreamId id, |
SerializeAndSendPacket(); |
} |
+ if (fec_protection == MUST_FEC_PROTECT) { |
+ MaybeStartFecProtection(); |
+ } |
+ |
IOVector data = data_to_write; |
size_t data_size = data.TotalBufferSize(); |
while (delegate_->ShouldGeneratePacket(NOT_RETRANSMISSION, |
@@ -140,6 +145,11 @@ QuicConsumedData QuicPacketGenerator::ConsumeData(QuicStreamId id, |
// We're done writing the data. Exit the loop. |
// We don't make this a precondition because we could have 0 bytes of data |
// if we're simply writing a fin. |
+ if (fec_protection == MUST_FEC_PROTECT) { |
+ // Turn off FEC protection when we're done writing protected data. |
+ DVLOG(1) << "Turning FEC protection OFF"; |
+ should_fec_protect_ = false; |
+ } |
break; |
} |
} |
@@ -206,13 +216,6 @@ void QuicPacketGenerator::MaybeStartFecProtection() { |
DCHECK(packet_creator_->IsFecProtected()); |
} |
-void QuicPacketGenerator::MaybeStopFecProtection(bool force) { |
- DVLOG(1) << "Turning FEC protection OFF"; |
- // FEC protection will stop after the next FEC packet is transmitted. |
- should_fec_protect_ = false; |
- MaybeSendFecPacketAndCloseGroup(force); |
-} |
- |
void QuicPacketGenerator::MaybeSendFecPacketAndCloseGroup(bool force) { |
if (!packet_creator_->IsFecProtected() || |
packet_creator_->HasPendingFrames()) { |