Chromium Code Reviews| 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 277 for (; it != _receivedReportBlockMap.end(); ++it) { | 277 for (; it != _receivedReportBlockMap.end(); ++it) { |
| 278 const ReportBlockInfoMap* info_map = &(it->second); | 278 const ReportBlockInfoMap* info_map = &(it->second); |
| 279 ReportBlockInfoMap::const_iterator it_info = info_map->begin(); | 279 ReportBlockInfoMap::const_iterator it_info = info_map->begin(); |
| 280 for (; it_info != info_map->end(); ++it_info) { | 280 for (; it_info != info_map->end(); ++it_info) { |
| 281 receiveBlocks->push_back(it_info->second->remoteReceiveBlock); | 281 receiveBlocks->push_back(it_info->second->remoteReceiveBlock); |
| 282 } | 282 } |
| 283 } | 283 } |
| 284 return 0; | 284 return 0; |
| 285 } | 285 } |
| 286 | 286 |
| 287 int32_t | 287 bool RTCPReceiver::IncomingPacket(const uint8_t* buffer, size_t length) { |
| 288 RTCPReceiver::IncomingRTCPPacket(RTCPPacketInformation& rtcpPacketInformation, | 288 // Allow receive of non-compound RTCP packets. |
| 289 RTCPUtility::RTCPParserV2* rtcpParser) | 289 RTCPUtility::RTCPParserV2 rtcp_parser(buffer, length, true); |
| 290 { | 290 |
| 291 const bool valid_rtcpheader = rtcp_parser.IsValid(); | |
| 292 if (!valid_rtcpheader) { | |
|
philipel
2016/02/24 11:02:01
Replace with if(!rtcp_parser.IsValid()) and remove
danilchap
2016/02/24 12:53:11
Actually yes: rtcp_parser do slightly more than va
| |
| 293 LOG(LS_WARNING) << "Incoming invalid RTCP packet"; | |
| 294 return false; | |
| 295 } | |
| 296 RTCPHelp::RTCPPacketInformation rtcp_packet_information; | |
| 297 IncomingRTCPPacket(rtcp_packet_information, &rtcp_parser); | |
| 298 TriggerCallbacksFromRTCPPacket(rtcp_packet_information); | |
| 299 return true; | |
| 300 } | |
| 301 | |
| 302 void RTCPReceiver::IncomingRTCPPacket( | |
| 303 RTCPPacketInformation& rtcpPacketInformation, | |
| 304 RTCPUtility::RTCPParserV2* rtcpParser) { | |
| 291 CriticalSectionScoped lock(_criticalSectionRTCPReceiver); | 305 CriticalSectionScoped lock(_criticalSectionRTCPReceiver); |
| 292 | 306 |
| 293 _lastReceived = _clock->TimeInMilliseconds(); | 307 _lastReceived = _clock->TimeInMilliseconds(); |
| 294 | 308 |
| 295 if (packet_type_counter_.first_packet_time_ms == -1) { | 309 if (packet_type_counter_.first_packet_time_ms == -1) { |
| 296 packet_type_counter_.first_packet_time_ms = _lastReceived; | 310 packet_type_counter_.first_packet_time_ms = _lastReceived; |
| 297 } | 311 } |
| 298 | 312 |
| 299 RTCPUtility::RTCPPacketTypes pktType = rtcpParser->Begin(); | 313 RTCPUtility::RTCPPacketTypes pktType = rtcpParser->Begin(); |
| 300 while (pktType != RTCPPacketTypes::kInvalid) { | 314 while (pktType != RTCPPacketTypes::kInvalid) { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 382 int64_t now = _clock->TimeInMilliseconds(); | 396 int64_t now = _clock->TimeInMilliseconds(); |
| 383 if (now - last_skipped_packets_warning_ >= kMaxWarningLogIntervalMs && | 397 if (now - last_skipped_packets_warning_ >= kMaxWarningLogIntervalMs && |
| 384 num_skipped_packets_ > 0) { | 398 num_skipped_packets_ > 0) { |
| 385 last_skipped_packets_warning_ = now; | 399 last_skipped_packets_warning_ = now; |
| 386 LOG(LS_WARNING) | 400 LOG(LS_WARNING) |
| 387 << num_skipped_packets_ | 401 << num_skipped_packets_ |
| 388 << " RTCP blocks were skipped due to being malformed or of " | 402 << " RTCP blocks were skipped due to being malformed or of " |
| 389 "unrecognized/unsupported type, during the past " | 403 "unrecognized/unsupported type, during the past " |
| 390 << (kMaxWarningLogIntervalMs / 1000) << " second period."; | 404 << (kMaxWarningLogIntervalMs / 1000) << " second period."; |
| 391 } | 405 } |
| 392 | |
| 393 return 0; | |
| 394 } | 406 } |
| 395 | 407 |
| 396 void | 408 void |
| 397 RTCPReceiver::HandleSenderReceiverReport(RTCPUtility::RTCPParserV2& rtcpParser, | 409 RTCPReceiver::HandleSenderReceiverReport(RTCPUtility::RTCPParserV2& rtcpParser, |
| 398 RTCPPacketInformation& rtcpPacketInform ation) | 410 RTCPPacketInformation& rtcpPacketInform ation) |
| 399 { | 411 { |
| 400 RTCPUtility::RTCPPacketTypes rtcpPacketType = rtcpParser.PacketType(); | 412 RTCPUtility::RTCPPacketTypes rtcpPacketType = rtcpParser.PacketType(); |
| 401 const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet(); | 413 const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet(); |
| 402 | 414 |
| 403 assert((rtcpPacketType == RTCPPacketTypes::kRr) || | 415 assert((rtcpPacketType == RTCPPacketTypes::kRr) || |
| (...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1446 return -1; | 1458 return -1; |
| 1447 } | 1459 } |
| 1448 num += receiveInfo->TmmbrSet.lengthOfSet(); | 1460 num += receiveInfo->TmmbrSet.lengthOfSet(); |
| 1449 receiveInfoIt++; | 1461 receiveInfoIt++; |
| 1450 } | 1462 } |
| 1451 } | 1463 } |
| 1452 return num; | 1464 return num; |
| 1453 } | 1465 } |
| 1454 | 1466 |
| 1455 } // namespace webrtc | 1467 } // namespace webrtc |
| OLD | NEW |