aboutsummaryrefslogtreecommitdiff
path: root/media
diff options
context:
space:
mode:
authorDanil Chapovalov <danilchap@webrtc.org>2020-03-11 10:45:57 +0100
committerCommit Bot <commit-bot@chromium.org>2020-03-11 11:20:56 +0000
commitc46385c346d5a98b83ecef16bd4b4aa219a61d71 (patch)
tree241239cf9b87dc79582bb88dfcc346b1f4f58b9b /media
parent45c104b4fd6a594d68af7331211cacb6358cece5 (diff)
downloadwebrtc-c46385c346d5a98b83ecef16bd4b4aa219a61d71.tar.gz
Add Av1 Decoder wrapper behind a build flag
Bug: webrtc:11404 Change-Id: I090ffd173d667e8845de1b986af462516b7c76e6 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/169452 Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Reviewed-by: Michael Horowitz <mhoro@webrtc.org> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/master@{#30757}
Diffstat (limited to 'media')
-rw-r--r--media/BUILD.gn2
-rw-r--r--media/base/media_constants.cc1
-rw-r--r--media/base/media_constants.h1
-rw-r--r--media/engine/internal_decoder_factory.cc6
-rw-r--r--media/engine/internal_decoder_factory_unittest.cc18
5 files changed, 28 insertions, 0 deletions
diff --git a/media/BUILD.gn b/media/BUILD.gn
index 8c2d8c0d0c..3b45cf217f 100644
--- a/media/BUILD.gn
+++ b/media/BUILD.gn
@@ -246,6 +246,7 @@ rtc_library("rtc_internal_video_codecs") {
"../modules/video_coding:webrtc_multiplex",
"../modules/video_coding:webrtc_vp8",
"../modules/video_coding:webrtc_vp9",
+ "../modules/video_coding/codecs/av1:libaom_av1_decoder",
"../rtc_base:checks",
"../rtc_base:deprecation",
"../rtc_base:rtc_base_approved",
@@ -573,6 +574,7 @@ if (rtc_include_tests) {
"../modules/video_coding:simulcast_test_fixture_impl",
"../modules/video_coding:video_codec_interface",
"../modules/video_coding:webrtc_vp8",
+ "../modules/video_coding/codecs/av1:libaom_av1_decoder",
"../p2p:p2p_test_utils",
"../rtc_base",
"../rtc_base:checks",
diff --git a/media/base/media_constants.cc b/media/base/media_constants.cc
index 5bd4b754d2..5144a6ea65 100644
--- a/media/base/media_constants.cc
+++ b/media/base/media_constants.cc
@@ -105,6 +105,7 @@ const char kComfortNoiseCodecName[] = "CN";
const char kVp8CodecName[] = "VP8";
const char kVp9CodecName[] = "VP9";
+const char kAv1CodecName[] = "AV1X";
const char kH264CodecName[] = "H264";
// RFC 6184 RTP Payload Format for H.264 video
diff --git a/media/base/media_constants.h b/media/base/media_constants.h
index 136e9f19a0..b9b8a336f7 100644
--- a/media/base/media_constants.h
+++ b/media/base/media_constants.h
@@ -134,6 +134,7 @@ extern const char kComfortNoiseCodecName[];
RTC_EXPORT extern const char kVp8CodecName[];
RTC_EXPORT extern const char kVp9CodecName[];
+RTC_EXPORT extern const char kAv1CodecName[];
RTC_EXPORT extern const char kH264CodecName[];
// RFC 6184 RTP Payload Format for H.264 video
diff --git a/media/engine/internal_decoder_factory.cc b/media/engine/internal_decoder_factory.cc
index 5180b28917..e68bb369b5 100644
--- a/media/engine/internal_decoder_factory.cc
+++ b/media/engine/internal_decoder_factory.cc
@@ -14,6 +14,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_decoder.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"
@@ -47,6 +48,8 @@ std::vector<SdpVideoFormat> InternalDecoderFactory::GetSupportedFormats()
formats.push_back(format);
for (const SdpVideoFormat& h264_format : SupportedH264Codecs())
formats.push_back(h264_format);
+ if (kIsLibaomAv1DecoderSupported)
+ formats.push_back(SdpVideoFormat(cricket::kAv1CodecName));
return formats;
}
@@ -63,6 +66,9 @@ std::unique_ptr<VideoDecoder> InternalDecoderFactory::CreateVideoDecoder(
return VP9Decoder::Create();
if (absl::EqualsIgnoreCase(format.name, cricket::kH264CodecName))
return H264Decoder::Create();
+ if (kIsLibaomAv1DecoderSupported &&
+ absl::EqualsIgnoreCase(format.name, cricket::kAv1CodecName))
+ return CreateLibaomAv1Decoder();
RTC_NOTREACHED();
return nullptr;
diff --git a/media/engine/internal_decoder_factory_unittest.cc b/media/engine/internal_decoder_factory_unittest.cc
index 5e2bfbf9ec..705933d439 100644
--- a/media/engine/internal_decoder_factory_unittest.cc
+++ b/media/engine/internal_decoder_factory_unittest.cc
@@ -13,10 +13,16 @@
#include "api/video_codecs/sdp_video_format.h"
#include "api/video_codecs/video_decoder.h"
#include "media/base/media_constants.h"
+#include "modules/video_coding/codecs/av1/libaom_av1_decoder.h"
+#include "test/gmock.h"
#include "test/gtest.h"
namespace webrtc {
+using ::testing::Contains;
+using ::testing::Field;
+using ::testing::Not;
+
TEST(InternalDecoderFactory, TestVP8) {
InternalDecoderFactory factory;
std::unique_ptr<VideoDecoder> decoder =
@@ -24,4 +30,16 @@ TEST(InternalDecoderFactory, TestVP8) {
EXPECT_TRUE(decoder);
}
+TEST(InternalDecoderFactory, Av1) {
+ InternalDecoderFactory factory;
+ if (kIsLibaomAv1DecoderSupported) {
+ EXPECT_THAT(factory.GetSupportedFormats(),
+ Contains(Field(&SdpVideoFormat::name, "AV1X")));
+ EXPECT_TRUE(factory.CreateVideoDecoder(SdpVideoFormat("AV1X")));
+ } else {
+ EXPECT_THAT(factory.GetSupportedFormats(),
+ Not(Contains(Field(&SdpVideoFormat::name, "AV1X"))));
+ }
+}
+
} // namespace webrtc