Add AV1 to default video encoder factory
while checking for software supported codecs avoid creating encoder factory to avoid linking av1 encoder and libaom. Bug: webrtc:11404 Change-Id: I32771696efb59d98ba08592a20eb691b56622deb Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/172625 Reviewed-by: Sami Kalliomäki <sakal@webrtc.org> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/master@{#30973}
This commit is contained in:
committed by
Commit Bot
parent
cfa0e8ffe2
commit
4553f45d2a
@ -247,6 +247,7 @@ rtc_library("rtc_internal_video_codecs") {
|
||||
"../modules/video_coding:webrtc_vp8",
|
||||
"../modules/video_coding:webrtc_vp9",
|
||||
"../modules/video_coding/codecs/av1:libaom_av1_decoder",
|
||||
"../modules/video_coding/codecs/av1:libaom_av1_encoder",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:deprecation",
|
||||
"../rtc_base:rtc_base_approved",
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
#include "api/video_codecs/sdp_video_format.h"
|
||||
#include "media/base/codec.h"
|
||||
#include "media/base/media_constants.h"
|
||||
#include "modules/video_coding/codecs/av1/libaom_av1_encoder.h"
|
||||
#include "modules/video_coding/codecs/h264/include/h264.h"
|
||||
#include "modules/video_coding/codecs/vp8/include/vp8.h"
|
||||
#include "modules/video_coding/codecs/vp9/include/vp9.h"
|
||||
@ -23,17 +24,23 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
std::vector<SdpVideoFormat> InternalEncoderFactory::GetSupportedFormats()
|
||||
const {
|
||||
std::vector<SdpVideoFormat> InternalEncoderFactory::SupportedFormats() {
|
||||
std::vector<SdpVideoFormat> supported_codecs;
|
||||
supported_codecs.push_back(SdpVideoFormat(cricket::kVp8CodecName));
|
||||
for (const webrtc::SdpVideoFormat& format : webrtc::SupportedVP9Codecs())
|
||||
supported_codecs.push_back(format);
|
||||
for (const webrtc::SdpVideoFormat& format : webrtc::SupportedH264Codecs())
|
||||
supported_codecs.push_back(format);
|
||||
if (kIsLibaomAv1EncoderSupported)
|
||||
supported_codecs.push_back(SdpVideoFormat(cricket::kAv1CodecName));
|
||||
return supported_codecs;
|
||||
}
|
||||
|
||||
std::vector<SdpVideoFormat> InternalEncoderFactory::GetSupportedFormats()
|
||||
const {
|
||||
return SupportedFormats();
|
||||
}
|
||||
|
||||
VideoEncoderFactory::CodecInfo InternalEncoderFactory::QueryVideoEncoder(
|
||||
const SdpVideoFormat& format) const {
|
||||
CodecInfo info;
|
||||
@ -50,6 +57,9 @@ std::unique_ptr<VideoEncoder> InternalEncoderFactory::CreateVideoEncoder(
|
||||
return VP9Encoder::Create(cricket::VideoCodec(format));
|
||||
if (absl::EqualsIgnoreCase(format.name, cricket::kH264CodecName))
|
||||
return H264Encoder::Create(cricket::VideoCodec(format));
|
||||
if (kIsLibaomAv1EncoderSupported &&
|
||||
absl::EqualsIgnoreCase(format.name, cricket::kAv1CodecName))
|
||||
return CreateLibaomAv1Encoder();
|
||||
RTC_LOG(LS_ERROR) << "Trying to created encoder of unsupported format "
|
||||
<< format.name;
|
||||
return nullptr;
|
||||
|
||||
@ -23,6 +23,7 @@ namespace webrtc {
|
||||
|
||||
class RTC_EXPORT InternalEncoderFactory : public VideoEncoderFactory {
|
||||
public:
|
||||
static std::vector<SdpVideoFormat> SupportedFormats();
|
||||
std::vector<SdpVideoFormat> GetSupportedFormats() const override;
|
||||
|
||||
CodecInfo QueryVideoEncoder(const SdpVideoFormat& format) const override;
|
||||
|
||||
@ -438,8 +438,7 @@ bool IsFormatSupported(const std::vector<SdpVideoFormat>& supported_formats,
|
||||
bool MediaCodecVideoEncoder::ProcessHWError(
|
||||
bool reset_if_fallback_unavailable) {
|
||||
ALOGE << "ProcessHWError";
|
||||
if (IsFormatSupported(InternalEncoderFactory().GetSupportedFormats(),
|
||||
format_)) {
|
||||
if (IsFormatSupported(InternalEncoderFactory::SupportedFormats(), format_)) {
|
||||
ALOGE << "Fallback to SW encoder.";
|
||||
sw_fallback_required_ = true;
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user