Line data Source code
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();
25 0 : ~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 :
33 0 : void SetMediaSsrc(uint32_t ssrc) { source_ssrc_ = ssrc; }
34 0 : void SetFractionLost(uint8_t fraction_lost) {
35 0 : fraction_lost_ = fraction_lost;
36 0 : }
37 : bool SetCumulativeLost(uint32_t cumulative_lost);
38 0 : void SetExtHighestSeqNum(uint32_t ext_highest_seq_num) {
39 0 : extended_high_seq_num_ = ext_highest_seq_num;
40 0 : }
41 0 : void SetJitter(uint32_t jitter) { jitter_ = jitter; }
42 0 : void SetLastSr(uint32_t last_sr) { last_sr_ = last_sr; }
43 0 : void SetDelayLastSr(uint32_t delay_last_sr) {
44 0 : delay_since_last_sr_ = delay_last_sr;
45 0 : }
46 :
47 0 : uint32_t source_ssrc() const { return source_ssrc_; }
48 0 : uint8_t fraction_lost() const { return fraction_lost_; }
49 0 : uint32_t cumulative_lost() const { return cumulative_lost_; }
50 0 : uint32_t extended_high_seq_num() const { return extended_high_seq_num_; }
51 0 : uint32_t jitter() const { return jitter_; }
52 0 : uint32_t last_sr() const { return last_sr_; }
53 0 : 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_
|