LCOV - code coverage report
Current view: top level - media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtcp_packet - extended_reports.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 13 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 9 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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/base/constructormagic.h"
      17             : #include "webrtc/base/optional.h"
      18             : #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h"
      19             : #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/dlrr.h"
      20             : #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rrtr.h"
      21             : #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/target_bitrate.h"
      22             : #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/voip_metric.h"
      23             : 
      24             : namespace webrtc {
      25             : namespace rtcp {
      26             : class CommonHeader;
      27             : 
      28             : // From RFC 3611: RTP Control Protocol Extended Reports (RTCP XR).
      29             : class ExtendedReports : public RtcpPacket {
      30             :  public:
      31             :   static constexpr uint8_t kPacketType = 207;
      32             : 
      33             :   ExtendedReports();
      34             :   ~ExtendedReports() override;
      35             : 
      36             :   // Parse assumes header is already parsed and validated.
      37             :   bool Parse(const CommonHeader& packet);
      38             : 
      39           0 :   void SetSenderSsrc(uint32_t ssrc) { sender_ssrc_ = ssrc; }
      40             : 
      41             :   void SetRrtr(const Rrtr& rrtr);
      42             :   void AddDlrrItem(const ReceiveTimeInfo& time_info);
      43             :   void SetVoipMetric(const VoipMetric& voip_metric);
      44             :   void SetTargetBitrate(const TargetBitrate& target_bitrate);
      45             : 
      46           0 :   uint32_t sender_ssrc() const { return sender_ssrc_; }
      47           0 :   const rtc::Optional<Rrtr>& rrtr() const { return rrtr_block_; }
      48           0 :   const Dlrr& dlrr() const { return dlrr_block_; }
      49             :   const rtc::Optional<VoipMetric>& voip_metric() const {
      50             :     return voip_metric_block_;
      51             :   }
      52           0 :   const rtc::Optional<TargetBitrate>& target_bitrate() {
      53           0 :     return target_bitrate_;
      54             :   }
      55             : 
      56             :  protected:
      57             :   bool Create(uint8_t* packet,
      58             :               size_t* index,
      59             :               size_t max_length,
      60             :               RtcpPacket::PacketReadyCallback* callback) const override;
      61             : 
      62             :  private:
      63             :   static constexpr size_t kXrBaseLength = 4;
      64             : 
      65           0 :   size_t BlockLength() const override {
      66           0 :     return kHeaderLength + kXrBaseLength + RrtrLength() + DlrrLength() +
      67           0 :            VoipMetricLength() + TargetBitrateLength();
      68             :   }
      69             : 
      70           0 :   size_t RrtrLength() const { return rrtr_block_ ? Rrtr::kLength : 0; }
      71           0 :   size_t DlrrLength() const { return dlrr_block_.BlockLength(); }
      72           0 :   size_t VoipMetricLength() const {
      73           0 :     return voip_metric_block_ ? VoipMetric::kLength : 0;
      74             :   }
      75             :   size_t TargetBitrateLength() const;
      76             : 
      77             :   void ParseRrtrBlock(const uint8_t* block, uint16_t block_length);
      78             :   void ParseDlrrBlock(const uint8_t* block, uint16_t block_length);
      79             :   void ParseVoipMetricBlock(const uint8_t* block, uint16_t block_length);
      80             :   void ParseTargetBitrateBlock(const uint8_t* block, uint16_t block_length);
      81             : 
      82             :   uint32_t sender_ssrc_;
      83             :   rtc::Optional<Rrtr> rrtr_block_;
      84             :   Dlrr dlrr_block_;  // Dlrr without items treated same as no dlrr block.
      85             :   rtc::Optional<VoipMetric> voip_metric_block_;
      86             :   rtc::Optional<TargetBitrate> target_bitrate_;
      87             : 
      88             :   RTC_DISALLOW_COPY_AND_ASSIGN(ExtendedReports);
      89             : };
      90             : }  // namespace rtcp
      91             : }  // namespace webrtc
      92             : #endif  // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_EXTENDED_REPORTS_H_

Generated by: LCOV version 1.13