tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

fake_video_codec_factory.cc (2220B)


      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 #include <vector>
     15 
     16 #include "absl/container/inlined_vector.h"
     17 #include "api/environment/environment.h"
     18 #include "api/video_codecs/scalability_mode.h"
     19 #include "api/video_codecs/sdp_video_format.h"
     20 #include "api/video_codecs/video_decoder.h"
     21 #include "api/video_codecs/video_encoder.h"
     22 #include "test/fake_decoder.h"
     23 #include "test/fake_encoder.h"
     24 
     25 namespace {
     26 
     27 const char kFakeCodecFactoryCodecName[] = "FakeCodec";
     28 
     29 }  // anonymous namespace
     30 
     31 namespace webrtc {
     32 
     33 std::vector<SdpVideoFormat> FakeVideoEncoderFactory::GetSupportedFormats()
     34    const {
     35  const absl::InlinedVector<ScalabilityMode, kScalabilityModeCount>
     36      kSupportedScalabilityModes = {ScalabilityMode::kL1T1,
     37                                    ScalabilityMode::kL1T2,
     38                                    ScalabilityMode::kL1T3};
     39 
     40  return std::vector<SdpVideoFormat>(
     41      1, SdpVideoFormat(kFakeCodecFactoryCodecName, {},
     42                        kSupportedScalabilityModes));
     43 }
     44 
     45 std::unique_ptr<VideoEncoder> FakeVideoEncoderFactory::Create(
     46    const Environment& env,
     47    const SdpVideoFormat& /* format */) {
     48  return std::make_unique<test::FakeEncoder>(env);
     49 }
     50 
     51 FakeVideoDecoderFactory::FakeVideoDecoderFactory() = default;
     52 
     53 // static
     54 std::unique_ptr<VideoDecoder> FakeVideoDecoderFactory::CreateVideoDecoder() {
     55  return std::make_unique<test::FakeDecoder>();
     56 }
     57 
     58 std::vector<SdpVideoFormat> FakeVideoDecoderFactory::GetSupportedFormats()
     59    const {
     60  return std::vector<SdpVideoFormat>(
     61      1, SdpVideoFormat(kFakeCodecFactoryCodecName));
     62 }
     63 
     64 std::unique_ptr<VideoDecoder> FakeVideoDecoderFactory::Create(
     65    const Environment& /* env */,
     66    const SdpVideoFormat& /* format */) {
     67  return std::make_unique<test::FakeDecoder>();
     68 }
     69 
     70 }  // namespace webrtc