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 | |
| 16 | #include "absl/memory/memory.h" |
| 17 | #include "api/test/create_simulcast_test_fixture.h" |
| 18 | #include "api/test/simulcast_test_fixture.h" |
Danil Chapovalov | 99b71df | 2018-10-26 13:57:48 | [diff] [blame] | 19 | #include "api/test/video/function_video_decoder_factory.h" |
| 20 | #include "api/test/video/function_video_encoder_factory.h" |
Ilya Nikolaevskiy | b0588e6 | 2018-08-27 12:12:27 | [diff] [blame] | 21 | #include "modules/video_coding/utility/simulcast_test_fixture_impl.h" |
Per Kjellander | 841c912 | 2018-10-04 16:40:28 | [diff] [blame] | 22 | #include "test/fake_vp8_decoder.h" |
Ilya Nikolaevskiy | b0588e6 | 2018-08-27 12:12:27 | [diff] [blame] | 23 | |
| 24 | namespace webrtc { |
| 25 | namespace test { |
| 26 | |
| 27 | namespace { |
| 28 | |
| 29 | std::unique_ptr<SimulcastTestFixture> CreateSpecificSimulcastTestFixture() { |
| 30 | std::unique_ptr<VideoEncoderFactory> encoder_factory = |
| 31 | absl::make_unique<FunctionVideoEncoderFactory>([]() { |
| 32 | return absl::make_unique<FakeVP8Encoder>(Clock::GetRealTimeClock()); |
| 33 | }); |
| 34 | std::unique_ptr<VideoDecoderFactory> decoder_factory = |
| 35 | absl::make_unique<FunctionVideoDecoderFactory>( |
Per Kjellander | 841c912 | 2018-10-04 16:40:28 | [diff] [blame] | 36 | []() { return absl::make_unique<FakeVp8Decoder>(); }); |
Ilya Nikolaevskiy | b0588e6 | 2018-08-27 12:12:27 | [diff] [blame] | 37 | return CreateSimulcastTestFixture(std::move(encoder_factory), |
| 38 | std::move(decoder_factory), |
| 39 | SdpVideoFormat("VP8")); |
| 40 | } |
| 41 | } // namespace |
| 42 | |
| 43 | TEST(TestFakeVp8Codec, TestKeyFrameRequestsOnAllStreams) { |
| 44 | auto fixture = CreateSpecificSimulcastTestFixture(); |
| 45 | fixture->TestKeyFrameRequestsOnAllStreams(); |
| 46 | } |
| 47 | |
| 48 | TEST(TestFakeVp8Codec, TestPaddingAllStreams) { |
| 49 | auto fixture = CreateSpecificSimulcastTestFixture(); |
| 50 | fixture->TestPaddingAllStreams(); |
| 51 | } |
| 52 | |
| 53 | TEST(TestFakeVp8Codec, TestPaddingTwoStreams) { |
| 54 | auto fixture = CreateSpecificSimulcastTestFixture(); |
| 55 | fixture->TestPaddingTwoStreams(); |
| 56 | } |
| 57 | |
| 58 | TEST(TestFakeVp8Codec, TestPaddingTwoStreamsOneMaxedOut) { |
| 59 | auto fixture = CreateSpecificSimulcastTestFixture(); |
| 60 | fixture->TestPaddingTwoStreamsOneMaxedOut(); |
| 61 | } |
| 62 | |
| 63 | TEST(TestFakeVp8Codec, TestPaddingOneStream) { |
| 64 | auto fixture = CreateSpecificSimulcastTestFixture(); |
| 65 | fixture->TestPaddingOneStream(); |
| 66 | } |
| 67 | |
| 68 | TEST(TestFakeVp8Codec, TestPaddingOneStreamTwoMaxedOut) { |
| 69 | auto fixture = CreateSpecificSimulcastTestFixture(); |
| 70 | fixture->TestPaddingOneStreamTwoMaxedOut(); |
| 71 | } |
| 72 | |
| 73 | TEST(TestFakeVp8Codec, TestSendAllStreams) { |
| 74 | auto fixture = CreateSpecificSimulcastTestFixture(); |
| 75 | fixture->TestSendAllStreams(); |
| 76 | } |
| 77 | |
| 78 | TEST(TestFakeVp8Codec, TestDisablingStreams) { |
| 79 | auto fixture = CreateSpecificSimulcastTestFixture(); |
| 80 | fixture->TestDisablingStreams(); |
| 81 | } |
| 82 | |
| 83 | TEST(TestFakeVp8Codec, TestSwitchingToOneStream) { |
| 84 | auto fixture = CreateSpecificSimulcastTestFixture(); |
| 85 | fixture->TestSwitchingToOneStream(); |
| 86 | } |
| 87 | |
| 88 | TEST(TestFakeVp8Codec, TestSwitchingToOneOddStream) { |
| 89 | auto fixture = CreateSpecificSimulcastTestFixture(); |
| 90 | fixture->TestSwitchingToOneOddStream(); |
| 91 | } |
| 92 | |
| 93 | TEST(TestFakeVp8Codec, TestSwitchingToOneSmallStream) { |
| 94 | auto fixture = CreateSpecificSimulcastTestFixture(); |
| 95 | fixture->TestSwitchingToOneSmallStream(); |
| 96 | } |
| 97 | |
| 98 | TEST(TestFakeVp8Codec, TestSpatioTemporalLayers333PatternEncoder) { |
| 99 | auto fixture = CreateSpecificSimulcastTestFixture(); |
| 100 | fixture->TestSpatioTemporalLayers333PatternEncoder(); |
| 101 | } |
| 102 | |
Per Kjellander | 841c912 | 2018-10-04 16:40:28 | [diff] [blame] | 103 | TEST(TestFakeVp8Codec, TestDecodeWidthHeightSet) { |
| 104 | auto fixture = CreateSpecificSimulcastTestFixture(); |
| 105 | fixture->TestDecodeWidthHeightSet(); |
| 106 | } |
| 107 | |
Ilya Nikolaevskiy | b0588e6 | 2018-08-27 12:12:27 | [diff] [blame] | 108 | } // namespace test |
| 109 | } // namespace webrtc |