#include "third_party/blink/renderer/platform/peerconnection/rtc_video_decoder_factory.h"
#include <array>
#include <memory>
#include "base/check.h"
#include "base/feature_list.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/task/sequenced_task_runner.h"
#include "base/trace_event/base_tracing.h"
#include "build/build_config.h"
#include "media/base/decoder_factory.h"
#include "media/base/media_util.h"
#include "media/base/platform_features.h"
#include "media/base/video_codecs.h"
#include "media/media_buildflags.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/peerconnection/rtc_video_decoder_adapter.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_video_decoder_stream_adapter.h"
#include "third_party/blink/renderer/platform/webrtc/webrtc_video_utils.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/vp9_profile.h"
#include "third_party/webrtc/media/base/codec.h"
#include "third_party/webrtc/media/base/media_constants.h"
#include "ui/gfx/color_space.h"
#include "ui/gfx/geometry/size.h"
#if BUILDFLAG(RTC_USE_H265)
#include "third_party/webrtc/api/video_codecs/h265_profile_tier_level.h"
#endif
namespace blink {
namespace {
BASE_FEATURE(…);
constexpr int kDefaultFps = …;
constexpr gfx::Size kDefaultSize(1280, 720);
#if BUILDFLAG(RTC_USE_H265)
constexpr gfx::Size kDefaultSizeH265(1920, 1080);
#endif
struct CodecConfig { … };
constexpr CodecConfig kCodecConfigs[] = …;
std::optional<webrtc::SdpVideoFormat> VdcToWebRtcFormat(
const media::VideoDecoderConfig& config) { … }
class ScopedVideoDecoder : public webrtc::VideoDecoder { … };
}
RTCVideoDecoderFactory::RTCVideoDecoderFactory(
media::GpuVideoAcceleratorFactories* gpu_factories,
base::WeakPtr<media::DecoderFactory> decoder_factory,
scoped_refptr<base::SequencedTaskRunner> media_task_runner,
const gfx::ColorSpace& render_color_space)
: … { … }
void RTCVideoDecoderFactory::CheckAndWaitDecoderSupportStatusIfNeeded() const { … }
std::vector<webrtc::SdpVideoFormat>
RTCVideoDecoderFactory::GetSupportedFormats() const { … }
webrtc::VideoDecoderFactory::CodecSupport
RTCVideoDecoderFactory::QueryCodecSupport(const webrtc::SdpVideoFormat& format,
bool reference_scaling) const { … }
RTCVideoDecoderFactory::~RTCVideoDecoderFactory() { … }
std::unique_ptr<webrtc::VideoDecoder> RTCVideoDecoderFactory::Create(
const webrtc::Environment& ,
const webrtc::SdpVideoFormat& format) { … }
}