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