OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 // TODO(holmer): As a next step all these struct-like packet classes should be | 36 // TODO(holmer): As a next step all these struct-like packet classes should be |
37 // refactored into proper classes, and their members should be made private. | 37 // refactored into proper classes, and their members should be made private. |
38 // This will require parts of the functionality in forward_error_correction.cc | 38 // This will require parts of the functionality in forward_error_correction.cc |
39 // and receiver_fec.cc to be refactored into the packet classes. | 39 // and receiver_fec.cc to be refactored into the packet classes. |
40 class Packet { | 40 class Packet { |
41 public: | 41 public: |
42 Packet() : length(0), data(), ref_count_(0) {} | 42 Packet() : length(0), data(), ref_count_(0) {} |
43 virtual ~Packet() {} | 43 virtual ~Packet() {} |
44 | 44 |
45 // Add a reference. | 45 // Add a reference. |
46 virtual int32_t AddRef(); | 46 virtual int32_t AddRef() const; |
47 | 47 |
48 // Release a reference. Will delete the object if the reference count | 48 // Release a reference. Will delete the object if the reference count |
49 // reaches zero. | 49 // reaches zero. |
50 virtual int32_t Release(); | 50 virtual int32_t Release() const; |
51 | 51 |
52 size_t length; // Length of packet in bytes. | 52 size_t length; // Length of packet in bytes. |
53 uint8_t data[IP_PACKET_SIZE]; // Packet data. | 53 uint8_t data[IP_PACKET_SIZE]; // Packet data. |
54 | 54 |
55 private: | 55 private: |
56 int32_t ref_count_; // Counts the number of references to a packet. | 56 mutable int32_t ref_count_; // Counts the number of references to a packet. |
57 }; | 57 }; |
58 | 58 |
59 // TODO(holmer): Refactor into a proper class. | 59 // TODO(holmer): Refactor into a proper class. |
60 class SortablePacket { | 60 class SortablePacket { |
61 public: | 61 public: |
62 // True if first is <= than second. | 62 // True if first is <= than second. |
63 static bool LessThan(const SortablePacket* first, | 63 static bool LessThan(const SortablePacket* first, |
64 const SortablePacket* second); | 64 const SortablePacket* second); |
65 | 65 |
66 uint16_t seq_num; | 66 uint16_t seq_num; |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 static void DiscardFECPacket(FecPacket* fec_packet); | 302 static void DiscardFECPacket(FecPacket* fec_packet); |
303 static void DiscardOldPackets(RecoveredPacketList* recovered_packet_list); | 303 static void DiscardOldPackets(RecoveredPacketList* recovered_packet_list); |
304 static uint16_t ParseSequenceNumber(uint8_t* packet); | 304 static uint16_t ParseSequenceNumber(uint8_t* packet); |
305 | 305 |
306 std::vector<Packet> generated_fec_packets_; | 306 std::vector<Packet> generated_fec_packets_; |
307 FecPacketList fec_packet_list_; | 307 FecPacketList fec_packet_list_; |
308 bool fec_packet_received_; | 308 bool fec_packet_received_; |
309 }; | 309 }; |
310 } // namespace webrtc | 310 } // namespace webrtc |
311 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_FORWARD_ERROR_CORRECTION_H_ | 311 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_FORWARD_ERROR_CORRECTION_H_ |
OLD | NEW |