Byoungchan Lee | 13fe367 | 2022-04-06 10:44:42 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2022 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 | |
| 11 | #ifndef TEST_VIDEO_ENCODER_NULLABLE_PROXY_FACTORY_H_ |
| 12 | #define TEST_VIDEO_ENCODER_NULLABLE_PROXY_FACTORY_H_ |
| 13 | |
| 14 | #include <memory> |
| 15 | #include <vector> |
| 16 | |
| 17 | #include "api/video_codecs/video_encoder.h" |
| 18 | #include "api/video_codecs/video_encoder_factory.h" |
| 19 | #include "test/video_encoder_proxy_factory.h" |
| 20 | |
| 21 | namespace webrtc { |
| 22 | namespace test { |
| 23 | |
| 24 | class VideoEncoderNullableProxyFactory final : public VideoEncoderProxyFactory { |
| 25 | public: |
| 26 | explicit VideoEncoderNullableProxyFactory( |
| 27 | VideoEncoder* encoder, |
| 28 | EncoderSelectorInterface* encoder_selector) |
| 29 | : VideoEncoderProxyFactory(encoder, encoder_selector) {} |
| 30 | |
| 31 | ~VideoEncoderNullableProxyFactory() override = default; |
| 32 | |
| 33 | std::unique_ptr<VideoEncoder> CreateVideoEncoder( |
| 34 | const SdpVideoFormat& format) override { |
| 35 | if (!encoder_) { |
| 36 | return nullptr; |
| 37 | } |
| 38 | return VideoEncoderProxyFactory::CreateVideoEncoder(format); |
| 39 | } |
| 40 | }; |
| 41 | |
| 42 | } // namespace test |
| 43 | } // namespace webrtc |
| 44 | |
| 45 | #endif // TEST_VIDEO_ENCODER_NULLABLE_PROXY_FACTORY_H_ |