• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "media/engine/fake_video_codec_factory.h"
12 
13 #include <memory>
14 
15 #include "api/video_codecs/sdp_video_format.h"
16 #include "api/video_codecs/video_decoder.h"
17 #include "api/video_codecs/video_encoder.h"
18 #include "modules/include/module_common_types.h"
19 #include "modules/video_coding/include/video_codec_interface.h"
20 #include "modules/video_coding/include/video_error_codes.h"
21 #include "rtc_base/checks.h"
22 #include "rtc_base/logging.h"
23 #include "test/fake_decoder.h"
24 #include "test/fake_encoder.h"
25 
26 namespace {
27 
28 static const char kFakeCodecFactoryCodecName[] = "FakeCodec";
29 
30 }  // anonymous namespace
31 
32 namespace webrtc {
33 
34 FakeVideoEncoderFactory::FakeVideoEncoderFactory() = default;
35 
36 // static
CreateVideoEncoder()37 std::unique_ptr<VideoEncoder> FakeVideoEncoderFactory::CreateVideoEncoder() {
38   return std::make_unique<test::FakeEncoder>(Clock::GetRealTimeClock());
39 }
40 
GetSupportedFormats() const41 std::vector<SdpVideoFormat> FakeVideoEncoderFactory::GetSupportedFormats()
42     const {
43   return std::vector<SdpVideoFormat>(
44       1, SdpVideoFormat(kFakeCodecFactoryCodecName));
45 }
46 
QueryVideoEncoder(const SdpVideoFormat & format) const47 VideoEncoderFactory::CodecInfo FakeVideoEncoderFactory::QueryVideoEncoder(
48     const SdpVideoFormat& format) const {
49   return VideoEncoderFactory::CodecInfo{false, false};
50 }
51 
CreateVideoEncoder(const SdpVideoFormat & format)52 std::unique_ptr<VideoEncoder> FakeVideoEncoderFactory::CreateVideoEncoder(
53     const SdpVideoFormat& format) {
54   return std::make_unique<test::FakeEncoder>(Clock::GetRealTimeClock());
55 }
56 
57 FakeVideoDecoderFactory::FakeVideoDecoderFactory() = default;
58 
59 // static
CreateVideoDecoder()60 std::unique_ptr<VideoDecoder> FakeVideoDecoderFactory::CreateVideoDecoder() {
61   return std::make_unique<test::FakeDecoder>();
62 }
63 
GetSupportedFormats() const64 std::vector<SdpVideoFormat> FakeVideoDecoderFactory::GetSupportedFormats()
65     const {
66   return std::vector<SdpVideoFormat>(
67       1, SdpVideoFormat(kFakeCodecFactoryCodecName));
68 }
69 
CreateVideoDecoder(const SdpVideoFormat & format)70 std::unique_ptr<VideoDecoder> FakeVideoDecoderFactory::CreateVideoDecoder(
71     const SdpVideoFormat& format) {
72   return std::make_unique<test::FakeDecoder>();
73 }
74 
75 }  // namespace webrtc
76