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( |
36 void(bool, CodecSpecificInfoVP8*, uint32_t)); | 36 PopulateCodecSpecific, |
| 37 void(bool, TemporalLayers::FrameConfig, CodecSpecificInfoVP8*, uint32_t)); |
37 MOCK_METHOD2(FrameEncoded, void(unsigned int, int)); | 38 MOCK_METHOD2(FrameEncoded, void(unsigned int, int)); |
38 MOCK_CONST_METHOD0(CurrentLayerId, int()); | 39 MOCK_CONST_METHOD1(GetTemporalLayerId, int(TemporalLayers::FrameConfig)); |
39 }; | 40 }; |
40 } // namespace | 41 } // namespace |
41 | 42 |
42 class SimulcastRateAllocatorTest : public ::testing::TestWithParam<bool> { | 43 class SimulcastRateAllocatorTest : public ::testing::TestWithParam<bool> { |
43 public: | 44 public: |
44 SimulcastRateAllocatorTest() { | 45 SimulcastRateAllocatorTest() { |
45 memset(&codec_, 0, sizeof(VideoCodec)); | 46 memset(&codec_, 0, sizeof(VideoCodec)); |
46 codec_.minBitrate = kMinBitrateKbps; | 47 codec_.minBitrate = kMinBitrateKbps; |
47 codec_.targetBitrate = kTargetBitrateKbps; | 48 codec_.targetBitrate = kTargetBitrateKbps; |
48 codec_.maxBitrate = kMaxBitrateKbps; | 49 codec_.maxBitrate = kMaxBitrateKbps; |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 allocator_->GetAllocation(kMaxBitrateKbps * 2000, kFramerateFps); | 363 allocator_->GetAllocation(kMaxBitrateKbps * 2000, kFramerateFps); |
363 | 364 |
364 // Fill both TL0 and TL1, but no more. | 365 // Fill both TL0 and TL1, but no more. |
365 EXPECT_EQ(kMaxBitrateKbps, allocation.get_sum_kbps()); | 366 EXPECT_EQ(kMaxBitrateKbps, allocation.get_sum_kbps()); |
366 EXPECT_EQ(kTargetBitrateKbps, allocation.GetBitrate(0, 0) / 1000); | 367 EXPECT_EQ(kTargetBitrateKbps, allocation.GetBitrate(0, 0) / 1000); |
367 EXPECT_EQ(kMaxBitrateKbps - kTargetBitrateKbps, | 368 EXPECT_EQ(kMaxBitrateKbps - kTargetBitrateKbps, |
368 allocation.GetBitrate(0, 1) / 1000); | 369 allocation.GetBitrate(0, 1) / 1000); |
369 } | 370 } |
370 | 371 |
371 } // namespace webrtc | 372 } // namespace webrtc |
OLD | NEW |