• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2015 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 
12 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_REPORT_BLOCK_H_
13 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_REPORT_BLOCK_H_
14 
15 #include "webrtc/base/basictypes.h"
16 
17 namespace webrtc {
18 namespace rtcp {
19 
20 class ReportBlock {
21  public:
22   static const size_t kLength = 24;
23 
24   ReportBlock();
~ReportBlock()25   ~ReportBlock() {}
26 
27   bool Parse(const uint8_t* buffer, size_t length);
28 
29   // Fills buffer with the ReportBlock.
30   // Consumes ReportBlock::kLength bytes.
31   void Create(uint8_t* buffer) const;
32 
To(uint32_t ssrc)33   void To(uint32_t ssrc) { source_ssrc_ = ssrc; }
WithFractionLost(uint8_t fraction_lost)34   void WithFractionLost(uint8_t fraction_lost) {
35     fraction_lost_ = fraction_lost;
36   }
37   bool WithCumulativeLost(uint32_t cumulative_lost);
WithExtHighestSeqNum(uint32_t ext_highest_seq_num)38   void WithExtHighestSeqNum(uint32_t ext_highest_seq_num) {
39     extended_high_seq_num_ = ext_highest_seq_num;
40   }
WithJitter(uint32_t jitter)41   void WithJitter(uint32_t jitter) { jitter_ = jitter; }
WithLastSr(uint32_t last_sr)42   void WithLastSr(uint32_t last_sr) { last_sr_ = last_sr; }
WithDelayLastSr(uint32_t delay_last_sr)43   void WithDelayLastSr(uint32_t delay_last_sr) {
44     delay_since_last_sr_ = delay_last_sr;
45   }
46 
source_ssrc()47   uint32_t source_ssrc() const { return source_ssrc_; }
fraction_lost()48   uint8_t fraction_lost() const { return fraction_lost_; }
cumulative_lost()49   uint32_t cumulative_lost() const { return cumulative_lost_; }
extended_high_seq_num()50   uint32_t extended_high_seq_num() const { return extended_high_seq_num_; }
jitter()51   uint32_t jitter() const { return jitter_; }
last_sr()52   uint32_t last_sr() const { return last_sr_; }
delay_since_last_sr()53   uint32_t delay_since_last_sr() const { return delay_since_last_sr_; }
54 
55  private:
56   uint32_t source_ssrc_;
57   uint8_t fraction_lost_;
58   uint32_t cumulative_lost_;
59   uint32_t extended_high_seq_num_;
60   uint32_t jitter_;
61   uint32_t last_sr_;
62   uint32_t delay_since_last_sr_;
63 };
64 
65 }  // namespace rtcp
66 }  // namespace webrtc
67 #endif  // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_REPORT_BLOCK_H_
68