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 1279 matching lines...) Loading... | |
1290 bitrate.AddTargetBitrate(1, 1, expected_allocation.GetBitrate(1, 1) / 1000); | 1290 bitrate.AddTargetBitrate(1, 1, expected_allocation.GetBitrate(1, 1) / 1000); |
1291 | 1291 |
1292 rtcp::ExtendedReports xr; | 1292 rtcp::ExtendedReports xr; |
1293 xr.SetTargetBitrate(bitrate); | 1293 xr.SetTargetBitrate(bitrate); |
1294 | 1294 |
1295 EXPECT_CALL(bitrate_allocation_observer_, | 1295 EXPECT_CALL(bitrate_allocation_observer_, |
1296 OnBitrateAllocationUpdated(expected_allocation)); | 1296 OnBitrateAllocationUpdated(expected_allocation)); |
1297 InjectRtcpPacket(xr); | 1297 InjectRtcpPacket(xr); |
1298 } | 1298 } |
1299 | 1299 |
1300 TEST_F(RtcpReceiverTest, HandlesIncorrectTargetBitrate) { | |
1301 BitrateAllocation expected_allocation; | |
1302 expected_allocation.SetBitrate(0, 0, 10000); | |
1303 | |
1304 rtcp::TargetBitrate bitrate; | |
1305 bitrate.AddTargetBitrate(0, 0, expected_allocation.GetBitrate(0, 0) / 1000); | |
1306 bitrate.AddTargetBitrate(0, kMaxTemporalStreams - 1, 20000); | |
danilchap
2016/12/06 13:12:56
rtcp::TargetBitrate has different limits for tempo
sprang_webrtc
2016/12/06 13:22:41
You're right. Done.
| |
1307 bitrate.AddTargetBitrate(kMaxSpatialLayers - 1, 0, 40000); | |
1308 | |
1309 rtcp::ExtendedReports xr; | |
1310 xr.SetTargetBitrate(bitrate); | |
1311 | |
1312 // Build the actual RTCP bytestream, so that we can set illegal layer ids. | |
1313 rtc::Buffer buffer = xr.Build(); | |
1314 const size_t kHeaderLength = 12; // RTCP + XR + TargetBitrate. | |
1315 const size_t kBirateItemSize = 4; | |
1316 EXPECT_EQ(kHeaderLength + (3 * kBirateItemSize), buffer.size()); | |
1317 | |
1318 EXPECT_EQ(0U, buffer[kHeaderLength + (kBirateItemSize * 0)]); | |
1319 | |
1320 EXPECT_EQ(kMaxTemporalStreams - 1, | |
1321 buffer[kHeaderLength + (kBirateItemSize * 1)]); | |
1322 buffer[kHeaderLength + (kBirateItemSize * 1)] = kMaxTemporalStreams; | |
1323 | |
1324 EXPECT_EQ((kMaxSpatialLayers - 1) << 4, | |
1325 buffer[kHeaderLength + (kBirateItemSize * 2)]); | |
1326 buffer[kHeaderLength + (kBirateItemSize * 2)] = kMaxSpatialLayers << 4; | |
1327 | |
1328 EXPECT_CALL(bitrate_allocation_observer_, | |
1329 OnBitrateAllocationUpdated(expected_allocation)); | |
1330 InjectRtcpPacket(buffer); | |
1331 } | |
1332 | |
1300 } // namespace webrtc | 1333 } // namespace webrtc |
OLD | NEW |