chromium/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder_factory.cc

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/platform/peerconnection/rtc_video_encoder_factory.h"

#include <memory>

#include "base/containers/contains.h"
#include "base/logging.h"
#include "base/strings/string_util.h"
#include "build/build_config.h"
#include "media/base/media_switches.h"
#include "media/media_buildflags.h"
#include "media/mojo/clients/mojo_video_encoder_metrics_provider.h"
#include "media/video/gpu_video_accelerator_factories.h"
#include "media/webrtc/webrtc_features.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/renderer/platform/allow_discouraged_type.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.h"
#include "third_party/blink/renderer/platform/peerconnection/webrtc_util.h"
#include "third_party/webrtc/api/video/resolution.h"
#include "third_party/webrtc/api/video_codecs/h264_profile_level_id.h"
#include "third_party/webrtc/api/video_codecs/sdp_video_format.h"
#include "third_party/webrtc/api/video_codecs/video_encoder.h"
#include "third_party/webrtc/api/video_codecs/vp9_profile.h"
#include "third_party/webrtc/media/base/codec.h"

#if BUILDFLAG(RTC_USE_H265)
#include "third_party/webrtc/api/video_codecs/h265_profile_tier_level.h"
#endif  // BUILDFLAG(RTC_USE_H265)

namespace blink {

namespace {

#if BUILDFLAG(IS_WIN)
// Enables AV1 encode acceleration for Windows.
BASE_FEATURE(kMediaFoundationAV1Encoding,
             "MediaFoundationAV1Encoding",
             base::FEATURE_DISABLED_BY_DEFAULT);

// Enables H.264 CBP encode acceleration for Windows.
BASE_FEATURE(kMediaFoundationH264CbpEncoding,
             "MediaFoundationH264CbpEncoding",
             base::FEATURE_DISABLED_BY_DEFAULT);

// Enables VP9 encode acceleration for Windows.
BASE_FEATURE(kMediaFoundationVP9Encoding,
             "MediaFoundationVP9Encoding",
             base::FEATURE_ENABLED_BY_DEFAULT);
#endif

// Translate from media::VideoEncodeAccelerator::SupportedProfile to
// webrtc::SdpVideoFormat, or return nothing if the profile isn't supported.
std::optional<webrtc::SdpVideoFormat> VEAToWebRTCFormat(
    const media::VideoEncodeAccelerator::SupportedProfile& profile) {}  // namespace

struct SupportedFormats {};

SupportedFormats GetSupportedFormatsInternal(
    media::GpuVideoAcceleratorFactories* gpu_factories,
    const std::vector<media::VideoCodecProfile>& disabled_profiles) {}

bool IsConstrainedH264(const webrtc::SdpVideoFormat& format) {}

bool IsScalabiltiyModeSupported(
    const std::string& scalability_mode,
    const std::vector<media::SVCScalabilityMode>& supported_scalability_modes) {}

}  // anonymous namespace

RTCVideoEncoderFactory::RTCVideoEncoderFactory(
    media::GpuVideoAcceleratorFactories* gpu_factories,
    scoped_refptr<media::MojoVideoEncoderMetricsProviderFactory>
        encoder_metrics_provider_factory)
    :{}

RTCVideoEncoderFactory::~RTCVideoEncoderFactory() {}

void RTCVideoEncoderFactory::CheckAndWaitEncoderSupportStatusIfNeeded() const {}

std::unique_ptr<webrtc::VideoEncoder> RTCVideoEncoderFactory::Create(
    const webrtc::Environment& env,
    const webrtc::SdpVideoFormat& format) {}

std::vector<webrtc::SdpVideoFormat>
RTCVideoEncoderFactory::GetSupportedFormats() const {}

webrtc::VideoEncoderFactory::CodecSupport
RTCVideoEncoderFactory::QueryCodecSupport(
    const webrtc::SdpVideoFormat& format,
    std::optional<std::string> scalability_mode) const {}

}  // namespace blink