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

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

Issue 2991623002: Add SetReportBlocks to rtcp Sender/Receive Report classes. (Closed)
Patch Set: More comments Created 3 years, 4 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) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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/sender_report.h" 11 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_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 SenderReport::kPacketType; 22 constexpr uint8_t SenderReport::kPacketType;
23 constexpr size_t SenderReport::kMaxNumberOfReportBlocks;
eladalon 2017/07/25 13:26:09 I don't think these two are necessary. Maybe only
danilchap 2017/07/25 13:39:00 it might not be used right now, but when it is nee
21 // Sender report (SR) (RFC 3550). 24 // Sender report (SR) (RFC 3550).
22 // 0 1 2 3 25 // 0 1 2 3
23 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 26 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
24 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 27 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
25 // |V=2|P| RC | PT=SR=200 | length | 28 // |V=2|P| RC | PT=SR=200 | length |
26 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 29 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
27 // 0 | SSRC of sender | 30 // 0 | SSRC of sender |
28 // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ 31 // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
29 // 4 | NTP timestamp, most significant word | 32 // 4 | NTP timestamp, most significant word |
30 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 33 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 118
116 bool SenderReport::AddReportBlock(const ReportBlock& block) { 119 bool SenderReport::AddReportBlock(const ReportBlock& block) {
117 if (report_blocks_.size() >= kMaxNumberOfReportBlocks) { 120 if (report_blocks_.size() >= kMaxNumberOfReportBlocks) {
118 LOG(LS_WARNING) << "Max report blocks reached."; 121 LOG(LS_WARNING) << "Max report blocks reached.";
119 return false; 122 return false;
120 } 123 }
121 report_blocks_.push_back(block); 124 report_blocks_.push_back(block);
122 return true; 125 return true;
123 } 126 }
124 127
128 bool SenderReport::SetReportBlocks(std::vector<ReportBlock> blocks) {
129 if (blocks.size() > kMaxNumberOfReportBlocks) {
130 LOG(LS_WARNING) << "Too many report blocks (" << blocks.size()
131 << ") for sender report.";
132 return false;
133 }
134 report_blocks_ = std::move(blocks);
135 return true;
136 }
137
125 } // namespace rtcp 138 } // namespace rtcp
126 } // namespace webrtc 139 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698