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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "net/quic/crypto/quic_random.h" | 9 #include "net/quic/crypto/quic_random.h" |
10 #include "net/quic/quic_ack_notifier.h" | 10 #include "net/quic/quic_ack_notifier.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 QuicPacketCreator::QuicPacketCreator(QuicConnectionId connection_id, | 58 QuicPacketCreator::QuicPacketCreator(QuicConnectionId connection_id, |
59 QuicFramer* framer, | 59 QuicFramer* framer, |
60 QuicRandom* random_generator, | 60 QuicRandom* random_generator, |
61 bool is_server) | 61 bool is_server) |
62 : connection_id_(connection_id), | 62 : connection_id_(connection_id), |
63 encryption_level_(ENCRYPTION_NONE), | 63 encryption_level_(ENCRYPTION_NONE), |
64 framer_(framer), | 64 framer_(framer), |
65 random_bool_source_(new QuicRandomBoolSource(random_generator)), | 65 random_bool_source_(new QuicRandomBoolSource(random_generator)), |
66 sequence_number_(0), | 66 sequence_number_(0), |
| 67 should_fec_protect_(false), |
67 fec_group_number_(0), | 68 fec_group_number_(0), |
68 is_server_(is_server), | 69 is_server_(is_server), |
69 send_version_in_packet_(!is_server), | 70 send_version_in_packet_(!is_server), |
70 sequence_number_length_(options_.send_sequence_number_length), | 71 sequence_number_length_(options_.send_sequence_number_length), |
71 packet_size_(0) { | 72 packet_size_(0) { |
72 framer_->set_fec_builder(this); | 73 framer_->set_fec_builder(this); |
73 } | 74 } |
74 | 75 |
75 QuicPacketCreator::~QuicPacketCreator() { | 76 QuicPacketCreator::~QuicPacketCreator() { |
76 } | 77 } |
77 | 78 |
78 void QuicPacketCreator::OnBuiltFecProtectedPayload( | 79 void QuicPacketCreator::OnBuiltFecProtectedPayload( |
79 const QuicPacketHeader& header, StringPiece payload) { | 80 const QuicPacketHeader& header, StringPiece payload) { |
80 if (fec_group_.get()) { | 81 if (fec_group_.get()) { |
81 DCHECK_NE(0u, header.fec_group); | 82 DCHECK_NE(0u, header.fec_group); |
82 fec_group_->Update(encryption_level_, header, payload); | 83 fec_group_->Update(encryption_level_, header, payload); |
83 } | 84 } |
84 } | 85 } |
85 | 86 |
86 bool QuicPacketCreator::ShouldSendFec(bool force_close) const { | 87 bool QuicPacketCreator::ShouldSendFec(bool force_close) const { |
87 return fec_group_.get() != NULL && fec_group_->NumReceivedPackets() > 0 && | 88 return fec_group_.get() != NULL && fec_group_->NumReceivedPackets() > 0 && |
88 (force_close || | 89 (force_close || fec_group_->NumReceivedPackets() >= |
89 fec_group_->NumReceivedPackets() >= options_.max_packets_per_fec_group); | 90 options_.max_packets_per_fec_group); |
90 } | 91 } |
91 | 92 |
92 InFecGroup QuicPacketCreator::MaybeStartFEC() { | 93 void QuicPacketCreator::StartFecProtectingPackets() { |
93 if (IsFecEnabled() && fec_group_.get() == NULL) { | 94 if (!IsFecEnabled()) { |
| 95 LOG(DFATAL) << "Cannot start FEC protection when FEC is not enabled."; |
| 96 return; |
| 97 } |
| 98 // TODO(jri): This currently requires that the generator flush out any |
| 99 // pending frames when FEC protection is turned on. If current packet can be |
| 100 // converted to an FEC protected packet, do it. This will require the |
| 101 // generator to check if the resulting expansion still allows the incoming |
| 102 // frame to be added to the packet. |
| 103 if (HasPendingFrames()) { |
| 104 LOG(DFATAL) << "Cannot start FEC protection with pending frames."; |
| 105 return; |
| 106 } |
| 107 DCHECK(!should_fec_protect_); |
| 108 should_fec_protect_ = true; |
| 109 } |
| 110 |
| 111 void QuicPacketCreator::StopFecProtectingPackets() { |
| 112 if (fec_group_.get() != NULL) { |
| 113 LOG(DFATAL) << "Cannot stop FEC protection with open FEC group."; |
| 114 return; |
| 115 } |
| 116 DCHECK(should_fec_protect_); |
| 117 should_fec_protect_ = false; |
| 118 fec_group_number_ = 0; |
| 119 } |
| 120 |
| 121 bool QuicPacketCreator::IsFecProtected() const { |
| 122 return should_fec_protect_; |
| 123 } |
| 124 |
| 125 bool QuicPacketCreator::IsFecEnabled() const { |
| 126 return options_.max_packets_per_fec_group > 0; |
| 127 } |
| 128 |
| 129 size_t QuicPacketCreator::max_packets_per_fec_group() const { |
| 130 return options_.max_packets_per_fec_group; |
| 131 } |
| 132 |
| 133 void QuicPacketCreator::set_max_packets_per_fec_group( |
| 134 size_t max_packets_per_fec_group) { |
| 135 // To turn off FEC protection, use StopFecProtectingPackets(). |
| 136 DCHECK_NE(0u, max_packets_per_fec_group); |
| 137 options_.max_packets_per_fec_group = max_packets_per_fec_group; |
| 138 } |
| 139 |
| 140 InFecGroup QuicPacketCreator::MaybeStartFec() { |
| 141 if (should_fec_protect_ && fec_group_.get() == NULL) { |
94 DCHECK(queued_frames_.empty()); | 142 DCHECK(queued_frames_.empty()); |
95 // Set the fec group number to the sequence number of the next packet. | 143 // Set the fec group number to the sequence number of the next packet. |
96 fec_group_number_ = sequence_number() + 1; | 144 fec_group_number_ = sequence_number() + 1; |
97 fec_group_.reset(new QuicFecGroup()); | 145 fec_group_.reset(new QuicFecGroup()); |
98 } | 146 } |
99 return fec_group_.get() == NULL ? NOT_IN_FEC_GROUP : IN_FEC_GROUP; | 147 return fec_group_.get() == NULL ? NOT_IN_FEC_GROUP : IN_FEC_GROUP; |
100 } | 148 } |
101 | 149 |
102 // Stops serializing version of the protocol in packets sent after this call. | 150 // Stops serializing version of the protocol in packets sent after this call. |
103 // A packet that is already open might send kQuicVersionSize bytes less than the | 151 // A packet that is already open might send kQuicVersionSize bytes less than the |
(...skipping 23 matching lines...) Expand all Loading... |
127 QuicFramer::GetMinSequenceNumberLength(delta * 4); | 175 QuicFramer::GetMinSequenceNumberLength(delta * 4); |
128 } | 176 } |
129 | 177 |
130 bool QuicPacketCreator::HasRoomForStreamFrame(QuicStreamId id, | 178 bool QuicPacketCreator::HasRoomForStreamFrame(QuicStreamId id, |
131 QuicStreamOffset offset) const { | 179 QuicStreamOffset offset) const { |
132 // TODO(jri): This is a simple safe decision for now, but make | 180 // TODO(jri): This is a simple safe decision for now, but make |
133 // is_in_fec_group a parameter. Same as with all public methods in | 181 // is_in_fec_group a parameter. Same as with all public methods in |
134 // QuicPacketCreator. | 182 // QuicPacketCreator. |
135 return BytesFree() > | 183 return BytesFree() > |
136 QuicFramer::GetMinStreamFrameSize(framer_->version(), id, offset, true, | 184 QuicFramer::GetMinStreamFrameSize(framer_->version(), id, offset, true, |
137 IsFecEnabled()); | 185 should_fec_protect_ ? IN_FEC_GROUP : |
| 186 NOT_IN_FEC_GROUP); |
138 } | 187 } |
139 | 188 |
140 // static | 189 // static |
141 size_t QuicPacketCreator::StreamFramePacketOverhead( | 190 size_t QuicPacketCreator::StreamFramePacketOverhead( |
142 QuicVersion version, | 191 QuicVersion version, |
143 QuicConnectionIdLength connection_id_length, | 192 QuicConnectionIdLength connection_id_length, |
144 bool include_version, | 193 bool include_version, |
145 QuicSequenceNumberLength sequence_number_length, | 194 QuicSequenceNumberLength sequence_number_length, |
146 InFecGroup is_in_fec_group) { | 195 InFecGroup is_in_fec_group) { |
147 return GetPacketHeaderSize(connection_id_length, include_version, | 196 return GetPacketHeaderSize(connection_id_length, include_version, |
148 sequence_number_length, is_in_fec_group) + | 197 sequence_number_length, is_in_fec_group) + |
149 // Assumes this is a stream with a single lone packet. | 198 // Assumes this is a stream with a single lone packet. |
150 QuicFramer::GetMinStreamFrameSize(version, 1u, 0u, true, is_in_fec_group); | 199 QuicFramer::GetMinStreamFrameSize(version, 1u, 0u, true, is_in_fec_group); |
151 } | 200 } |
152 | 201 |
153 size_t QuicPacketCreator::CreateStreamFrame(QuicStreamId id, | 202 size_t QuicPacketCreator::CreateStreamFrame(QuicStreamId id, |
154 const IOVector& data, | 203 const IOVector& data, |
155 QuicStreamOffset offset, | 204 QuicStreamOffset offset, |
156 bool fin, | 205 bool fin, |
157 QuicFrame* frame) { | 206 QuicFrame* frame) { |
158 DCHECK_GT(options_.max_packet_length, | 207 DCHECK_GT(options_.max_packet_length, |
159 StreamFramePacketOverhead( | 208 StreamFramePacketOverhead( |
160 framer_->version(), PACKET_8BYTE_CONNECTION_ID, kIncludeVersion, | 209 framer_->version(), PACKET_8BYTE_CONNECTION_ID, kIncludeVersion, |
161 PACKET_6BYTE_SEQUENCE_NUMBER, IN_FEC_GROUP)); | 210 PACKET_6BYTE_SEQUENCE_NUMBER, IN_FEC_GROUP)); |
162 InFecGroup is_in_fec_group = MaybeStartFEC(); | 211 |
| 212 InFecGroup is_in_fec_group = MaybeStartFec(); |
163 | 213 |
164 LOG_IF(DFATAL, !HasRoomForStreamFrame(id, offset)) | 214 LOG_IF(DFATAL, !HasRoomForStreamFrame(id, offset)) |
165 << "No room for Stream frame, BytesFree: " << BytesFree() | 215 << "No room for Stream frame, BytesFree: " << BytesFree() |
166 << " MinStreamFrameSize: " | 216 << " MinStreamFrameSize: " |
167 << QuicFramer::GetMinStreamFrameSize( | 217 << QuicFramer::GetMinStreamFrameSize( |
168 framer_->version(), id, offset, true, is_in_fec_group); | 218 framer_->version(), id, offset, true, is_in_fec_group); |
169 | 219 |
170 if (data.Empty()) { | 220 if (data.Empty()) { |
171 LOG_IF(DFATAL, !fin) | 221 LOG_IF(DFATAL, !fin) |
172 << "Creating a stream frame with no data or fin."; | 222 << "Creating a stream frame with no data or fin."; |
(...skipping 30 matching lines...) Expand all Loading... |
203 // a packet. At that point the notifier is informed of the sequence number | 253 // a packet. At that point the notifier is informed of the sequence number |
204 // of the packet that this frame was eventually sent in. | 254 // of the packet that this frame was eventually sent in. |
205 frame->stream_frame->notifier = notifier; | 255 frame->stream_frame->notifier = notifier; |
206 | 256 |
207 return bytes_consumed; | 257 return bytes_consumed; |
208 } | 258 } |
209 | 259 |
210 SerializedPacket QuicPacketCreator::ReserializeAllFrames( | 260 SerializedPacket QuicPacketCreator::ReserializeAllFrames( |
211 const QuicFrames& frames, | 261 const QuicFrames& frames, |
212 QuicSequenceNumberLength original_length) { | 262 QuicSequenceNumberLength original_length) { |
213 const QuicSequenceNumberLength start_length = sequence_number_length_; | 263 DCHECK(fec_group_.get() == NULL); |
214 const QuicSequenceNumberLength start_options_length = | 264 const QuicSequenceNumberLength saved_length = sequence_number_length_; |
| 265 const QuicSequenceNumberLength saved_options_length = |
215 options_.send_sequence_number_length; | 266 options_.send_sequence_number_length; |
216 const QuicFecGroupNumber start_fec_group = fec_group_number_; | 267 const bool saved_should_fec_protect = should_fec_protect_; |
217 const size_t start_max_packets_per_fec_group = | |
218 options_.max_packets_per_fec_group; | |
219 | 268 |
220 // Temporarily set the sequence number length and disable FEC. | 269 // Temporarily set the sequence number length and stop FEC protection. |
221 sequence_number_length_ = original_length; | 270 sequence_number_length_ = original_length; |
222 options_.send_sequence_number_length = original_length; | 271 options_.send_sequence_number_length = original_length; |
223 fec_group_number_ = 0; | 272 should_fec_protect_ = false; |
224 options_.max_packets_per_fec_group = 0; | |
225 | 273 |
226 // Serialize the packet and restore the fec and sequence number length state. | 274 // Serialize the packet and restore the FEC and sequence number length state. |
227 SerializedPacket serialized_packet = SerializeAllFrames(frames); | 275 SerializedPacket serialized_packet = SerializeAllFrames(frames); |
228 sequence_number_length_ = start_length; | 276 sequence_number_length_ = saved_length; |
229 options_.send_sequence_number_length = start_options_length; | 277 options_.send_sequence_number_length = saved_options_length; |
230 fec_group_number_ = start_fec_group; | 278 should_fec_protect_ = saved_should_fec_protect; |
231 options_.max_packets_per_fec_group = start_max_packets_per_fec_group; | |
232 | 279 |
233 return serialized_packet; | 280 return serialized_packet; |
234 } | 281 } |
235 | 282 |
236 SerializedPacket QuicPacketCreator::SerializeAllFrames( | 283 SerializedPacket QuicPacketCreator::SerializeAllFrames( |
237 const QuicFrames& frames) { | 284 const QuicFrames& frames) { |
238 // TODO(satyamshekhar): Verify that this DCHECK won't fail. What about queued | 285 // TODO(satyamshekhar): Verify that this DCHECK won't fail. What about queued |
239 // frames from SendStreamData()[send_stream_should_flush_ == false && | 286 // frames from SendStreamData()[send_stream_should_flush_ == false && |
240 // data.empty() == true] and retransmit due to RTO. | 287 // data.empty() == true] and retransmit due to RTO. |
241 DCHECK_EQ(0u, queued_frames_.size()); | 288 DCHECK_EQ(0u, queued_frames_.size()); |
242 LOG_IF(DFATAL, frames.empty()) | 289 LOG_IF(DFATAL, frames.empty()) |
243 << "Attempt to serialize empty packet"; | 290 << "Attempt to serialize empty packet"; |
244 for (size_t i = 0; i < frames.size(); ++i) { | 291 for (size_t i = 0; i < frames.size(); ++i) { |
245 bool success = AddFrame(frames[i], false); | 292 bool success = AddFrame(frames[i], false); |
246 DCHECK(success); | 293 DCHECK(success); |
247 } | 294 } |
248 SerializedPacket packet = SerializePacket(); | 295 SerializedPacket packet = SerializePacket(); |
249 DCHECK(packet.retransmittable_frames == NULL); | 296 DCHECK(packet.retransmittable_frames == NULL); |
250 return packet; | 297 return packet; |
251 } | 298 } |
252 | 299 |
253 bool QuicPacketCreator::HasPendingFrames() { | 300 bool QuicPacketCreator::HasPendingFrames() { |
254 return !queued_frames_.empty(); | 301 return !queued_frames_.empty(); |
255 } | 302 } |
256 | 303 |
257 size_t QuicPacketCreator::ExpansionOnNewFrame() const { | 304 size_t QuicPacketCreator::ExpansionOnNewFrame() const { |
258 // If packet is FEC protected, there's no expansion. | 305 // If packet is FEC protected, there's no expansion. |
259 if (fec_group_.get() != NULL) { | 306 if (should_fec_protect_) { |
260 return 0; | 307 return 0; |
261 } | 308 } |
262 // If the last frame in the packet is a stream frame, then it will expand to | 309 // If the last frame in the packet is a stream frame, then it will expand to |
263 // include the stream_length field when a new frame is added. | 310 // include the stream_length field when a new frame is added. |
264 bool has_trailing_stream_frame = | 311 bool has_trailing_stream_frame = |
265 !queued_frames_.empty() && queued_frames_.back().type == STREAM_FRAME; | 312 !queued_frames_.empty() && queued_frames_.back().type == STREAM_FRAME; |
266 return has_trailing_stream_frame ? kQuicStreamPayloadLengthSize : 0; | 313 return has_trailing_stream_frame ? kQuicStreamPayloadLengthSize : 0; |
267 } | 314 } |
268 | 315 |
269 size_t QuicPacketCreator::BytesFree() const { | 316 size_t QuicPacketCreator::BytesFree() const { |
270 const size_t max_plaintext_size = | 317 const size_t max_plaintext_size = |
271 framer_->GetMaxPlaintextSize(options_.max_packet_length); | 318 framer_->GetMaxPlaintextSize(options_.max_packet_length); |
272 DCHECK_GE(max_plaintext_size, PacketSize()); | 319 DCHECK_GE(max_plaintext_size, PacketSize()); |
273 return max_plaintext_size - min(max_plaintext_size, PacketSize() | 320 return max_plaintext_size - min(max_plaintext_size, PacketSize() |
274 + ExpansionOnNewFrame()); | 321 + ExpansionOnNewFrame()); |
275 } | 322 } |
276 | 323 |
277 InFecGroup QuicPacketCreator::IsFecEnabled() const { | |
278 return (options_.max_packets_per_fec_group == 0) ? | |
279 NOT_IN_FEC_GROUP : IN_FEC_GROUP; | |
280 } | |
281 | |
282 size_t QuicPacketCreator::PacketSize() const { | 324 size_t QuicPacketCreator::PacketSize() const { |
283 if (queued_frames_.empty()) { | 325 if (queued_frames_.empty()) { |
284 // Only adjust the sequence number length when the FEC group is not open, | 326 // Only adjust the sequence number length when the FEC group is not open, |
285 // to ensure no packets in a group are too large. | 327 // to ensure no packets in a group are too large. |
286 if (fec_group_.get() == NULL || | 328 if (fec_group_.get() == NULL || |
287 fec_group_->NumReceivedPackets() == 0) { | 329 fec_group_->NumReceivedPackets() == 0) { |
288 sequence_number_length_ = options_.send_sequence_number_length; | 330 sequence_number_length_ = options_.send_sequence_number_length; |
289 } | 331 } |
290 packet_size_ = GetPacketHeaderSize(options_.send_connection_id_length, | 332 packet_size_ = GetPacketHeaderSize(options_.send_connection_id_length, |
291 send_version_in_packet_, | 333 send_version_in_packet_, |
292 sequence_number_length_, | 334 sequence_number_length_, |
293 IsFecEnabled()); | 335 should_fec_protect_ ? IN_FEC_GROUP : |
| 336 NOT_IN_FEC_GROUP); |
294 } | 337 } |
295 return packet_size_; | 338 return packet_size_; |
296 } | 339 } |
297 | 340 |
298 bool QuicPacketCreator::AddSavedFrame(const QuicFrame& frame) { | 341 bool QuicPacketCreator::AddSavedFrame(const QuicFrame& frame) { |
299 return AddFrame(frame, true); | 342 return AddFrame(frame, true); |
300 } | 343 } |
301 | 344 |
302 SerializedPacket QuicPacketCreator::SerializePacket() { | 345 SerializedPacket QuicPacketCreator::SerializePacket() { |
303 LOG_IF(DFATAL, queued_frames_.empty()) | 346 LOG_IF(DFATAL, queued_frames_.empty()) |
304 << "Attempt to serialize empty packet"; | 347 << "Attempt to serialize empty packet"; |
| 348 DCHECK_GE(sequence_number_ + 1, fec_group_number_); |
305 QuicPacketHeader header; | 349 QuicPacketHeader header; |
306 FillPacketHeader(fec_group_number_, false, &header); | 350 FillPacketHeader(should_fec_protect_ ? fec_group_number_ : 0, false, &header); |
307 | 351 |
308 MaybeAddPadding(); | 352 MaybeAddPadding(); |
309 | 353 |
310 size_t max_plaintext_size = | 354 size_t max_plaintext_size = |
311 framer_->GetMaxPlaintextSize(options_.max_packet_length); | 355 framer_->GetMaxPlaintextSize(options_.max_packet_length); |
312 DCHECK_GE(max_plaintext_size, packet_size_); | 356 DCHECK_GE(max_plaintext_size, packet_size_); |
313 // ACK and CONNECTION_CLOSE Frames will be truncated only if they're | 357 // ACK and CONNECTION_CLOSE Frames will be truncated only if they're |
314 // the first frame in the packet. If truncation is to occur, then | 358 // the first frame in the packet. If truncation is to occur, then |
315 // GetSerializedFrameLength will have returned all bytes free. | 359 // GetSerializedFrameLength will have returned all bytes free. |
316 bool possibly_truncated = | 360 bool possibly_truncated = |
(...skipping 24 matching lines...) Expand all Loading... |
341 return kNoPacket; | 385 return kNoPacket; |
342 } | 386 } |
343 DCHECK_EQ(0u, queued_frames_.size()); | 387 DCHECK_EQ(0u, queued_frames_.size()); |
344 QuicPacketHeader header; | 388 QuicPacketHeader header; |
345 FillPacketHeader(fec_group_number_, true, &header); | 389 FillPacketHeader(fec_group_number_, true, &header); |
346 QuicFecData fec_data; | 390 QuicFecData fec_data; |
347 fec_data.fec_group = fec_group_->min_protected_packet(); | 391 fec_data.fec_group = fec_group_->min_protected_packet(); |
348 fec_data.redundancy = fec_group_->payload_parity(); | 392 fec_data.redundancy = fec_group_->payload_parity(); |
349 SerializedPacket serialized = framer_->BuildFecPacket(header, fec_data); | 393 SerializedPacket serialized = framer_->BuildFecPacket(header, fec_data); |
350 fec_group_.reset(NULL); | 394 fec_group_.reset(NULL); |
351 fec_group_number_ = 0; | |
352 packet_size_ = 0; | 395 packet_size_ = 0; |
353 LOG_IF(DFATAL, !serialized.packet) | 396 LOG_IF(DFATAL, !serialized.packet) |
354 << "Failed to serialize fec packet for group:" << fec_data.fec_group; | 397 << "Failed to serialize fec packet for group:" << fec_data.fec_group; |
355 DCHECK_GE(options_.max_packet_length, serialized.packet->length()); | 398 DCHECK_GE(options_.max_packet_length, serialized.packet->length()); |
356 return serialized; | 399 return serialized; |
357 } | 400 } |
358 | 401 |
359 SerializedPacket QuicPacketCreator::SerializeConnectionClose( | 402 SerializedPacket QuicPacketCreator::SerializeConnectionClose( |
360 QuicConnectionCloseFrame* close_frame) { | 403 QuicConnectionCloseFrame* close_frame) { |
361 QuicFrames frames; | 404 QuicFrames frames; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 case STOP_WAITING_FRAME: | 443 case STOP_WAITING_FRAME: |
401 return false; | 444 return false; |
402 default: | 445 default: |
403 return true; | 446 return true; |
404 } | 447 } |
405 } | 448 } |
406 | 449 |
407 bool QuicPacketCreator::AddFrame(const QuicFrame& frame, | 450 bool QuicPacketCreator::AddFrame(const QuicFrame& frame, |
408 bool save_retransmittable_frames) { | 451 bool save_retransmittable_frames) { |
409 DVLOG(1) << "Adding frame: " << frame; | 452 DVLOG(1) << "Adding frame: " << frame; |
410 InFecGroup is_in_fec_group = MaybeStartFEC(); | 453 InFecGroup is_in_fec_group = MaybeStartFec(); |
411 size_t frame_len = framer_->GetSerializedFrameLength( | 454 size_t frame_len = framer_->GetSerializedFrameLength( |
412 frame, BytesFree(), queued_frames_.empty(), true, is_in_fec_group, | 455 frame, BytesFree(), queued_frames_.empty(), true, is_in_fec_group, |
413 options()->send_sequence_number_length); | 456 options()->send_sequence_number_length); |
414 if (frame_len == 0) { | 457 if (frame_len == 0) { |
415 return false; | 458 return false; |
416 } | 459 } |
417 DCHECK_LT(0u, packet_size_); | 460 DCHECK_LT(0u, packet_size_); |
418 packet_size_ += ExpansionOnNewFrame() + frame_len; | 461 packet_size_ += ExpansionOnNewFrame() + frame_len; |
419 | 462 |
420 if (save_retransmittable_frames && ShouldRetransmit(frame)) { | 463 if (save_retransmittable_frames && ShouldRetransmit(frame)) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 if (!is_handshake) { | 496 if (!is_handshake) { |
454 return; | 497 return; |
455 } | 498 } |
456 | 499 |
457 QuicPaddingFrame padding; | 500 QuicPaddingFrame padding; |
458 bool success = AddFrame(QuicFrame(&padding), false); | 501 bool success = AddFrame(QuicFrame(&padding), false); |
459 DCHECK(success); | 502 DCHECK(success); |
460 } | 503 } |
461 | 504 |
462 } // namespace net | 505 } // namespace net |
OLD | NEW |