• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3  *
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
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_RECEIVER_REPORT_H_
12 #define MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_RECEIVER_REPORT_H_
13 
14 #include <stddef.h>
15 #include <stdint.h>
16 
17 #include <vector>
18 
19 #include "modules/rtp_rtcp/source/rtcp_packet.h"
20 #include "modules/rtp_rtcp/source/rtcp_packet/report_block.h"
21 
22 namespace webrtc {
23 namespace rtcp {
24 class CommonHeader;
25 
26 class ReceiverReport : public RtcpPacket {
27  public:
28   static constexpr uint8_t kPacketType = 201;
29   static constexpr size_t kMaxNumberOfReportBlocks = 0x1f;
30 
31   ReceiverReport();
32   ReceiverReport(const ReceiverReport&);
33   ~ReceiverReport() override;
34 
35   // Parse assumes header is already parsed and validated.
36   bool Parse(const CommonHeader& packet);
37 
38   bool AddReportBlock(const ReportBlock& block);
39   bool SetReportBlocks(std::vector<ReportBlock> blocks);
40 
report_blocks()41   const std::vector<ReportBlock>& report_blocks() const {
42     return report_blocks_;
43   }
44 
45   size_t BlockLength() const override;
46 
47   bool Create(uint8_t* packet,
48               size_t* index,
49               size_t max_length,
50               PacketReadyCallback callback) const override;
51 
52  private:
53   static const size_t kRrBaseLength = 4;
54 
55   std::vector<ReportBlock> report_blocks_;
56 };
57 
58 }  // namespace rtcp
59 }  // namespace webrtc
60 #endif  // MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_RECEIVER_REPORT_H_
61