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 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1218 | 1218 |
1219 rtcp::TargetBitrate bitrate; | 1219 rtcp::TargetBitrate bitrate; |
1220 bitrate.AddTargetBitrate(0, 0, expected_allocation.GetBitrate(0, 0) / 1000); | 1220 bitrate.AddTargetBitrate(0, 0, expected_allocation.GetBitrate(0, 0) / 1000); |
1221 bitrate.AddTargetBitrate(0, 1, expected_allocation.GetBitrate(0, 1) / 1000); | 1221 bitrate.AddTargetBitrate(0, 1, expected_allocation.GetBitrate(0, 1) / 1000); |
1222 bitrate.AddTargetBitrate(1, 0, expected_allocation.GetBitrate(1, 0) / 1000); | 1222 bitrate.AddTargetBitrate(1, 0, expected_allocation.GetBitrate(1, 0) / 1000); |
1223 bitrate.AddTargetBitrate(1, 1, expected_allocation.GetBitrate(1, 1) / 1000); | 1223 bitrate.AddTargetBitrate(1, 1, expected_allocation.GetBitrate(1, 1) / 1000); |
1224 | 1224 |
1225 rtcp::ExtendedReports xr; | 1225 rtcp::ExtendedReports xr; |
1226 xr.SetTargetBitrate(bitrate); | 1226 xr.SetTargetBitrate(bitrate); |
1227 | 1227 |
1228 // Wrong sender ssrc, target bitrate should be discarded. | |
1229 xr.SetSenderSsrc(kSenderSsrc + 1); | |
1230 EXPECT_CALL(bitrate_allocation_observer_, | |
1231 OnBitrateAllocationUpdated(expected_allocation)) | |
1232 .Times(0); | |
1233 InjectRtcpPacket(xr); | |
1234 | |
1235 // Set correct ssrc, callback should be called once. | |
1236 xr.SetSenderSsrc(kSenderSsrc); | |
1237 EXPECT_CALL(bitrate_allocation_observer_, | 1228 EXPECT_CALL(bitrate_allocation_observer_, |
1238 OnBitrateAllocationUpdated(expected_allocation)); | 1229 OnBitrateAllocationUpdated(expected_allocation)); |
1239 InjectRtcpPacket(xr); | 1230 InjectRtcpPacket(xr); |
1240 } | 1231 } |
1241 | 1232 |
1242 TEST_F(RtcpReceiverTest, HandlesIncorrectTargetBitrate) { | 1233 TEST_F(RtcpReceiverTest, HandlesIncorrectTargetBitrate) { |
1243 BitrateAllocation expected_allocation; | 1234 BitrateAllocation expected_allocation; |
1244 expected_allocation.SetBitrate(0, 0, 10000); | 1235 expected_allocation.SetBitrate(0, 0, 10000); |
1245 | 1236 |
1246 rtcp::TargetBitrate bitrate; | 1237 rtcp::TargetBitrate bitrate; |
1247 bitrate.AddTargetBitrate(0, 0, expected_allocation.GetBitrate(0, 0) / 1000); | 1238 bitrate.AddTargetBitrate(0, 0, expected_allocation.GetBitrate(0, 0) / 1000); |
1248 bitrate.AddTargetBitrate(0, kMaxTemporalStreams, 20000); | 1239 bitrate.AddTargetBitrate(0, kMaxTemporalStreams, 20000); |
1249 bitrate.AddTargetBitrate(kMaxSpatialLayers, 0, 40000); | 1240 bitrate.AddTargetBitrate(kMaxSpatialLayers, 0, 40000); |
1250 | 1241 |
1251 rtcp::ExtendedReports xr; | 1242 rtcp::ExtendedReports xr; |
1252 xr.SetTargetBitrate(bitrate); | 1243 xr.SetTargetBitrate(bitrate); |
1253 xr.SetSenderSsrc(kSenderSsrc); | |
1254 | 1244 |
1255 EXPECT_CALL(bitrate_allocation_observer_, | 1245 EXPECT_CALL(bitrate_allocation_observer_, |
1256 OnBitrateAllocationUpdated(expected_allocation)); | 1246 OnBitrateAllocationUpdated(expected_allocation)); |
1257 InjectRtcpPacket(xr); | 1247 InjectRtcpPacket(xr); |
1258 } | 1248 } |
1259 | 1249 |
1260 } // namespace webrtc | 1250 } // namespace webrtc |
OLD | NEW |