OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/quic/quic_packet_creator.h" | 5 #include "net/quic/quic_packet_creator.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 } | 187 } |
188 | 188 |
189 InFecGroup QuicPacketCreator::MaybeUpdateLengthsAndStartFec() { | 189 InFecGroup QuicPacketCreator::MaybeUpdateLengthsAndStartFec() { |
190 if (fec_group_.get() != nullptr) { | 190 if (fec_group_.get() != nullptr) { |
191 // Don't update any lengths when an FEC group is open, to ensure same | 191 // Don't update any lengths when an FEC group is open, to ensure same |
192 // packet header size in all packets within a group. | 192 // packet header size in all packets within a group. |
193 return IN_FEC_GROUP; | 193 return IN_FEC_GROUP; |
194 } | 194 } |
195 if (!queued_frames_.empty()) { | 195 if (!queued_frames_.empty()) { |
196 // Don't change creator state if there are frames queued. | 196 // Don't change creator state if there are frames queued. |
197 return fec_group_.get() == nullptr ? NOT_IN_FEC_GROUP : IN_FEC_GROUP; | 197 return NOT_IN_FEC_GROUP; |
198 } | 198 } |
199 | 199 |
200 // Update sequence number length only on packet and FEC group boundaries. | 200 // Update sequence number length only on packet and FEC group boundaries. |
201 sequence_number_length_ = next_sequence_number_length_; | 201 sequence_number_length_ = next_sequence_number_length_; |
202 | 202 |
203 if (!should_fec_protect_) { | 203 if (!should_fec_protect_) { |
204 return NOT_IN_FEC_GROUP; | 204 return NOT_IN_FEC_GROUP; |
205 } | 205 } |
206 // Start a new FEC group since protection is on. Set the fec group number to | 206 // Start a new FEC group since protection is on. Set the fec group number to |
207 // the sequence number of the next packet. | 207 // the sequence number of the next packet. |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 // Don't pad full packets. | 616 // Don't pad full packets. |
617 return; | 617 return; |
618 } | 618 } |
619 | 619 |
620 QuicPaddingFrame padding; | 620 QuicPaddingFrame padding; |
621 bool success = AddFrame(QuicFrame(&padding), false, false, nullptr); | 621 bool success = AddFrame(QuicFrame(&padding), false, false, nullptr); |
622 DCHECK(success); | 622 DCHECK(success); |
623 } | 623 } |
624 | 624 |
625 } // namespace net | 625 } // namespace net |
OLD | NEW |