xref: /aosp_15_r20/external/webrtc/media/engine/fake_video_codec_factory.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
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 
11 #ifndef MEDIA_ENGINE_FAKE_VIDEO_CODEC_FACTORY_H_
12 #define MEDIA_ENGINE_FAKE_VIDEO_CODEC_FACTORY_H_
13 
14 #include <memory>
15 #include <vector>
16 
17 #include "api/video_codecs/video_decoder_factory.h"
18 #include "api/video_codecs/video_encoder_factory.h"
19 #include "rtc_base/system/rtc_export.h"
20 
21 namespace webrtc {
22 
23 // Provides a fake video encoder instance that produces frames large enough for
24 // the given bitrate constraints.
25 class RTC_EXPORT FakeVideoEncoderFactory : public VideoEncoderFactory {
26  public:
27   FakeVideoEncoderFactory();
28 
29   static std::unique_ptr<VideoEncoder> CreateVideoEncoder();
30 
31   // VideoEncoderFactory implementation
32   std::vector<SdpVideoFormat> GetSupportedFormats() const override;
33   std::unique_ptr<VideoEncoder> CreateVideoEncoder(
34       const SdpVideoFormat& format) override;
35 };
36 
37 // Provides a fake video decoder instance that ignores the given bitstream and
38 // produces frames.
39 class RTC_EXPORT FakeVideoDecoderFactory : public VideoDecoderFactory {
40  public:
41   FakeVideoDecoderFactory();
42 
43   static std::unique_ptr<VideoDecoder> CreateVideoDecoder();
44 
45   // VideoDecoderFactory implementation
46   std::vector<SdpVideoFormat> GetSupportedFormats() const override;
47   std::unique_ptr<VideoDecoder> CreateVideoDecoder(
48       const SdpVideoFormat& format) override;
49 };
50 
51 }  // namespace webrtc
52 
53 #endif  // MEDIA_ENGINE_FAKE_VIDEO_CODEC_FACTORY_H_
54