Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(506)

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_reports.h

Issue 2006313010: [rtcp] ExtendedReports::Parse updated not to use RTCPUtility (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_reports.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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_EXTENDED_REPORTS_H_ 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_EXTENDED_REPORTS_H_
12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_EXTENDED_REPORTS_H_ 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_EXTENDED_REPORTS_H_
13 13
14 #include <vector> 14 #include <vector>
15 15
16 #include "webrtc/base/constructormagic.h" 16 #include "webrtc/base/constructormagic.h"
17 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" 17 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h"
18 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/dlrr.h" 18 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/dlrr.h"
19 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rrtr.h" 19 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rrtr.h"
20 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/voip_metric.h" 20 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/voip_metric.h"
21 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h"
22 21
23 namespace webrtc { 22 namespace webrtc {
24 namespace rtcp { 23 namespace rtcp {
24 class CommonHeader;
25 25
26 // From RFC 3611: RTP Control Protocol Extended Reports (RTCP XR). 26 // From RFC 3611: RTP Control Protocol Extended Reports (RTCP XR).
27 class ExtendedReports : public RtcpPacket { 27 class ExtendedReports : public RtcpPacket {
28 public: 28 public:
29 static const uint8_t kPacketType = 207; 29 static constexpr uint8_t kPacketType = 207;
30 30
31 ExtendedReports(); 31 ExtendedReports();
32 ~ExtendedReports() override; 32 ~ExtendedReports() override;
33 33
34 // Parse assumes header is already parsed and validated. 34 // Parse assumes header is already parsed and validated.
35 bool Parse(const RTCPUtility::RtcpCommonHeader& header, 35 bool Parse(const CommonHeader& packet);
36 const uint8_t* payload); // Size of the payload is in the header.
37 36
38 void From(uint32_t ssrc) { sender_ssrc_ = ssrc; } 37 void From(uint32_t ssrc) { sender_ssrc_ = ssrc; }
39 38
40 // Max 50 items of each of {Rrtr, Dlrr, VoipMetric} allowed per Xr. 39 // Max 50 items of each of {Rrtr, Dlrr, VoipMetric} allowed per Xr.
41 bool WithRrtr(const Rrtr& rrtr); 40 bool WithRrtr(const Rrtr& rrtr);
42 bool WithDlrr(const Dlrr& dlrr); 41 bool WithDlrr(const Dlrr& dlrr);
43 bool WithVoipMetric(const VoipMetric& voip_metric); 42 bool WithVoipMetric(const VoipMetric& voip_metric);
44 43
45 uint32_t sender_ssrc() const { return sender_ssrc_; } 44 uint32_t sender_ssrc() const { return sender_ssrc_; }
46 const std::vector<Rrtr>& rrtrs() const { return rrtr_blocks_; } 45 const std::vector<Rrtr>& rrtrs() const { return rrtr_blocks_; }
47 const std::vector<Dlrr>& dlrrs() const { return dlrr_blocks_; } 46 const std::vector<Dlrr>& dlrrs() const { return dlrr_blocks_; }
48 const std::vector<VoipMetric>& voip_metrics() const { 47 const std::vector<VoipMetric>& voip_metrics() const {
49 return voip_metric_blocks_; 48 return voip_metric_blocks_;
50 } 49 }
51 50
52 protected: 51 protected:
53 bool Create(uint8_t* packet, 52 bool Create(uint8_t* packet,
54 size_t* index, 53 size_t* index,
55 size_t max_length, 54 size_t max_length,
56 RtcpPacket::PacketReadyCallback* callback) const override; 55 RtcpPacket::PacketReadyCallback* callback) const override;
57 56
58 private: 57 private:
59 static const size_t kMaxNumberOfRrtrBlocks = 50; 58 static const size_t kMaxNumberOfRrtrBlocks = 50;
60 static const size_t kMaxNumberOfDlrrBlocks = 50; 59 static const size_t kMaxNumberOfDlrrBlocks = 50;
61 static const size_t kMaxNumberOfVoipMetricBlocks = 50; 60 static const size_t kMaxNumberOfVoipMetricBlocks = 50;
62 static const size_t kXrBaseLength = 4; 61 static constexpr size_t kXrBaseLength = 4;
63 62
64 size_t BlockLength() const override { 63 size_t BlockLength() const override {
65 return kHeaderLength + kXrBaseLength + RrtrLength() + DlrrLength() + 64 return kHeaderLength + kXrBaseLength + RrtrLength() + DlrrLength() +
66 VoipMetricLength(); 65 VoipMetricLength();
67 } 66 }
68 67
69 size_t RrtrLength() const { return Rrtr::kLength * rrtr_blocks_.size(); } 68 size_t RrtrLength() const { return Rrtr::kLength * rrtr_blocks_.size(); }
70 size_t DlrrLength() const; 69 size_t DlrrLength() const;
71 size_t VoipMetricLength() const { 70 size_t VoipMetricLength() const {
72 return VoipMetric::kLength * voip_metric_blocks_.size(); 71 return VoipMetric::kLength * voip_metric_blocks_.size();
73 } 72 }
74 73
75 void ParseRrtrBlock(const uint8_t* block, uint16_t block_length); 74 void ParseRrtrBlock(const uint8_t* block, uint16_t block_length);
76 void ParseDlrrBlock(const uint8_t* block, uint16_t block_length); 75 void ParseDlrrBlock(const uint8_t* block, uint16_t block_length);
77 void ParseVoipMetricBlock(const uint8_t* block, uint16_t block_length); 76 void ParseVoipMetricBlock(const uint8_t* block, uint16_t block_length);
78 77
79 uint32_t sender_ssrc_; 78 uint32_t sender_ssrc_;
80 std::vector<Rrtr> rrtr_blocks_; 79 std::vector<Rrtr> rrtr_blocks_;
81 std::vector<Dlrr> dlrr_blocks_; 80 std::vector<Dlrr> dlrr_blocks_;
82 std::vector<VoipMetric> voip_metric_blocks_; 81 std::vector<VoipMetric> voip_metric_blocks_;
83 82
84 RTC_DISALLOW_COPY_AND_ASSIGN(ExtendedReports); 83 RTC_DISALLOW_COPY_AND_ASSIGN(ExtendedReports);
85 }; 84 };
86 } // namespace rtcp 85 } // namespace rtcp
87 } // namespace webrtc 86 } // namespace webrtc
88 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_EXTENDED_REPORTS_H_ 87 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_EXTENDED_REPORTS_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_reports.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698