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