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 14 matching lines...) Expand all Loading... |
25 static constexpr uint8_t kFeedbackMessageType = 1; | 25 static constexpr uint8_t kFeedbackMessageType = 1; |
26 Nack(); | 26 Nack(); |
27 ~Nack() override; | 27 ~Nack() override; |
28 | 28 |
29 // Parse assumes header is already parsed and validated. | 29 // Parse assumes header is already parsed and validated. |
30 bool Parse(const CommonHeader& packet); | 30 bool Parse(const CommonHeader& packet); |
31 | 31 |
32 void SetPacketIds(const uint16_t* nack_list, size_t length); | 32 void SetPacketIds(const uint16_t* nack_list, size_t length); |
33 const std::vector<uint16_t>& packet_ids() const { return packet_ids_; } | 33 const std::vector<uint16_t>& packet_ids() const { return packet_ids_; } |
34 | 34 |
35 protected: | 35 size_t BlockLength() const override; |
| 36 |
36 bool Create(uint8_t* packet, | 37 bool Create(uint8_t* packet, |
37 size_t* index, | 38 size_t* index, |
38 size_t max_length, | 39 size_t max_length, |
39 RtcpPacket::PacketReadyCallback* callback) const override; | 40 RtcpPacket::PacketReadyCallback* callback) const override; |
40 | 41 |
41 size_t BlockLength() const override; | |
42 | |
43 private: | 42 private: |
44 static constexpr size_t kNackItemLength = 4; | 43 static constexpr size_t kNackItemLength = 4; |
45 struct PackedNack { | 44 struct PackedNack { |
46 uint16_t first_pid; | 45 uint16_t first_pid; |
47 uint16_t bitmask; | 46 uint16_t bitmask; |
48 }; | 47 }; |
49 | 48 |
50 void Pack(); // Fills packed_ using packed_ids_. (used in SetPacketIds). | 49 void Pack(); // Fills packed_ using packed_ids_. (used in SetPacketIds). |
51 void Unpack(); // Fills packet_ids_ using packed_. (used in Parse). | 50 void Unpack(); // Fills packet_ids_ using packed_. (used in Parse). |
52 | 51 |
53 std::vector<PackedNack> packed_; | 52 std::vector<PackedNack> packed_; |
54 std::vector<uint16_t> packet_ids_; | 53 std::vector<uint16_t> packet_ids_; |
55 }; | 54 }; |
56 | 55 |
57 } // namespace rtcp | 56 } // namespace rtcp |
58 } // namespace webrtc | 57 } // namespace webrtc |
59 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_NACK_H_ | 58 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_NACK_H_ |
OLD | NEW |