Ilya Nikolaevskiy | b0588e6 | 2018-08-27 12:12:27 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
Jonas Olsson | a4d8737 | 2019-07-05 17:08:33 | [diff] [blame] | 11 | #include "test/fake_vp8_encoder.h" |
| 12 | |
Ilya Nikolaevskiy | b0588e6 | 2018-08-27 12:12:27 | [diff] [blame] | 13 | #include <memory> |
| 14 | #include <utility> |
| 15 | |
Ilya Nikolaevskiy | b0588e6 | 2018-08-27 12:12:27 | [diff] [blame] | 16 | #include "api/test/create_simulcast_test_fixture.h" |
| 17 | #include "api/test/simulcast_test_fixture.h" |
Danil Chapovalov | 99b71df | 2018-10-26 13:57:48 | [diff] [blame] | 18 | #include "api/test/video/function_video_decoder_factory.h" |
| 19 | #include "api/test/video/function_video_encoder_factory.h" |
Ilya Nikolaevskiy | b0588e6 | 2018-08-27 12:12:27 | [diff] [blame] | 20 | #include "modules/video_coding/utility/simulcast_test_fixture_impl.h" |
Per Kjellander | 841c912 | 2018-10-04 16:40:28 | [diff] [blame] | 21 | #include "test/fake_vp8_decoder.h" |
Ilya Nikolaevskiy | b0588e6 | 2018-08-27 12:12:27 | [diff] [blame] | 22 | |
| 23 | namespace webrtc { |
| 24 | namespace test { |
| 25 | |
| 26 | namespace { |
| 27 | |
| 28 | std::unique_ptr<SimulcastTestFixture> CreateSpecificSimulcastTestFixture() { |
| 29 | std::unique_ptr<VideoEncoderFactory> encoder_factory = |
Mirko Bonadei | 317a1f0 | 2019-09-17 15:06:18 | [diff] [blame] | 30 | std::make_unique<FunctionVideoEncoderFactory>([]() { |
Nikita Zetilov | 8e9fd48 | 2020-03-06 09:43:41 | [diff] [blame] | 31 | return std::make_unique<FakeVp8Encoder>(Clock::GetRealTimeClock()); |
Ilya Nikolaevskiy | b0588e6 | 2018-08-27 12:12:27 | [diff] [blame] | 32 | }); |
| 33 | std::unique_ptr<VideoDecoderFactory> decoder_factory = |
Mirko Bonadei | 317a1f0 | 2019-09-17 15:06:18 | [diff] [blame] | 34 | std::make_unique<FunctionVideoDecoderFactory>( |
| 35 | []() { return std::make_unique<FakeVp8Decoder>(); }); |
Ilya Nikolaevskiy | b0588e6 | 2018-08-27 12:12:27 | [diff] [blame] | 36 | return CreateSimulcastTestFixture(std::move(encoder_factory), |
| 37 | std::move(decoder_factory), |
| 38 | SdpVideoFormat("VP8")); |
| 39 | } |
| 40 | } // namespace |
| 41 | |
| 42 | TEST(TestFakeVp8Codec, TestKeyFrameRequestsOnAllStreams) { |
| 43 | auto fixture = CreateSpecificSimulcastTestFixture(); |
| 44 | fixture->TestKeyFrameRequestsOnAllStreams(); |
| 45 | } |
| 46 | |
| 47 | TEST(TestFakeVp8Codec, TestPaddingAllStreams) { |
| 48 | auto fixture = CreateSpecificSimulcastTestFixture(); |
| 49 | fixture->TestPaddingAllStreams(); |
| 50 | } |
| 51 | |
| 52 | TEST(TestFakeVp8Codec, TestPaddingTwoStreams) { |
| 53 | auto fixture = CreateSpecificSimulcastTestFixture(); |
| 54 | fixture->TestPaddingTwoStreams(); |
| 55 | } |
| 56 | |
| 57 | TEST(TestFakeVp8Codec, TestPaddingTwoStreamsOneMaxedOut) { |
| 58 | auto fixture = CreateSpecificSimulcastTestFixture(); |
| 59 | fixture->TestPaddingTwoStreamsOneMaxedOut(); |
| 60 | } |
| 61 | |
| 62 | TEST(TestFakeVp8Codec, TestPaddingOneStream) { |
| 63 | auto fixture = CreateSpecificSimulcastTestFixture(); |
| 64 | fixture->TestPaddingOneStream(); |
| 65 | } |
| 66 | |
| 67 | TEST(TestFakeVp8Codec, TestPaddingOneStreamTwoMaxedOut) { |
| 68 | auto fixture = CreateSpecificSimulcastTestFixture(); |
| 69 | fixture->TestPaddingOneStreamTwoMaxedOut(); |
| 70 | } |
| 71 | |
| 72 | TEST(TestFakeVp8Codec, TestSendAllStreams) { |
| 73 | auto fixture = CreateSpecificSimulcastTestFixture(); |
| 74 | fixture->TestSendAllStreams(); |
| 75 | } |
| 76 | |
| 77 | TEST(TestFakeVp8Codec, TestDisablingStreams) { |
| 78 | auto fixture = CreateSpecificSimulcastTestFixture(); |
| 79 | fixture->TestDisablingStreams(); |
| 80 | } |
| 81 | |
| 82 | TEST(TestFakeVp8Codec, TestSwitchingToOneStream) { |
| 83 | auto fixture = CreateSpecificSimulcastTestFixture(); |
| 84 | fixture->TestSwitchingToOneStream(); |
| 85 | } |
| 86 | |
| 87 | TEST(TestFakeVp8Codec, TestSwitchingToOneOddStream) { |
| 88 | auto fixture = CreateSpecificSimulcastTestFixture(); |
| 89 | fixture->TestSwitchingToOneOddStream(); |
| 90 | } |
| 91 | |
| 92 | TEST(TestFakeVp8Codec, TestSwitchingToOneSmallStream) { |
| 93 | auto fixture = CreateSpecificSimulcastTestFixture(); |
| 94 | fixture->TestSwitchingToOneSmallStream(); |
| 95 | } |
| 96 | |
| 97 | TEST(TestFakeVp8Codec, TestSpatioTemporalLayers333PatternEncoder) { |
| 98 | auto fixture = CreateSpecificSimulcastTestFixture(); |
| 99 | fixture->TestSpatioTemporalLayers333PatternEncoder(); |
| 100 | } |
| 101 | |
Per Kjellander | 841c912 | 2018-10-04 16:40:28 | [diff] [blame] | 102 | TEST(TestFakeVp8Codec, TestDecodeWidthHeightSet) { |
| 103 | auto fixture = CreateSpecificSimulcastTestFixture(); |
| 104 | fixture->TestDecodeWidthHeightSet(); |
| 105 | } |
| 106 | |
Per Kjellander | be0aec2 | 2020-09-29 18:00:03 | [diff] [blame] | 107 | TEST(TestFakeVp8Codec, |
| 108 | TestEncoderInfoForDefaultTemporalLayerProfileHasFpsAllocation) { |
| 109 | auto fixture = CreateSpecificSimulcastTestFixture(); |
| 110 | fixture->TestEncoderInfoForDefaultTemporalLayerProfileHasFpsAllocation(); |
| 111 | } |
| 112 | |
Ilya Nikolaevskiy | b0588e6 | 2018-08-27 12:12:27 | [diff] [blame] | 113 | } // namespace test |
| 114 | } // namespace webrtc |