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 // Accumulates frames for the next packet until more frames no longer fit or | 5 // Accumulates frames for the next packet until more frames no longer fit or |
6 // it's time to create a packet from them. Also provides packet creation of | 6 // it's time to create a packet from them. Also provides packet creation of |
7 // FEC packets based on previously created packets. | 7 // FEC packets based on previously created packets. |
8 | 8 |
9 #ifndef NET_QUIC_QUIC_PACKET_CREATOR_H_ | 9 #ifndef NET_QUIC_QUIC_PACKET_CREATOR_H_ |
10 #define NET_QUIC_QUIC_PACKET_CREATOR_H_ | 10 #define NET_QUIC_QUIC_PACKET_CREATOR_H_ |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 SerializedPacket ReserializeAllFrames( | 100 SerializedPacket ReserializeAllFrames( |
101 const QuicFrames& frames, | 101 const QuicFrames& frames, |
102 QuicSequenceNumberLength original_length); | 102 QuicSequenceNumberLength original_length); |
103 | 103 |
104 // Returns true if there are frames pending to be serialized. | 104 // Returns true if there are frames pending to be serialized. |
105 bool HasPendingFrames() const; | 105 bool HasPendingFrames() const; |
106 | 106 |
107 // Returns true if there are retransmittable frames pending to be serialized. | 107 // Returns true if there are retransmittable frames pending to be serialized. |
108 bool HasPendingRetransmittableFrames() const; | 108 bool HasPendingRetransmittableFrames() const; |
109 | 109 |
| 110 // TODO(jri): Remove this method. |
110 // Returns whether FEC protection is currently enabled. Note: Enabled does not | 111 // Returns whether FEC protection is currently enabled. Note: Enabled does not |
111 // mean that an FEC group is currently active; i.e., IsFecProtected() may | 112 // mean that an FEC group is currently active; i.e., IsFecProtected() may |
112 // still return false. | 113 // still return false. |
113 bool IsFecEnabled() const; | 114 bool IsFecEnabled() const; |
114 | 115 |
115 // Returns true if subsequent packets will be FEC protected. Note: True does | 116 // Returns true if subsequent packets will be FEC protected. Note: True does |
116 // not mean that an FEC packet is currently under construction; i.e., | 117 // not mean that an FEC packet is currently under construction; i.e., |
117 // fec_group_.get() may still be nullptr, until MaybeStartFec() is called. | 118 // fec_group_.get() may still be nullptr, until MaybeStartFec() is called. |
118 bool IsFecProtected() const; | 119 bool IsFecProtected() const; |
119 | 120 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 size_t max_packets_per_fec_group() const { | 216 size_t max_packets_per_fec_group() const { |
216 return max_packets_per_fec_group_; | 217 return max_packets_per_fec_group_; |
217 } | 218 } |
218 | 219 |
219 // Sets creator's max number of packets covered by an FEC group. | 220 // Sets creator's max number of packets covered by an FEC group. |
220 // Note: While there are no constraints on |max_packets_per_fec_group|, | 221 // Note: While there are no constraints on |max_packets_per_fec_group|, |
221 // this setter enforces a min value of kLowestMaxPacketsPerFecGroup. | 222 // this setter enforces a min value of kLowestMaxPacketsPerFecGroup. |
222 // To turn off FEC protection, use StopFecProtectingPackets(). | 223 // To turn off FEC protection, use StopFecProtectingPackets(). |
223 void set_max_packets_per_fec_group(size_t max_packets_per_fec_group); | 224 void set_max_packets_per_fec_group(size_t max_packets_per_fec_group); |
224 | 225 |
| 226 // Returns the currently open FEC group's number. If there isn't an open FEC |
| 227 // group, returns the last closed FEC group number. Returns 0 when FEC is |
| 228 // disabled or no FEC group has been created yet. |
| 229 QuicFecGroupNumber fec_group_number() { return fec_group_number_; } |
| 230 |
225 private: | 231 private: |
226 friend class test::QuicPacketCreatorPeer; | 232 friend class test::QuicPacketCreatorPeer; |
227 | 233 |
228 static bool ShouldRetransmit(const QuicFrame& frame); | 234 static bool ShouldRetransmit(const QuicFrame& frame); |
229 | 235 |
230 // Updates sequence number and max packet lengths on a packet or FEC group | 236 // Updates sequence number and max packet lengths on a packet or FEC group |
231 // boundary. | 237 // boundary. |
232 void MaybeUpdateLengths(); | 238 void MaybeUpdateLengths(); |
233 | 239 |
234 // Updates lengths and also starts an FEC group if FEC protection is on and | 240 // Updates lengths and also starts an FEC group if FEC protection is on and |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 mutable size_t packet_size_; | 286 mutable size_t packet_size_; |
281 QuicFrames queued_frames_; | 287 QuicFrames queued_frames_; |
282 scoped_ptr<RetransmittableFrames> queued_retransmittable_frames_; | 288 scoped_ptr<RetransmittableFrames> queued_retransmittable_frames_; |
283 | 289 |
284 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator); | 290 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator); |
285 }; | 291 }; |
286 | 292 |
287 } // namespace net | 293 } // namespace net |
288 | 294 |
289 #endif // NET_QUIC_QUIC_PACKET_CREATOR_H_ | 295 #endif // NET_QUIC_QUIC_PACKET_CREATOR_H_ |
OLD | NEW |