aboutsummaryrefslogtreecommitdiff
path: root/media
diff options
context:
space:
mode:
authorDanil Chapovalov <danilchap@webrtc.org>2020-04-01 18:15:32 +0200
committerCommit Bot <commit-bot@chromium.org>2020-04-02 10:13:22 +0000
commit4553f45d2a5e017ea3d2cea16338440185f01768 (patch)
tree33dbf2f361d2392548436d95983ea5a55999ac9d /media
parentcfa0e8ffe29a06dcce7afaab3ff44e73ce57dad6 (diff)
downloadwebrtc-4553f45d2a5e017ea3d2cea16338440185f01768.tar.gz
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}
Diffstat (limited to 'media')
-rw-r--r--media/BUILD.gn1
-rw-r--r--media/engine/internal_encoder_factory.cc14
-rw-r--r--media/engine/internal_encoder_factory.h1
3 files changed, 14 insertions, 2 deletions
diff --git a/media/BUILD.gn b/media/BUILD.gn
index 705378022e..550f9f9fa0 100644
--- a/media/BUILD.gn
+++ b/media/BUILD.gn
@@ -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",
diff --git a/media/engine/internal_encoder_factory.cc b/media/engine/internal_encoder_factory.cc
index 331f22b794..aabb810283 100644
--- a/media/engine/internal_encoder_factory.cc
+++ b/media/engine/internal_encoder_factory.cc
@@ -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;
diff --git a/media/engine/internal_encoder_factory.h b/media/engine/internal_encoder_factory.h
index 79dbc46e08..c15d1790f3 100644
--- a/media/engine/internal_encoder_factory.h
+++ b/media/engine/internal_encoder_factory.h
@@ -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;