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. If multipath enabled, only | 7 // FEC packets based on previously created packets. If multipath enabled, only |
8 // creates packets on one path at the same time. Currently, next packet number | 8 // creates packets on one path at the same time. Currently, next packet number |
9 // is tracked per-path. | 9 // is tracked per-path. |
10 | 10 |
11 #ifndef NET_QUIC_QUIC_PACKET_CREATOR_H_ | 11 #ifndef NET_QUIC_QUIC_PACKET_CREATOR_H_ |
12 #define NET_QUIC_QUIC_PACKET_CREATOR_H_ | 12 #define NET_QUIC_QUIC_PACKET_CREATOR_H_ |
13 | 13 |
14 #include <stddef.h> | 14 #include <stddef.h> |
15 | 15 |
16 #include <string> | 16 #include <string> |
| 17 #include <unordered_map> |
17 #include <utility> | 18 #include <utility> |
18 #include <vector> | 19 #include <vector> |
19 | 20 |
20 #include "base/macros.h" | 21 #include "base/macros.h" |
21 #include "base/memory/scoped_ptr.h" | 22 #include "base/memory/scoped_ptr.h" |
22 #include "base/strings/string_piece.h" | 23 #include "base/strings/string_piece.h" |
23 #include "net/quic/quic_fec_group.h" | 24 #include "net/quic/quic_fec_group.h" |
24 #include "net/quic/quic_framer.h" | 25 #include "net/quic/quic_framer.h" |
25 #include "net/quic/quic_protocol.h" | 26 #include "net/quic/quic_protocol.h" |
26 | 27 |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 // packet_size should never be read directly, use PacketSize() instead. | 383 // packet_size should never be read directly, use PacketSize() instead. |
383 // TODO(ianswett): Move packet_size_ into SerializedPacket once | 384 // TODO(ianswett): Move packet_size_ into SerializedPacket once |
384 // QuicEncryptedPacket has been flattened into SerializedPacket. | 385 // QuicEncryptedPacket has been flattened into SerializedPacket. |
385 size_t packet_size_; | 386 size_t packet_size_; |
386 QuicConnectionId connection_id_; | 387 QuicConnectionId connection_id_; |
387 | 388 |
388 // Packet used to invoke OnSerializedPacket. | 389 // Packet used to invoke OnSerializedPacket. |
389 SerializedPacket packet_; | 390 SerializedPacket packet_; |
390 | 391 |
391 // Map mapping path_id to last sent packet number on the path. | 392 // Map mapping path_id to last sent packet number on the path. |
392 hash_map<QuicPathId, QuicPacketNumber> multipath_packet_number_; | 393 std::unordered_map<QuicPathId, QuicPacketNumber> multipath_packet_number_; |
393 | 394 |
394 // FEC related fields. | 395 // FEC related fields. |
395 // True when creator is requested to turn on FEC protection. False otherwise. | 396 // True when creator is requested to turn on FEC protection. False otherwise. |
396 // There is a time difference between should_fec_protect_next_packet_ is | 397 // There is a time difference between should_fec_protect_next_packet_ is |
397 // true/false and FEC is actually turned on/off (e.g., The creator may have an | 398 // true/false and FEC is actually turned on/off (e.g., The creator may have an |
398 // open FEC group even if this variable is false). | 399 // open FEC group even if this variable is false). |
399 bool should_fec_protect_next_packet_; | 400 bool should_fec_protect_next_packet_; |
400 // If true, any created packets will be FEC protected. | 401 // If true, any created packets will be FEC protected. |
401 // TODO(fayang): Combine should_fec_protect_next_packet and fec_protect_ to | 402 // TODO(fayang): Combine should_fec_protect_next_packet and fec_protect_ to |
402 // one variable. | 403 // one variable. |
403 bool fec_protect_; | 404 bool fec_protect_; |
404 scoped_ptr<QuicFecGroup> fec_group_; | 405 scoped_ptr<QuicFecGroup> fec_group_; |
405 // 0 indicates FEC is disabled. | 406 // 0 indicates FEC is disabled. |
406 size_t max_packets_per_fec_group_; | 407 size_t max_packets_per_fec_group_; |
407 // FEC policy that specifies when to send FEC packet. | 408 // FEC policy that specifies when to send FEC packet. |
408 FecSendPolicy fec_send_policy_; | 409 FecSendPolicy fec_send_policy_; |
409 // Timeout used for FEC alarm. Can be set to zero initially or if the SRTT has | 410 // Timeout used for FEC alarm. Can be set to zero initially or if the SRTT has |
410 // not yet been set. | 411 // not yet been set. |
411 QuicTime::Delta fec_timeout_; | 412 QuicTime::Delta fec_timeout_; |
412 // The multiplication factor for FEC timeout based on RTT. | 413 // The multiplication factor for FEC timeout based on RTT. |
413 // TODO(rtenneti): Delete this code after the 0.25 RTT FEC experiment. | 414 // TODO(rtenneti): Delete this code after the 0.25 RTT FEC experiment. |
414 float rtt_multiplier_for_fec_timeout_; | 415 float rtt_multiplier_for_fec_timeout_; |
415 | 416 |
416 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator); | 417 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator); |
417 }; | 418 }; |
418 | 419 |
419 } // namespace net | 420 } // namespace net |
420 | 421 |
421 #endif // NET_QUIC_QUIC_PACKET_CREATOR_H_ | 422 #endif // NET_QUIC_QUIC_PACKET_CREATOR_H_ |
OLD | NEW |