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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.cc

Issue 2981163003: Refactor rtcp statistics: Rtcp module take narrow interface (Closed)
Patch Set: Created 3 years, 5 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
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
11 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h" 11 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h"
12 12
13 #include <utility>
14
13 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" 15 #include "webrtc/modules/rtp_rtcp/source/byte_io.h"
14 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/common_header.h" 16 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/common_header.h"
15 #include "webrtc/rtc_base/checks.h" 17 #include "webrtc/rtc_base/checks.h"
16 #include "webrtc/rtc_base/logging.h" 18 #include "webrtc/rtc_base/logging.h"
17 19
18 namespace webrtc { 20 namespace webrtc {
19 namespace rtcp { 21 namespace rtcp {
20 constexpr uint8_t ReceiverReport::kPacketType; 22 constexpr uint8_t ReceiverReport::kPacketType;
21 // RTCP receiver report (RFC 3550). 23 // RTCP receiver report (RFC 3550).
22 // 24 //
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 index); 79 index);
78 ByteWriter<uint32_t>::WriteBigEndian(packet + *index, sender_ssrc_); 80 ByteWriter<uint32_t>::WriteBigEndian(packet + *index, sender_ssrc_);
79 *index += kRrBaseLength; 81 *index += kRrBaseLength;
80 for (const ReportBlock& block : report_blocks_) { 82 for (const ReportBlock& block : report_blocks_) {
81 block.Create(packet + *index); 83 block.Create(packet + *index);
82 *index += ReportBlock::kLength; 84 *index += ReportBlock::kLength;
83 } 85 }
84 return true; 86 return true;
85 } 87 }
86 88
89 bool ReceiverReport::SetReportBlocks(std::vector<ReportBlock> blocks) {
90 if (blocks.size() > kMaxNumberOfReportBlocks) {
91 LOG(LS_WARNING) << "Max report blocks reached.";
92 return false;
93 }
94 report_blocks_ = std::move(blocks);
95 return true;
96 }
97
87 bool ReceiverReport::AddReportBlock(const ReportBlock& block) { 98 bool ReceiverReport::AddReportBlock(const ReportBlock& block) {
88 if (report_blocks_.size() >= kMaxNumberOfReportBlocks) { 99 if (report_blocks_.size() >= kMaxNumberOfReportBlocks) {
89 LOG(LS_WARNING) << "Max report blocks reached."; 100 LOG(LS_WARNING) << "Max report blocks reached.";
90 return false; 101 return false;
91 } 102 }
92 report_blocks_.push_back(block); 103 report_blocks_.push_back(block);
93 return true; 104 return true;
94 } 105 }
95 106
96 } // namespace rtcp 107 } // namespace rtcp
97 } // namespace webrtc 108 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698