OLD | NEW |
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 sender_ssrc_ = ByteReader<uint32_t>::ReadBigEndian(packet.payload()); | 43 sender_ssrc_ = ByteReader<uint32_t>::ReadBigEndian(packet.payload()); |
44 | 44 |
45 const uint8_t* next_report_block = packet.payload() + kRrBaseLength; | 45 const uint8_t* next_report_block = packet.payload() + kRrBaseLength; |
46 | 46 |
47 report_blocks_.resize(report_blocks_count); | 47 report_blocks_.resize(report_blocks_count); |
48 for (ReportBlock& block : report_blocks_) { | 48 for (ReportBlock& block : report_blocks_) { |
49 block.Parse(next_report_block, ReportBlock::kLength); | 49 block.Parse(next_report_block, ReportBlock::kLength); |
50 next_report_block += ReportBlock::kLength; | 50 next_report_block += ReportBlock::kLength; |
51 } | 51 } |
52 | 52 |
53 RTC_DCHECK_EQ(next_report_block - packet.payload(), | 53 RTC_DCHECK_LE(next_report_block - packet.payload(), |
54 static_cast<ptrdiff_t>(packet.payload_size_bytes())); | 54 static_cast<ptrdiff_t>(packet.payload_size_bytes())); |
55 return true; | 55 return true; |
56 } | 56 } |
57 | 57 |
58 bool ReceiverReport::Create(uint8_t* packet, | 58 bool ReceiverReport::Create(uint8_t* packet, |
59 size_t* index, | 59 size_t* index, |
60 size_t max_length, | 60 size_t max_length, |
61 RtcpPacket::PacketReadyCallback* callback) const { | 61 RtcpPacket::PacketReadyCallback* callback) const { |
62 while (*index + BlockLength() > max_length) { | 62 while (*index + BlockLength() > max_length) { |
63 if (!OnBufferFull(packet, index, callback)) | 63 if (!OnBufferFull(packet, index, callback)) |
(...skipping 14 matching lines...) Expand all Loading... |
78 if (report_blocks_.size() >= kMaxNumberOfReportBlocks) { | 78 if (report_blocks_.size() >= kMaxNumberOfReportBlocks) { |
79 LOG(LS_WARNING) << "Max report blocks reached."; | 79 LOG(LS_WARNING) << "Max report blocks reached."; |
80 return false; | 80 return false; |
81 } | 81 } |
82 report_blocks_.push_back(block); | 82 report_blocks_.push_back(block); |
83 return true; | 83 return true; |
84 } | 84 } |
85 | 85 |
86 } // namespace rtcp | 86 } // namespace rtcp |
87 } // namespace webrtc | 87 } // namespace webrtc |
OLD | NEW |