| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 RtcpPacket::PacketReadyCallback* callback) const { | 803 RtcpPacket::PacketReadyCallback* callback) const { |
| 804 while (*index + BlockLength() > max_length) { | 804 while (*index + BlockLength() > max_length) { |
| 805 if (!OnBufferFull(packet, index, callback)) | 805 if (!OnBufferFull(packet, index, callback)) |
| 806 return false; | 806 return false; |
| 807 } | 807 } |
| 808 CreateSenderReport(sr_, BlockToHeaderLength(BlockLength()), packet, index); | 808 CreateSenderReport(sr_, BlockToHeaderLength(BlockLength()), packet, index); |
| 809 CreateReportBlocks(report_blocks_, packet, index); | 809 CreateReportBlocks(report_blocks_, packet, index); |
| 810 return true; | 810 return true; |
| 811 } | 811 } |
| 812 | 812 |
| 813 bool SenderReport::WithReportBlock(ReportBlock* block) { | 813 bool SenderReport::WithReportBlock(const ReportBlock& block) { |
| 814 assert(block); | |
| 815 if (report_blocks_.size() >= kMaxNumberOfReportBlocks) { | 814 if (report_blocks_.size() >= kMaxNumberOfReportBlocks) { |
| 816 LOG(LS_WARNING) << "Max report blocks reached."; | 815 LOG(LS_WARNING) << "Max report blocks reached."; |
| 817 return false; | 816 return false; |
| 818 } | 817 } |
| 819 report_blocks_.push_back(block->report_block_); | 818 report_blocks_.push_back(block.report_block_); |
| 820 sr_.NumberOfReportBlocks = report_blocks_.size(); | 819 sr_.NumberOfReportBlocks = report_blocks_.size(); |
| 821 return true; | 820 return true; |
| 822 } | 821 } |
| 823 | 822 |
| 824 bool ReceiverReport::Create(uint8_t* packet, | 823 bool ReceiverReport::Create(uint8_t* packet, |
| 825 size_t* index, | 824 size_t* index, |
| 826 size_t max_length, | 825 size_t max_length, |
| 827 RtcpPacket::PacketReadyCallback* callback) const { | 826 RtcpPacket::PacketReadyCallback* callback) const { |
| 828 while (*index + BlockLength() > max_length) { | 827 while (*index + BlockLength() > max_length) { |
| 829 if (!OnBufferFull(packet, index, callback)) | 828 if (!OnBufferFull(packet, index, callback)) |
| 830 return false; | 829 return false; |
| 831 } | 830 } |
| 832 CreateReceiverReport(rr_, BlockToHeaderLength(BlockLength()), packet, index); | 831 CreateReceiverReport(rr_, BlockToHeaderLength(BlockLength()), packet, index); |
| 833 CreateReportBlocks(report_blocks_, packet, index); | 832 CreateReportBlocks(report_blocks_, packet, index); |
| 834 return true; | 833 return true; |
| 835 } | 834 } |
| 836 | 835 |
| 837 bool ReceiverReport::WithReportBlock(ReportBlock* block) { | 836 bool ReceiverReport::WithReportBlock(const ReportBlock& block) { |
| 838 assert(block); | |
| 839 if (report_blocks_.size() >= kMaxNumberOfReportBlocks) { | 837 if (report_blocks_.size() >= kMaxNumberOfReportBlocks) { |
| 840 LOG(LS_WARNING) << "Max report blocks reached."; | 838 LOG(LS_WARNING) << "Max report blocks reached."; |
| 841 return false; | 839 return false; |
| 842 } | 840 } |
| 843 report_blocks_.push_back(block->report_block_); | 841 report_blocks_.push_back(block.report_block_); |
| 844 rr_.NumberOfReportBlocks = report_blocks_.size(); | 842 rr_.NumberOfReportBlocks = report_blocks_.size(); |
| 845 return true; | 843 return true; |
| 846 } | 844 } |
| 847 | 845 |
| 848 bool Ij::Create(uint8_t* packet, | 846 bool Ij::Create(uint8_t* packet, |
| 849 size_t* index, | 847 size_t* index, |
| 850 size_t max_length, | 848 size_t max_length, |
| 851 RtcpPacket::PacketReadyCallback* callback) const { | 849 RtcpPacket::PacketReadyCallback* callback) const { |
| 852 while (*index + BlockLength() > max_length) { | 850 while (*index + BlockLength() > max_length) { |
| 853 if (!OnBufferFull(packet, index, callback)) | 851 if (!OnBufferFull(packet, index, callback)) |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1231 return length_; | 1229 return length_; |
| 1232 } | 1230 } |
| 1233 | 1231 |
| 1234 void RawPacket::SetLength(size_t length) { | 1232 void RawPacket::SetLength(size_t length) { |
| 1235 assert(length <= buffer_length_); | 1233 assert(length <= buffer_length_); |
| 1236 length_ = length; | 1234 length_ = length; |
| 1237 } | 1235 } |
| 1238 | 1236 |
| 1239 } // namespace rtcp | 1237 } // namespace rtcp |
| 1240 } // namespace webrtc | 1238 } // namespace webrtc |
| OLD | NEW |