OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 } | 452 } |
453 | 453 |
454 int32_t RTCPSender::AddReportBlock(const RTCPReportBlock& report_block) { | 454 int32_t RTCPSender::AddReportBlock(const RTCPReportBlock& report_block) { |
455 if (report_blocks_.size() >= RTCP_MAX_REPORT_BLOCKS) { | 455 if (report_blocks_.size() >= RTCP_MAX_REPORT_BLOCKS) { |
456 LOG(LS_WARNING) << "Too many report blocks."; | 456 LOG(LS_WARNING) << "Too many report blocks."; |
457 return -1; | 457 return -1; |
458 } | 458 } |
459 rtcp::ReportBlock* block = &report_blocks_[report_block.remoteSSRC]; | 459 rtcp::ReportBlock* block = &report_blocks_[report_block.remoteSSRC]; |
460 block->To(report_block.remoteSSRC); | 460 block->To(report_block.remoteSSRC); |
461 block->WithFractionLost(report_block.fractionLost); | 461 block->WithFractionLost(report_block.fractionLost); |
462 block->WithCumulativeLost(report_block.cumulativeLost); | 462 if (!block->WithCumulativeLost(report_block.cumulativeLost)) { |
| 463 LOG(LS_WARNING) << "Cumulative lost is oversized."; |
| 464 return -1; |
| 465 } |
463 block->WithExtHighestSeqNum(report_block.extendedHighSeqNum); | 466 block->WithExtHighestSeqNum(report_block.extendedHighSeqNum); |
464 block->WithJitter(report_block.jitter); | 467 block->WithJitter(report_block.jitter); |
465 block->WithLastSr(report_block.lastSR); | 468 block->WithLastSr(report_block.lastSR); |
466 block->WithDelayLastSr(report_block.delaySinceLastSR); | 469 block->WithDelayLastSr(report_block.delaySinceLastSR); |
467 | 470 |
468 return 0; | 471 return 0; |
469 } | 472 } |
470 | 473 |
471 RTCPSender::BuildResult RTCPSender::BuildSR(RtcpContext* ctx) { | 474 RTCPSender::BuildResult RTCPSender::BuildSR(RtcpContext* ctx) { |
472 for (int i = (RTCP_NUMBER_OF_SR - 2); i >= 0; i--) { | 475 for (int i = (RTCP_NUMBER_OF_SR - 2); i >= 0; i--) { |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 } | 1020 } |
1018 next_time_to_send_rtcp_ = clock_->TimeInMilliseconds() + timeToNext; | 1021 next_time_to_send_rtcp_ = clock_->TimeInMilliseconds() + timeToNext; |
1019 | 1022 |
1020 StatisticianMap statisticians = | 1023 StatisticianMap statisticians = |
1021 receive_statistics_->GetActiveStatisticians(); | 1024 receive_statistics_->GetActiveStatisticians(); |
1022 if (!statisticians.empty()) { | 1025 if (!statisticians.empty()) { |
1023 for (auto it = statisticians.begin(); it != statisticians.end(); ++it) { | 1026 for (auto it = statisticians.begin(); it != statisticians.end(); ++it) { |
1024 RTCPReportBlock report_block; | 1027 RTCPReportBlock report_block; |
1025 if (PrepareReport(feedback_state, it->first, it->second, | 1028 if (PrepareReport(feedback_state, it->first, it->second, |
1026 &report_block)) { | 1029 &report_block)) { |
| 1030 // TODO(danilchap) AddReportBlock may fail (for 2 different reasons). |
| 1031 // Probably it shouldn't be ignored. |
1027 AddReportBlock(report_block); | 1032 AddReportBlock(report_block); |
1028 } | 1033 } |
1029 } | 1034 } |
1030 } | 1035 } |
1031 } | 1036 } |
1032 | 1037 |
1033 auto it = report_flags_.begin(); | 1038 auto it = report_flags_.begin(); |
1034 while (it != report_flags_.end()) { | 1039 while (it != report_flags_.end()) { |
1035 auto builder = builders_.find(it->type); | 1040 auto builder = builders_.find(it->type); |
1036 RTC_DCHECK(builder != builders_.end()); | 1041 RTC_DCHECK(builder != builders_.end()); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1214 Transport* const transport_; | 1219 Transport* const transport_; |
1215 bool send_failure_; | 1220 bool send_failure_; |
1216 } sender(transport_); | 1221 } sender(transport_); |
1217 | 1222 |
1218 uint8_t buffer[IP_PACKET_SIZE]; | 1223 uint8_t buffer[IP_PACKET_SIZE]; |
1219 return packet.BuildExternalBuffer(buffer, IP_PACKET_SIZE, &sender) && | 1224 return packet.BuildExternalBuffer(buffer, IP_PACKET_SIZE, &sender) && |
1220 !sender.send_failure_; | 1225 !sender.send_failure_; |
1221 } | 1226 } |
1222 | 1227 |
1223 } // namespace webrtc | 1228 } // namespace webrtc |
OLD | NEW |