OLD | NEW |
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 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 uint32_t sender_ssrc() const { return sender_ssrc_; } | 45 uint32_t sender_ssrc() const { return sender_ssrc_; } |
46 const rtc::Optional<Rrtr>& rrtr() const { return rrtr_block_; } | 46 const rtc::Optional<Rrtr>& rrtr() const { return rrtr_block_; } |
47 const Dlrr& dlrr() const { return dlrr_block_; } | 47 const Dlrr& dlrr() const { return dlrr_block_; } |
48 const rtc::Optional<VoipMetric>& voip_metric() const { | 48 const rtc::Optional<VoipMetric>& voip_metric() const { |
49 return voip_metric_block_; | 49 return voip_metric_block_; |
50 } | 50 } |
51 const rtc::Optional<TargetBitrate>& target_bitrate() const { | 51 const rtc::Optional<TargetBitrate>& target_bitrate() const { |
52 return target_bitrate_; | 52 return target_bitrate_; |
53 } | 53 } |
54 | 54 |
55 protected: | 55 size_t BlockLength() const override; |
| 56 |
56 bool Create(uint8_t* packet, | 57 bool Create(uint8_t* packet, |
57 size_t* index, | 58 size_t* index, |
58 size_t max_length, | 59 size_t max_length, |
59 RtcpPacket::PacketReadyCallback* callback) const override; | 60 RtcpPacket::PacketReadyCallback* callback) const override; |
60 | 61 |
61 private: | 62 private: |
62 static constexpr size_t kXrBaseLength = 4; | 63 static constexpr size_t kXrBaseLength = 4; |
63 | 64 |
64 size_t BlockLength() const override { | |
65 return kHeaderLength + kXrBaseLength + RrtrLength() + DlrrLength() + | |
66 VoipMetricLength() + TargetBitrateLength(); | |
67 } | |
68 | |
69 size_t RrtrLength() const { return rrtr_block_ ? Rrtr::kLength : 0; } | 65 size_t RrtrLength() const { return rrtr_block_ ? Rrtr::kLength : 0; } |
70 size_t DlrrLength() const { return dlrr_block_.BlockLength(); } | 66 size_t DlrrLength() const { return dlrr_block_.BlockLength(); } |
71 size_t VoipMetricLength() const { | 67 size_t VoipMetricLength() const { |
72 return voip_metric_block_ ? VoipMetric::kLength : 0; | 68 return voip_metric_block_ ? VoipMetric::kLength : 0; |
73 } | 69 } |
74 size_t TargetBitrateLength() const; | 70 size_t TargetBitrateLength() const; |
75 | 71 |
76 void ParseRrtrBlock(const uint8_t* block, uint16_t block_length); | 72 void ParseRrtrBlock(const uint8_t* block, uint16_t block_length); |
77 void ParseDlrrBlock(const uint8_t* block, uint16_t block_length); | 73 void ParseDlrrBlock(const uint8_t* block, uint16_t block_length); |
78 void ParseVoipMetricBlock(const uint8_t* block, uint16_t block_length); | 74 void ParseVoipMetricBlock(const uint8_t* block, uint16_t block_length); |
79 void ParseTargetBitrateBlock(const uint8_t* block, uint16_t block_length); | 75 void ParseTargetBitrateBlock(const uint8_t* block, uint16_t block_length); |
80 | 76 |
81 uint32_t sender_ssrc_; | 77 uint32_t sender_ssrc_; |
82 rtc::Optional<Rrtr> rrtr_block_; | 78 rtc::Optional<Rrtr> rrtr_block_; |
83 Dlrr dlrr_block_; // Dlrr without items treated same as no dlrr block. | 79 Dlrr dlrr_block_; // Dlrr without items treated same as no dlrr block. |
84 rtc::Optional<VoipMetric> voip_metric_block_; | 80 rtc::Optional<VoipMetric> voip_metric_block_; |
85 rtc::Optional<TargetBitrate> target_bitrate_; | 81 rtc::Optional<TargetBitrate> target_bitrate_; |
86 }; | 82 }; |
87 } // namespace rtcp | 83 } // namespace rtcp |
88 } // namespace webrtc | 84 } // namespace webrtc |
89 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_EXTENDED_REPORTS_H_ | 85 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_EXTENDED_REPORTS_H_ |
OLD | NEW |