Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtcp_packet/dlrr.h

Issue 2378113002: Allow max 1 block per type in RTCP Extended Reports (Closed)
Patch Set: use operator==(T, Optional<T>) for slightly cleaner tests Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/source/rtcp_packet/dlrr.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 * 9 *
10 */ 10 */
(...skipping 14 matching lines...) Expand all
25 : ssrc(ssrc), last_rr(last_rr), delay_since_last_rr(delay) {} 25 : ssrc(ssrc), last_rr(last_rr), delay_since_last_rr(delay) {}
26 uint32_t ssrc; 26 uint32_t ssrc;
27 uint32_t last_rr; 27 uint32_t last_rr;
28 uint32_t delay_since_last_rr; 28 uint32_t delay_since_last_rr;
29 }; 29 };
30 30
31 // DLRR Report Block: Delay since the Last Receiver Report (RFC 3611). 31 // DLRR Report Block: Delay since the Last Receiver Report (RFC 3611).
32 class Dlrr { 32 class Dlrr {
33 public: 33 public:
34 static const uint8_t kBlockType = 5; 34 static const uint8_t kBlockType = 5;
35 static const size_t kMaxNumberOfDlrrItems = 100;
36 35
37 Dlrr() {} 36 Dlrr() {}
38 Dlrr(const Dlrr& other) = default; 37 Dlrr(const Dlrr& other) = default;
39 ~Dlrr() {} 38 ~Dlrr() {}
40 39
41 Dlrr& operator=(const Dlrr& other) = default; 40 Dlrr& operator=(const Dlrr& other) = default;
42 41
42 // Dlrr without items treated same as no dlrr block.
43 explicit operator bool() const { return !sub_blocks_.empty(); }
44
43 // Second parameter is value read from block header, 45 // Second parameter is value read from block header,
44 // i.e. size of block in 32bits excluding block header itself. 46 // i.e. size of block in 32bits excluding block header itself.
45 bool Parse(const uint8_t* buffer, uint16_t block_length_32bits); 47 bool Parse(const uint8_t* buffer, uint16_t block_length_32bits);
46 48
47 size_t BlockLength() const; 49 size_t BlockLength() const;
48 // Fills buffer with the Dlrr. 50 // Fills buffer with the Dlrr.
49 // Consumes BlockLength() bytes. 51 // Consumes BlockLength() bytes.
50 void Create(uint8_t* buffer) const; 52 void Create(uint8_t* buffer) const;
51 53
52 // Max 100 DLRR Items can be added per DLRR report block. 54 void ClearItems() { sub_blocks_.clear(); }
53 bool AddDlrrItem(const ReceiveTimeInfo& time_info); 55 void AddDlrrItem(const ReceiveTimeInfo& time_info) {
54 bool AddDlrrItem(uint32_t ssrc, uint32_t last_rr, uint32_t delay_last_rr); 56 sub_blocks_.push_back(time_info);
57 }
55 58
56 const std::vector<ReceiveTimeInfo>& sub_blocks() const { return sub_blocks_; } 59 const std::vector<ReceiveTimeInfo>& sub_blocks() const { return sub_blocks_; }
57 60
58 private: 61 private:
59 static const size_t kBlockHeaderLength = 4; 62 static const size_t kBlockHeaderLength = 4;
60 static const size_t kSubBlockLength = 12; 63 static const size_t kSubBlockLength = 12;
61 64
62 std::vector<ReceiveTimeInfo> sub_blocks_; 65 std::vector<ReceiveTimeInfo> sub_blocks_;
63 }; 66 };
64 } // namespace rtcp 67 } // namespace rtcp
65 } // namespace webrtc 68 } // namespace webrtc
66 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_DLRR_H_ 69 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_DLRR_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/source/rtcp_packet/dlrr.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698