| 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 |
| 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_NACK_H_ | 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_NACK_H_ |
| 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_NACK_H_ | 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_NACK_H_ |
| 13 | 13 |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "webrtc/base/basictypes.h" | 16 #include "webrtc/base/basictypes.h" |
| 17 #include "webrtc/base/constructormagic.h" | 17 #include "webrtc/base/constructormagic.h" |
| 18 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rtpfb.h" | 18 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rtpfb.h" |
| 19 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" | |
| 20 | 19 |
| 21 namespace webrtc { | 20 namespace webrtc { |
| 22 namespace rtcp { | 21 namespace rtcp { |
| 22 class CommonHeader; |
| 23 | 23 |
| 24 class Nack : public Rtpfb { | 24 class Nack : public Rtpfb { |
| 25 public: | 25 public: |
| 26 const uint8_t kFeedbackMessageType = 1; | 26 static constexpr uint8_t kFeedbackMessageType = 1; |
| 27 Nack() {} | 27 Nack(); |
| 28 | 28 ~Nack() override; |
| 29 virtual ~Nack() {} | |
| 30 | 29 |
| 31 // Parse assumes header is already parsed and validated. | 30 // Parse assumes header is already parsed and validated. |
| 32 bool Parse(const RTCPUtility::RtcpCommonHeader& header, | 31 bool Parse(const CommonHeader& packet); |
| 33 const uint8_t* payload); // Size of the payload is in the header. | |
| 34 | 32 |
| 35 void WithList(const uint16_t* nack_list, size_t length); | 33 void WithList(const uint16_t* nack_list, size_t length); |
| 36 const std::vector<uint16_t>& packet_ids() const { return packet_ids_; } | 34 const std::vector<uint16_t>& packet_ids() const { return packet_ids_; } |
| 37 | 35 |
| 38 protected: | 36 protected: |
| 39 bool Create(uint8_t* packet, | 37 bool Create(uint8_t* packet, |
| 40 size_t* index, | 38 size_t* index, |
| 41 size_t max_length, | 39 size_t max_length, |
| 42 RtcpPacket::PacketReadyCallback* callback) const override; | 40 RtcpPacket::PacketReadyCallback* callback) const override; |
| 43 | 41 |
| 44 size_t BlockLength() const override; | 42 size_t BlockLength() const override; |
| 45 | 43 |
| 46 private: | 44 private: |
| 47 const size_t kNackItemLength = 4; | 45 static constexpr size_t kNackItemLength = 4; |
| 48 struct PackedNack { | 46 struct PackedNack { |
| 49 uint16_t first_pid; | 47 uint16_t first_pid; |
| 50 uint16_t bitmask; | 48 uint16_t bitmask; |
| 51 }; | 49 }; |
| 52 | 50 |
| 53 void Pack(); // Fills packed_ using packed_ids_. (used in WithList). | 51 void Pack(); // Fills packed_ using packed_ids_. (used in WithList). |
| 54 void Unpack(); // Fills packet_ids_ using packed_. (used in Parse). | 52 void Unpack(); // Fills packet_ids_ using packed_. (used in Parse). |
| 55 | 53 |
| 56 std::vector<PackedNack> packed_; | 54 std::vector<PackedNack> packed_; |
| 57 std::vector<uint16_t> packet_ids_; | 55 std::vector<uint16_t> packet_ids_; |
| 58 | 56 |
| 59 RTC_DISALLOW_COPY_AND_ASSIGN(Nack); | 57 RTC_DISALLOW_COPY_AND_ASSIGN(Nack); |
| 60 }; | 58 }; |
| 61 | 59 |
| 62 } // namespace rtcp | 60 } // namespace rtcp |
| 63 } // namespace webrtc | 61 } // namespace webrtc |
| 64 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_NACK_H_ | 62 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_NACK_H_ |
| OLD | NEW |