| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 const uint32_t bitrate = codec_.simulcastStream[0].targetBitrate + | 201 const uint32_t bitrate = codec_.simulcastStream[0].targetBitrate + |
| 202 codec_.simulcastStream[1].targetBitrate + | 202 codec_.simulcastStream[1].targetBitrate + |
| 203 codec_.simulcastStream[2].maxBitrate; | 203 codec_.simulcastStream[2].maxBitrate; |
| 204 uint32_t expected[] = {codec_.simulcastStream[0].targetBitrate, | 204 uint32_t expected[] = {codec_.simulcastStream[0].targetBitrate, |
| 205 codec_.simulcastStream[1].targetBitrate, | 205 codec_.simulcastStream[1].targetBitrate, |
| 206 codec_.simulcastStream[2].maxBitrate}; | 206 codec_.simulcastStream[2].maxBitrate}; |
| 207 ExpectEqual(expected, allocator_->GetAllocation(bitrate)); | 207 ExpectEqual(expected, allocator_->GetAllocation(bitrate)); |
| 208 } | 208 } |
| 209 } | 209 } |
| 210 | 210 |
| 211 TEST_F(SimulcastRateAllocatorTest, GetPreferredBitrate) { |
| 212 EXPECT_EQ(codec_.maxBitrate, allocator_->GetPreferedBitrate()); |
| 213 } |
| 214 |
| 215 TEST_F(SimulcastRateAllocatorTest, GetPreferredBitrateSimulcast) { |
| 216 codec_.numberOfSimulcastStreams = 3; |
| 217 codec_.maxBitrate = 999999; |
| 218 codec_.simulcastStream[0].minBitrate = 10; |
| 219 codec_.simulcastStream[0].targetBitrate = 100; |
| 220 |
| 221 codec_.simulcastStream[0].maxBitrate = 500; |
| 222 codec_.simulcastStream[1].minBitrate = 50; |
| 223 codec_.simulcastStream[1].targetBitrate = 500; |
| 224 codec_.simulcastStream[1].maxBitrate = 1000; |
| 225 |
| 226 codec_.simulcastStream[2].minBitrate = 2000; |
| 227 codec_.simulcastStream[2].targetBitrate = 3000; |
| 228 codec_.simulcastStream[2].maxBitrate = 4000; |
| 229 CreateAllocator(); |
| 230 |
| 231 uint32_t preferred_bitrate; |
| 232 preferred_bitrate = codec_.simulcastStream[0].targetBitrate; |
| 233 preferred_bitrate += codec_.simulcastStream[1].targetBitrate; |
| 234 preferred_bitrate += codec_.simulcastStream[2].maxBitrate; |
| 235 |
| 236 EXPECT_EQ(preferred_bitrate, allocator_->GetPreferedBitrate()); |
| 237 } |
| 238 |
| 211 } // namespace webrtc | 239 } // namespace webrtc |
| OLD | NEW |