#include "third_party/blink/renderer/platform/peerconnection/video_codec_factory.h"
#include "base/feature_list.h"
#include "base/memory/ptr_util.h"
#include "base/task/sequenced_task_runner.h"
#include "build/build_config.h"
#include "media/base/media_switches.h"
#include "media/mojo/clients/mojo_video_encoder_metrics_provider.h"
#include "media/video/gpu_video_accelerator_factories.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_video_decoder_factory.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_video_encoder_factory.h"
#include "third_party/blink/renderer/platform/peerconnection/stats_collecting_decoder.h"
#include "third_party/blink/renderer/platform/peerconnection/stats_collecting_encoder.h"
#include "third_party/blink/renderer/platform/peerconnection/webrtc_util.h"
#include "third_party/webrtc/api/video_codecs/video_decoder_software_fallback_wrapper.h"
#include "third_party/webrtc/api/video_codecs/video_encoder_software_fallback_wrapper.h"
#include "third_party/webrtc/media/base/codec.h"
#include "third_party/webrtc/media/engine/internal_decoder_factory.h"
#include "third_party/webrtc/media/engine/internal_encoder_factory.h"
#include "third_party/webrtc/media/engine/simulcast_encoder_adapter.h"
#include "third_party/webrtc/modules/video_coding/codecs/h264/include/h264.h"
#if BUILDFLAG(IS_ANDROID)
#include "media/base/android/media_codec_util.h"
#endif
namespace blink {
namespace {
template <typename Factory>
bool IsFormatSupported(const Factory* factory,
const webrtc::SdpVideoFormat& format) { … }
std::vector<webrtc::SdpVideoFormat> MergeFormats(
std::vector<webrtc::SdpVideoFormat> formats1,
const std::vector<webrtc::SdpVideoFormat>& formats2) { … }
std::unique_ptr<webrtc::VideoDecoder> CreateDecoder(
webrtc::VideoDecoderFactory* factory,
const webrtc::Environment& env,
const webrtc::SdpVideoFormat& format) { … }
std::unique_ptr<webrtc::VideoDecoder> Wrap(
const webrtc::Environment& env,
std::unique_ptr<webrtc::VideoDecoder> software_decoder,
std::unique_ptr<webrtc::VideoDecoder> hardware_decoder) { … }
class EncoderAdapter : public webrtc::VideoEncoderFactory { … };
class DecoderAdapter : public webrtc::VideoDecoderFactory { … };
}
std::unique_ptr<webrtc::VideoEncoderFactory> CreateHWVideoEncoderFactory(
media::GpuVideoAcceleratorFactories* gpu_factories,
scoped_refptr<media::MojoVideoEncoderMetricsProviderFactory>
encoder_metrics_provider_factory) { … }
std::unique_ptr<webrtc::VideoEncoderFactory> CreateWebrtcVideoEncoderFactory(
media::GpuVideoAcceleratorFactories* gpu_factories,
scoped_refptr<media::MojoVideoEncoderMetricsProviderFactory>
encoder_metrics_provider_factory,
StatsCollector::StoreProcessingStatsCB stats_callback) { … }
std::unique_ptr<webrtc::VideoDecoderFactory> CreateWebrtcVideoDecoderFactory(
media::GpuVideoAcceleratorFactories* gpu_factories,
base::WeakPtr<media::DecoderFactory> media_decoder_factory,
scoped_refptr<base::SequencedTaskRunner> media_task_runner,
const gfx::ColorSpace& render_color_space,
StatsCollector::StoreProcessingStatsCB stats_callback) { … }
}