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 11 matching lines...) Expand all Loading... |
22 namespace { | 22 namespace { |
23 using ::testing::_; | 23 using ::testing::_; |
24 | 24 |
25 constexpr uint32_t kMinBitrateKbps = 50; | 25 constexpr uint32_t kMinBitrateKbps = 50; |
26 constexpr uint32_t kTargetBitrateKbps = 100; | 26 constexpr uint32_t kTargetBitrateKbps = 100; |
27 constexpr uint32_t kMaxBitrateKbps = 1000; | 27 constexpr uint32_t kMaxBitrateKbps = 1000; |
28 constexpr uint32_t kFramerateFps = 5; | 28 constexpr uint32_t kFramerateFps = 5; |
29 | 29 |
30 class MockTemporalLayers : public TemporalLayers { | 30 class MockTemporalLayers : public TemporalLayers { |
31 public: | 31 public: |
32 MOCK_METHOD1(UpdateLayerConfig, TemporalReferences(uint32_t)); | 32 MOCK_METHOD1(UpdateLayerConfig, TemporalLayers::FrameConfig(uint32_t)); |
33 MOCK_METHOD3(OnRatesUpdated, std::vector<uint32_t>(int, int, int)); | 33 MOCK_METHOD3(OnRatesUpdated, std::vector<uint32_t>(int, int, int)); |
34 MOCK_METHOD1(UpdateConfiguration, bool(vpx_codec_enc_cfg_t*)); | 34 MOCK_METHOD1(UpdateConfiguration, bool(vpx_codec_enc_cfg_t*)); |
35 MOCK_METHOD3(PopulateCodecSpecific, | 35 MOCK_METHOD4(PopulateCodecSpecific, |
36 void(bool, CodecSpecificInfoVP8*, uint32_t)); | 36 void(bool, |
| 37 const TemporalLayers::FrameConfig&, |
| 38 CodecSpecificInfoVP8*, |
| 39 uint32_t)); |
37 MOCK_METHOD2(FrameEncoded, void(unsigned int, int)); | 40 MOCK_METHOD2(FrameEncoded, void(unsigned int, int)); |
38 MOCK_CONST_METHOD0(CurrentLayerId, int()); | |
39 MOCK_CONST_METHOD0(Tl0PicIdx, uint8_t()); | 41 MOCK_CONST_METHOD0(Tl0PicIdx, uint8_t()); |
| 42 MOCK_CONST_METHOD1(GetTemporalLayerId, |
| 43 int(const TemporalLayers::FrameConfig&)); |
40 }; | 44 }; |
41 } // namespace | 45 } // namespace |
42 | 46 |
43 class SimulcastRateAllocatorTest : public ::testing::TestWithParam<bool> { | 47 class SimulcastRateAllocatorTest : public ::testing::TestWithParam<bool> { |
44 public: | 48 public: |
45 SimulcastRateAllocatorTest() { | 49 SimulcastRateAllocatorTest() { |
46 memset(&codec_, 0, sizeof(VideoCodec)); | 50 memset(&codec_, 0, sizeof(VideoCodec)); |
47 codec_.minBitrate = kMinBitrateKbps; | 51 codec_.minBitrate = kMinBitrateKbps; |
48 codec_.targetBitrate = kTargetBitrateKbps; | 52 codec_.targetBitrate = kTargetBitrateKbps; |
49 codec_.maxBitrate = kMaxBitrateKbps; | 53 codec_.maxBitrate = kMaxBitrateKbps; |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 allocator_->GetAllocation(kMaxBitrateKbps * 2000, kFramerateFps); | 367 allocator_->GetAllocation(kMaxBitrateKbps * 2000, kFramerateFps); |
364 | 368 |
365 // Fill both TL0 and TL1, but no more. | 369 // Fill both TL0 and TL1, but no more. |
366 EXPECT_EQ(kMaxBitrateKbps, allocation.get_sum_kbps()); | 370 EXPECT_EQ(kMaxBitrateKbps, allocation.get_sum_kbps()); |
367 EXPECT_EQ(kTargetBitrateKbps, allocation.GetBitrate(0, 0) / 1000); | 371 EXPECT_EQ(kTargetBitrateKbps, allocation.GetBitrate(0, 0) / 1000); |
368 EXPECT_EQ(kMaxBitrateKbps - kTargetBitrateKbps, | 372 EXPECT_EQ(kMaxBitrateKbps - kTargetBitrateKbps, |
369 allocation.GetBitrate(0, 1) / 1000); | 373 allocation.GetBitrate(0, 1) / 1000); |
370 } | 374 } |
371 | 375 |
372 } // namespace webrtc | 376 } // namespace webrtc |
OLD | NEW |