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. | |
danilchap
2017/08/23 10:33:55
may be explicitly set wrong sender ssrc, e.g.
xr.S
sprang_webrtc
2017/08/23 10:38:11
Done.
| |
1228 EXPECT_CALL(bitrate_allocation_observer_, | 1229 EXPECT_CALL(bitrate_allocation_observer_, |
1229 OnBitrateAllocationUpdated(expected_allocation)); | 1230 OnBitrateAllocationUpdated(expected_allocation)) |
1231 .Times(0); | |
1232 InjectRtcpPacket(xr); | |
1233 | |
1234 // Set correct ssrc, callback should be called once. | |
1235 xr.SetSenderSsrc(kSenderSsrc); | |
1236 EXPECT_CALL(bitrate_allocation_observer_, | |
1237 OnBitrateAllocationUpdated(expected_allocation)) | |
1238 .Times(1); | |
danilchap
2017/08/23 10:33:55
EXPECT_CALLs nearby omit Times(1)
sprang_webrtc
2017/08/23 10:38:11
Done.
| |
1230 InjectRtcpPacket(xr); | 1239 InjectRtcpPacket(xr); |
1231 } | 1240 } |
1232 | 1241 |
1233 TEST_F(RtcpReceiverTest, HandlesIncorrectTargetBitrate) { | 1242 TEST_F(RtcpReceiverTest, HandlesIncorrectTargetBitrate) { |
1234 BitrateAllocation expected_allocation; | 1243 BitrateAllocation expected_allocation; |
1235 expected_allocation.SetBitrate(0, 0, 10000); | 1244 expected_allocation.SetBitrate(0, 0, 10000); |
1236 | 1245 |
1237 rtcp::TargetBitrate bitrate; | 1246 rtcp::TargetBitrate bitrate; |
1238 bitrate.AddTargetBitrate(0, 0, expected_allocation.GetBitrate(0, 0) / 1000); | 1247 bitrate.AddTargetBitrate(0, 0, expected_allocation.GetBitrate(0, 0) / 1000); |
1239 bitrate.AddTargetBitrate(0, kMaxTemporalStreams, 20000); | 1248 bitrate.AddTargetBitrate(0, kMaxTemporalStreams, 20000); |
1240 bitrate.AddTargetBitrate(kMaxSpatialLayers, 0, 40000); | 1249 bitrate.AddTargetBitrate(kMaxSpatialLayers, 0, 40000); |
1241 | 1250 |
1242 rtcp::ExtendedReports xr; | 1251 rtcp::ExtendedReports xr; |
1243 xr.SetTargetBitrate(bitrate); | 1252 xr.SetTargetBitrate(bitrate); |
1244 | 1253 |
1245 EXPECT_CALL(bitrate_allocation_observer_, | 1254 EXPECT_CALL(bitrate_allocation_observer_, |
1246 OnBitrateAllocationUpdated(expected_allocation)); | 1255 OnBitrateAllocationUpdated(expected_allocation)); |
1247 InjectRtcpPacket(xr); | 1256 InjectRtcpPacket(xr); |
1248 } | 1257 } |
1249 | 1258 |
1250 } // namespace webrtc | 1259 } // namespace webrtc |
OLD | NEW |