OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // Get the reference time in microseconds, including any precision loss. | 62 // Get the reference time in microseconds, including any precision loss. |
63 int64_t GetBaseTimeUs() const; | 63 int64_t GetBaseTimeUs() const; |
64 | 64 |
65 bool Parse(const CommonHeader& packet); | 65 bool Parse(const CommonHeader& packet); |
66 static std::unique_ptr<TransportFeedback> ParseFrom(const uint8_t* buffer, | 66 static std::unique_ptr<TransportFeedback> ParseFrom(const uint8_t* buffer, |
67 size_t length); | 67 size_t length); |
68 // Pre and postcondition for all public methods. Should always return true. | 68 // Pre and postcondition for all public methods. Should always return true. |
69 // This function is for tests. | 69 // This function is for tests. |
70 bool IsConsistent() const; | 70 bool IsConsistent() const; |
71 | 71 |
72 protected: | 72 size_t BlockLength() const override; |
| 73 |
73 bool Create(uint8_t* packet, | 74 bool Create(uint8_t* packet, |
74 size_t* position, | 75 size_t* position, |
75 size_t max_length, | 76 size_t max_length, |
76 PacketReadyCallback* callback) const override; | 77 PacketReadyCallback* callback) const override; |
77 | 78 |
78 size_t BlockLength() const override; | |
79 | |
80 private: | 79 private: |
81 // Size in bytes of a delta time in rtcp packet. | 80 // Size in bytes of a delta time in rtcp packet. |
82 // Valid values are 0 (packet wasn't received), 1 or 2. | 81 // Valid values are 0 (packet wasn't received), 1 or 2. |
83 using DeltaSize = uint8_t; | 82 using DeltaSize = uint8_t; |
84 // Keeps DeltaSizes that can be encoded into single chunk if it is last chunk. | 83 // Keeps DeltaSizes that can be encoded into single chunk if it is last chunk. |
85 class LastChunk; | 84 class LastChunk; |
86 | 85 |
87 // Reset packet to consistent empty state. | 86 // Reset packet to consistent empty state. |
88 void Clear(); | 87 void Clear(); |
89 | 88 |
90 bool AddDeltaSize(DeltaSize delta_size); | 89 bool AddDeltaSize(DeltaSize delta_size); |
91 | 90 |
92 uint16_t base_seq_no_; | 91 uint16_t base_seq_no_; |
93 uint16_t num_seq_no_; | 92 uint16_t num_seq_no_; |
94 int32_t base_time_ticks_; | 93 int32_t base_time_ticks_; |
95 uint8_t feedback_seq_; | 94 uint8_t feedback_seq_; |
96 | 95 |
97 int64_t last_timestamp_us_; | 96 int64_t last_timestamp_us_; |
98 std::vector<ReceivedPacket> packets_; | 97 std::vector<ReceivedPacket> packets_; |
99 // All but last encoded packet chunks. | 98 // All but last encoded packet chunks. |
100 std::vector<uint16_t> encoded_chunks_; | 99 std::vector<uint16_t> encoded_chunks_; |
101 const std::unique_ptr<LastChunk> last_chunk_; | 100 const std::unique_ptr<LastChunk> last_chunk_; |
102 size_t size_bytes_; | 101 size_t size_bytes_; |
103 }; | 102 }; |
104 | 103 |
105 } // namespace rtcp | 104 } // namespace rtcp |
106 } // namespace webrtc | 105 } // namespace webrtc |
107 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TRANSPORT_FEEDBACK_H_ | 106 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TRANSPORT_FEEDBACK_H_ |
OLD | NEW |