LCOV - code coverage report
Current view: top level - media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtcp_packet - sli.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 11 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_SLI_H_
      12             : #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_SLI_H_
      13             : 
      14             : #include <vector>
      15             : 
      16             : #include "webrtc/base/basictypes.h"
      17             : #include "webrtc/base/constructormagic.h"
      18             : #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/psfb.h"
      19             : 
      20             : namespace webrtc {
      21             : namespace rtcp {
      22             : class CommonHeader;
      23             : 
      24             : // Slice loss indication (SLI) (RFC 4585).
      25             : class Sli : public Psfb {
      26             :  public:
      27             :   static constexpr uint8_t kFeedbackMessageType = 2;
      28             :   class Macroblocks {
      29             :    public:
      30             :     static constexpr size_t kLength = 4;
      31           0 :     Macroblocks() : item_(0) {}
      32             :     Macroblocks(uint8_t picture_id, uint16_t first, uint16_t number);
      33           0 :     ~Macroblocks() {}
      34             : 
      35             :     void Parse(const uint8_t* buffer);
      36             :     void Create(uint8_t* buffer) const;
      37             : 
      38             :     uint16_t first() const { return item_ >> 19; }
      39             :     uint16_t number() const { return (item_ >> 6) & 0x1fff; }
      40           0 :     uint8_t picture_id() const { return (item_ & 0x3f); }
      41             : 
      42             :    private:
      43             :     uint32_t item_;
      44             :   };
      45             : 
      46           0 :   Sli() {}
      47           0 :   ~Sli() override {}
      48             : 
      49             :   // Parse assumes header is already parsed and validated.
      50             :   bool Parse(const CommonHeader& packet);
      51             : 
      52           0 :   void AddPictureId(uint8_t picture_id) {
      53           0 :     items_.emplace_back(picture_id, 0, 0x1fff);
      54           0 :   }
      55             :   void AddPictureId(uint8_t picture_id,
      56             :                     uint16_t first_macroblock,
      57             :                     uint16_t number_macroblocks) {
      58             :     items_.emplace_back(picture_id, first_macroblock, number_macroblocks);
      59             :   }
      60             : 
      61           0 :   const std::vector<Macroblocks>& macroblocks() const { return items_; }
      62             : 
      63             :  protected:
      64             :   bool Create(uint8_t* packet,
      65             :               size_t* index,
      66             :               size_t max_length,
      67             :               RtcpPacket::PacketReadyCallback* callback) const override;
      68             : 
      69             :  private:
      70           0 :   size_t BlockLength() const override {
      71             :     return RtcpPacket::kHeaderLength + Psfb::kCommonFeedbackLength +
      72           0 :            items_.size() * Macroblocks::kLength;
      73             :   }
      74             : 
      75             :   std::vector<Macroblocks> items_;
      76             : 
      77             :   RTC_DISALLOW_COPY_AND_ASSIGN(Sli);
      78             : };
      79             : 
      80             : }  // namespace rtcp
      81             : }  // namespace webrtc
      82             : #endif  // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_SLI_H_

Generated by: LCOV version 1.13