OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2016 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 WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_EXTENDED_REPORTS_H_ |
| 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_EXTENDED_REPORTS_H_ |
| 13 |
| 14 #include <vector> |
| 15 |
| 16 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" |
| 17 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/dlrr.h" |
| 18 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rrtr.h" |
| 19 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/voip_metric.h" |
| 20 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" |
| 21 |
| 22 namespace webrtc { |
| 23 namespace rtcp { |
| 24 |
| 25 // From RFC 3611: RTP Control Protocol Extended Reports (RTCP XR). |
| 26 class ExtendedReports : public RtcpPacket { |
| 27 public: |
| 28 typedef std::vector<RTCPUtility::RTCPPacketXRDLRRReportBlockItem> DlrrBlock; |
| 29 ExtendedReports() : RtcpPacket() { |
| 30 memset(&xr_header_, 0, sizeof(xr_header_)); |
| 31 } |
| 32 |
| 33 virtual ~ExtendedReports() {} |
| 34 |
| 35 void From(uint32_t ssrc) { |
| 36 xr_header_.OriginatorSSRC = ssrc; |
| 37 } |
| 38 |
| 39 // Max 50 items of each of {Rrtr, Dlrr, VoipMetric} allowed per Xr. |
| 40 bool WithRrtr(Rrtr* rrtr); |
| 41 bool WithDlrr(Dlrr* dlrr); |
| 42 bool WithVoipMetric(VoipMetric* voip_metric); |
| 43 |
| 44 protected: |
| 45 bool Create(uint8_t* packet, |
| 46 size_t* index, |
| 47 size_t max_length, |
| 48 RtcpPacket::PacketReadyCallback* callback) const override; |
| 49 |
| 50 private: |
| 51 static const int kMaxNumberOfRrtrBlocks = 50; |
| 52 static const int kMaxNumberOfDlrrBlocks = 50; |
| 53 static const int kMaxNumberOfVoipMetricBlocks = 50; |
| 54 |
| 55 size_t BlockLength() const { |
| 56 const size_t kXrHeaderLength = 8; |
| 57 return kXrHeaderLength + RrtrLength() + DlrrLength() + VoipMetricLength(); |
| 58 } |
| 59 |
| 60 size_t RrtrLength() const { return Rrtr::kLength * rrtr_blocks_.size(); } |
| 61 |
| 62 size_t DlrrLength() const; |
| 63 |
| 64 size_t VoipMetricLength() const { |
| 65 return VoipMetric::kLength * voip_metric_blocks_.size(); |
| 66 } |
| 67 |
| 68 RTCPUtility::RTCPPacketXR xr_header_; |
| 69 std::vector<Rrtr> rrtr_blocks_; |
| 70 std::vector<Dlrr> dlrr_blocks_; |
| 71 std::vector<VoipMetric> voip_metric_blocks_; |
| 72 |
| 73 RTC_DISALLOW_COPY_AND_ASSIGN(ExtendedReports); |
| 74 }; |
| 75 |
| 76 } // namespace rtcp |
| 77 } // namespace webrtc |
| 78 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_EXTENDED_REPORTS_H_ |
OLD | NEW |