OLD | NEW |
---|---|
(Empty) | |
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_DLRR_H_ | |
13 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_DLRR_H_ | |
14 | |
15 #include <algorithm> | |
åsapersson
2015/12/15 12:20:55
needed?
danilchap
2015/12/15 13:02:17
Done. Not any more. (forgot to remove after removi
| |
16 #include <vector> | |
17 | |
18 #include "webrtc/base/basictypes.h" | |
19 #include "webrtc/base/constructormagic.h" | |
20 | |
21 namespace webrtc { | |
22 namespace rtcp { | |
23 | |
24 // DLRR Report Block: Delay since the Last Receiver Report (RFC 3611). | |
25 class Dlrr { | |
26 public: | |
27 struct SubBlock { | |
28 // RFC 3611 4.5 | |
29 uint32_t ssrc; | |
30 uint32_t last_rr; | |
31 uint32_t delay_since_last_rr; | |
32 }; | |
33 | |
34 static const uint8_t kBlockType = 5; | |
35 static const size_t kMaxNumberOfDlrrItems = 100; | |
36 | |
37 Dlrr() {} | |
38 Dlrr(Dlrr&&) = default; | |
39 ~Dlrr() {} | |
40 | |
41 // Second parameter is value read from block header, | |
42 // i.e. size of block in 32bits excluding block header itself. | |
43 bool Parse(const uint8_t* buffer, uint16_t block_length_32bits); | |
44 | |
45 size_t BlockLength() const; | |
46 // Fills buffer with the Dlrr. | |
47 // Consumes BlockLength() bytes. | |
48 void Create(uint8_t* buffer) const; | |
49 | |
50 // Max 100 DLRR Items can be added per DLRR report block. | |
51 bool WithDlrrItem(uint32_t ssrc, uint32_t last_rr, uint32_t delay_last_rr); | |
52 | |
53 const std::vector<SubBlock>& sub_blocks() const { return sub_blocks_; } | |
54 | |
55 private: | |
56 static const size_t kBlockHeaderLength = 4; | |
57 static const size_t kSubBlockLength = 12; | |
58 | |
59 std::vector<SubBlock> sub_blocks_; | |
60 | |
61 RTC_DISALLOW_COPY_AND_ASSIGN(Dlrr); | |
62 }; | |
63 } // namespace rtcp | |
64 } // namespace webrtc | |
65 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_DLRR_H_ | |
OLD | NEW |