Make libaom_av1_encoder always build the libaom encoder.
Currently `CreateLibaomAv1Encoder` will either return an actual libaom AV1 encoder or a nullptr depening on whether the build flag `enable_libaom` was configured to true or not. This CL updates the `libaom_av1_encoder` build target to no longer depend on `enable_libaom` so that `CreateLibaomAv1Encoder` will always return an encoder instance. Added `CreateLibaomAv1EncoderIfSupported` as a replacement to the old `CreateLibaomAv1Encoder`. Bug: webrtc:13573 Change-Id: Ibdcd52c609acd79feefa2b86f19d1b4ca3e91d0a Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/242360 Reviewed-by: Erik Språng <sprang@webrtc.org> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Peter Hanspers <peterhanspers@webrtc.org> Reviewed-by: Stefan Holmer <stefan@webrtc.org> Commit-Queue: Philip Eliasson <philipel@webrtc.org> Cr-Commit-Position: refs/heads/main@{#35763}
This commit is contained in:
@ -71,32 +71,46 @@ rtc_library("libaom_av1_encoder") {
|
||||
visibility = [ "*" ]
|
||||
poisonous = [ "software_video_codecs" ]
|
||||
public = [ "libaom_av1_encoder.h" ]
|
||||
sources = [ "libaom_av1_encoder.cc" ]
|
||||
deps = [
|
||||
"../..:video_codec_interface",
|
||||
"../../../../api:scoped_refptr",
|
||||
"../../../../api/video:encoded_image",
|
||||
"../../../../api/video:video_frame",
|
||||
"../../../../api/video_codecs:video_codecs_api",
|
||||
"../../../../common_video",
|
||||
"../../../../rtc_base:checks",
|
||||
"../../../../rtc_base:logging",
|
||||
"../../svc:scalability_structures",
|
||||
"../../svc:scalable_video_controller",
|
||||
"//third_party/libaom",
|
||||
]
|
||||
absl_deps = [
|
||||
"//third_party/abseil-cpp/absl/algorithm:container",
|
||||
"//third_party/abseil-cpp/absl/strings:strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
|
||||
rtc_library("libaom_av1_encoder_if_supported") {
|
||||
visibility = [ "*" ]
|
||||
poisonous = [ "software_video_codecs" ]
|
||||
public = [ "libaom_av1_encoder_supported.h" ]
|
||||
sources = [ "libaom_av1_encoder_supported.cc" ]
|
||||
deps = [
|
||||
"../../../../api/video_codecs:video_codecs_api",
|
||||
"../../svc:scalability_structures",
|
||||
"../../svc:scalable_video_controller",
|
||||
]
|
||||
absl_deps = [
|
||||
"//third_party/abseil-cpp/absl/algorithm:container",
|
||||
"//third_party/abseil-cpp/absl/base:core_headers",
|
||||
"//third_party/abseil-cpp/absl/strings:strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
|
||||
defines = []
|
||||
if (enable_libaom) {
|
||||
sources = [ "libaom_av1_encoder.cc" ]
|
||||
deps += [
|
||||
"../..:video_codec_interface",
|
||||
"../../../../api:scoped_refptr",
|
||||
"../../../../api/video:encoded_image",
|
||||
"../../../../api/video:video_frame",
|
||||
"../../../../common_video",
|
||||
"../../../../rtc_base:checks",
|
||||
"../../../../rtc_base:logging",
|
||||
"//third_party/libaom",
|
||||
]
|
||||
} else {
|
||||
sources = [ "libaom_av1_encoder_absent.cc" ]
|
||||
defines += [ "RTC_USE_LIBAOM_AV1_ENCODER" ]
|
||||
deps += [ ":libaom_av1_encoder" ]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -820,17 +820,8 @@ VideoEncoder::EncoderInfo LibaomAv1Encoder::GetEncoderInfo() const {
|
||||
|
||||
} // namespace
|
||||
|
||||
const bool kIsLibaomAv1EncoderSupported = true;
|
||||
|
||||
std::unique_ptr<VideoEncoder> CreateLibaomAv1Encoder() {
|
||||
return std::make_unique<LibaomAv1Encoder>();
|
||||
}
|
||||
|
||||
bool LibaomAv1EncoderSupportsScalabilityMode(
|
||||
absl::string_view scalability_mode) {
|
||||
// For AV1, the scalability mode is supported if we can create the scalability
|
||||
// structure.
|
||||
return ScalabilityStructureConfig(scalability_mode) != absl::nullopt;
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -12,18 +12,11 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "absl/base/attributes.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/video_codecs/video_encoder.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
ABSL_CONST_INIT extern const bool kIsLibaomAv1EncoderSupported;
|
||||
|
||||
std::unique_ptr<VideoEncoder> CreateLibaomAv1Encoder();
|
||||
bool LibaomAv1EncoderSupportsScalabilityMode(
|
||||
absl::string_view scalability_mode);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // MODULES_VIDEO_CODING_CODECS_AV1_LIBAOM_AV1_ENCODER_H_
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2020 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
#include "modules/video_coding/codecs/av1/libaom_av1_encoder.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "api/video_codecs/video_encoder.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
const bool kIsLibaomAv1EncoderSupported = false;
|
||||
|
||||
std::unique_ptr<VideoEncoder> CreateLibaomAv1Encoder() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool LibaomAv1EncoderSupportsScalabilityMode(
|
||||
absl::string_view scalability_mode) {
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2021 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
#include "modules/video_coding/codecs/av1/libaom_av1_encoder_supported.h"
|
||||
|
||||
#include "modules/video_coding/svc/create_scalability_structure.h"
|
||||
|
||||
#if defined(RTC_USE_LIBAOM_AV1_ENCODER)
|
||||
#include "modules/video_coding/codecs/av1/libaom_av1_encoder.h" // nogncheck
|
||||
#endif
|
||||
|
||||
namespace webrtc {
|
||||
#if defined(RTC_USE_LIBAOM_AV1_ENCODER)
|
||||
const bool kIsLibaomAv1EncoderSupported = true;
|
||||
std::unique_ptr<VideoEncoder> CreateLibaomAv1EncoderIfSupported() {
|
||||
return CreateLibaomAv1Encoder();
|
||||
}
|
||||
bool LibaomAv1EncoderSupportsScalabilityMode(
|
||||
absl::string_view scalability_mode) {
|
||||
// For libaom AV1, the scalability mode is supported if we can create the
|
||||
// scalability structure.
|
||||
return ScalabilityStructureConfig(scalability_mode) != absl::nullopt;
|
||||
}
|
||||
#else
|
||||
const bool kIsLibaomAv1EncoderSupported = false;
|
||||
std::unique_ptr<VideoEncoder> CreateLibaomAv1EncoderIfSupported() {
|
||||
return nullptr;
|
||||
}
|
||||
bool LibaomAv1EncoderSupportsScalabilityMode(
|
||||
absl::string_view scalability_mode) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace webrtc
|
||||
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 2022 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
#ifndef MODULES_VIDEO_CODING_CODECS_AV1_LIBAOM_AV1_ENCODER_SUPPORTED_H_
|
||||
#define MODULES_VIDEO_CODING_CODECS_AV1_LIBAOM_AV1_ENCODER_SUPPORTED_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "absl/base/attributes.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/video_codecs/video_encoder.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
ABSL_CONST_INIT extern const bool kIsLibaomAv1EncoderSupported;
|
||||
|
||||
std::unique_ptr<VideoEncoder> CreateLibaomAv1EncoderIfSupported();
|
||||
bool LibaomAv1EncoderSupportsScalabilityMode(
|
||||
absl::string_view scalability_mode);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // MODULES_VIDEO_CODING_CODECS_AV1_LIBAOM_AV1_ENCODER_SUPPORTED_H_
|
||||
Reference in New Issue
Block a user