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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc

Issue 2549233005: Reject XR TargetBitrate items with unsupported layer indices (Closed)
Patch Set: Addressed comments Created 4 years 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
« no previous file with comments | « webrtc/common_types.cc ('k') | webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "webrtc/modules/rtp_rtcp/source/rtcp_receiver.h" 11 #include "webrtc/modules/rtp_rtcp/source/rtcp_receiver.h"
12 12
13 #include <assert.h> 13 #include <assert.h>
14 #include <string.h> 14 #include <string.h>
15 15
16 #include <limits> 16 #include <limits>
17 #include <map> 17 #include <map>
18 #include <memory> 18 #include <memory>
19 #include <utility> 19 #include <utility>
20 #include <vector> 20 #include <vector>
21 21
22 #include "webrtc/base/checks.h" 22 #include "webrtc/base/checks.h"
23 #include "webrtc/base/logging.h" 23 #include "webrtc/base/logging.h"
24 #include "webrtc/base/trace_event.h" 24 #include "webrtc/base/trace_event.h"
25 #include "webrtc/common_types.h"
25 #include "webrtc/common_video/include/video_bitrate_allocator.h" 26 #include "webrtc/common_video/include/video_bitrate_allocator.h"
26 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h" 27 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h"
27 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/common_header.h" 28 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/common_header.h"
28 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/compound_packet.h" 29 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/compound_packet.h"
29 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_reports.h" 30 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_reports.h"
30 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/fir.h" 31 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/fir.h"
31 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/nack.h" 32 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/nack.h"
32 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/pli.h" 33 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/pli.h"
33 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rapid_resync_request.h" 34 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rapid_resync_request.h"
34 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h" 35 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h"
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 731
731 uint32_t rtt_ntp = now - delay_rr - send_time; 732 uint32_t rtt_ntp = now - delay_rr - send_time;
732 xr_rr_rtt_ms_ = CompactNtpRttToMs(rtt_ntp); 733 xr_rr_rtt_ms_ = CompactNtpRttToMs(rtt_ntp);
733 } 734 }
734 735
735 void RTCPReceiver::HandleXrTargetBitrate( 736 void RTCPReceiver::HandleXrTargetBitrate(
736 const rtcp::TargetBitrate& target_bitrate, 737 const rtcp::TargetBitrate& target_bitrate,
737 PacketInformation* packet_information) { 738 PacketInformation* packet_information) {
738 BitrateAllocation bitrate_allocation; 739 BitrateAllocation bitrate_allocation;
739 for (const auto& item : target_bitrate.GetTargetBitrates()) { 740 for (const auto& item : target_bitrate.GetTargetBitrates()) {
740 bitrate_allocation.SetBitrate(item.spatial_layer, item.temporal_layer, 741 if (item.spatial_layer >= kMaxSpatialLayers ||
741 item.target_bitrate_kbps * 1000); 742 item.temporal_layer >= kMaxTemporalStreams) {
743 LOG(LS_WARNING)
744 << "Invalid layer in XR target bitrate pack: spatial index "
745 << item.spatial_layer << ", temporal index " << item.temporal_layer
746 << ", dropping.";
747 } else {
748 bitrate_allocation.SetBitrate(item.spatial_layer, item.temporal_layer,
749 item.target_bitrate_kbps * 1000);
750 }
742 } 751 }
743 packet_information->target_bitrate_allocation.emplace(bitrate_allocation); 752 packet_information->target_bitrate_allocation.emplace(bitrate_allocation);
744 } 753 }
745 754
746 void RTCPReceiver::HandlePLI(const CommonHeader& rtcp_block, 755 void RTCPReceiver::HandlePLI(const CommonHeader& rtcp_block,
747 PacketInformation* packet_information) { 756 PacketInformation* packet_information) {
748 rtcp::Pli pli; 757 rtcp::Pli pli;
749 if (!pli.Parse(rtcp_block)) { 758 if (!pli.Parse(rtcp_block)) {
750 ++num_skipped_packets_; 759 ++num_skipped_packets_;
751 return; 760 return;
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 } else { 1084 } else {
1076 candidates.push_back(it->second.tmmbr_item); 1085 candidates.push_back(it->second.tmmbr_item);
1077 ++it; 1086 ++it;
1078 } 1087 }
1079 } 1088 }
1080 } 1089 }
1081 return candidates; 1090 return candidates;
1082 } 1091 }
1083 1092
1084 } // namespace webrtc 1093 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/common_types.cc ('k') | webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698