Update SupportsScalabilityMode functions to use enum ScalabilityMode.
And add missing values to ScalabilityMode. Bug: webrtc:11607 Change-Id: I892ac35a3528db11b0901d26902699ecfe8f49a4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/260982 Commit-Queue: Niels Moller <nisse@webrtc.org> Reviewed-by: Åsa Persson <asapersson@webrtc.org> Cr-Commit-Position: refs/heads/main@{#36792}
This commit is contained in:

committed by
WebRTC LUCI CQ

parent
09a92ff3de
commit
3b0481389f
@ -124,7 +124,10 @@ rtc_source_set("video_encoder_factory_template") {
|
||||
allow_poison = [ "software_video_codecs" ]
|
||||
public = [ "video_encoder_factory_template.h" ]
|
||||
|
||||
deps = [ ":video_codecs_api" ]
|
||||
deps = [
|
||||
":video_codecs_api",
|
||||
"../../modules/video_coding/svc:scalability_mode_util",
|
||||
]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/algorithm:container" ]
|
||||
}
|
||||
|
||||
@ -159,9 +162,9 @@ rtc_source_set("video_encoder_factory_template_libaom_av1_adapter") {
|
||||
|
||||
deps = [
|
||||
":scalability_mode",
|
||||
"../../modules/video_coding/codecs/av1:av1_svc_config",
|
||||
"../../modules/video_coding/codecs/av1:libaom_av1_encoder",
|
||||
"../../modules/video_coding/svc:scalability_mode_util",
|
||||
"../../modules/video_coding/svc:scalability_structures",
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -21,16 +21,27 @@ namespace webrtc {
|
||||
enum class ScalabilityMode {
|
||||
kL1T1,
|
||||
kL1T2,
|
||||
kL1T2h,
|
||||
kL1T3,
|
||||
kL1T3h,
|
||||
kL2T1,
|
||||
kL2T1h,
|
||||
kL2T1_KEY,
|
||||
kL2T2,
|
||||
kL2T2h,
|
||||
kL2T2_KEY,
|
||||
kL2T2_KEY_SHIFT,
|
||||
kL2T3,
|
||||
kL2T3h,
|
||||
kL2T3_KEY,
|
||||
kL3T1,
|
||||
kL3T1h,
|
||||
kL3T1_KEY,
|
||||
kL3T2,
|
||||
kL3T2h,
|
||||
kL3T2_KEY,
|
||||
kL3T3,
|
||||
kL3T3h,
|
||||
kL3T3_KEY,
|
||||
kS2T1,
|
||||
kS3T3,
|
||||
|
@ -40,9 +40,9 @@ struct FooEncoderTemplateAdapter {
|
||||
return std::make_unique<testing::StrictMock<MockVideoEncoder>>();
|
||||
}
|
||||
|
||||
static bool IsScalabilityModeSupported(
|
||||
const absl::string_view scalability_mode) {
|
||||
return scalability_mode == "L1T2" || scalability_mode == "L1T3";
|
||||
static bool IsScalabilityModeSupported(ScalabilityMode scalability_mode) {
|
||||
return scalability_mode == ScalabilityMode::kL1T2 ||
|
||||
scalability_mode == ScalabilityMode::kL1T3;
|
||||
}
|
||||
};
|
||||
|
||||
@ -56,10 +56,11 @@ struct BarEncoderTemplateAdapter {
|
||||
return std::make_unique<testing::StrictMock<MockVideoEncoder>>();
|
||||
}
|
||||
|
||||
static bool IsScalabilityModeSupported(
|
||||
const absl::string_view scalability_mode) {
|
||||
return scalability_mode == "L1T2" || scalability_mode == "L1T3" ||
|
||||
scalability_mode == "S2T2" || scalability_mode == "S2T3";
|
||||
static bool IsScalabilityModeSupported(ScalabilityMode scalability_mode) {
|
||||
return scalability_mode == ScalabilityMode::kL1T2 ||
|
||||
scalability_mode == ScalabilityMode::kL1T3 ||
|
||||
scalability_mode == ScalabilityMode::kS2T1 ||
|
||||
scalability_mode == ScalabilityMode::kS3T3;
|
||||
}
|
||||
};
|
||||
|
||||
@ -76,7 +77,7 @@ TEST(VideoEncoderFactoryTemplate, OneTemplateAdapterCodecSupport) {
|
||||
Field(&CodecSupport::is_supported, true));
|
||||
EXPECT_THAT(factory.QueryCodecSupport(kFooSdp, "L1T2"),
|
||||
Field(&CodecSupport::is_supported, true));
|
||||
EXPECT_THAT(factory.QueryCodecSupport(kFooSdp, "S2T3"),
|
||||
EXPECT_THAT(factory.QueryCodecSupport(kFooSdp, "S3T3"),
|
||||
Field(&CodecSupport::is_supported, false));
|
||||
EXPECT_THAT(factory.QueryCodecSupport(SdpVideoFormat("FooX"), absl::nullopt),
|
||||
Field(&CodecSupport::is_supported, false));
|
||||
@ -110,13 +111,13 @@ TEST(VideoEncoderFactoryTemplate, TwoTemplateAdaptersCodecSupport) {
|
||||
Field(&CodecSupport::is_supported, true));
|
||||
EXPECT_THAT(factory.QueryCodecSupport(kFooSdp, "L1T2"),
|
||||
Field(&CodecSupport::is_supported, true));
|
||||
EXPECT_THAT(factory.QueryCodecSupport(kFooSdp, "S2T3"),
|
||||
EXPECT_THAT(factory.QueryCodecSupport(kFooSdp, "S3T3"),
|
||||
Field(&CodecSupport::is_supported, false));
|
||||
EXPECT_THAT(factory.QueryCodecSupport(kBarLowSdp, absl::nullopt),
|
||||
Field(&CodecSupport::is_supported, true));
|
||||
EXPECT_THAT(factory.QueryCodecSupport(kBarHighSdp, absl::nullopt),
|
||||
Field(&CodecSupport::is_supported, true));
|
||||
EXPECT_THAT(factory.QueryCodecSupport(kBarLowSdp, "S2T2"),
|
||||
EXPECT_THAT(factory.QueryCodecSupport(kBarLowSdp, "S2T1"),
|
||||
Field(&CodecSupport::is_supported, true));
|
||||
EXPECT_THAT(factory.QueryCodecSupport(kBarHighSdp, "S3T2"),
|
||||
Field(&CodecSupport::is_supported, false));
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "absl/algorithm/container.h"
|
||||
#include "api/video_codecs/video_encoder.h"
|
||||
#include "api/video_codecs/video_encoder_factory.h"
|
||||
#include "modules/video_coding/svc/scalability_mode_util.h"
|
||||
|
||||
namespace webrtc {
|
||||
// The VideoEncoderFactoryTemplate supports encoders implementations given as
|
||||
@ -35,7 +36,7 @@ namespace webrtc {
|
||||
//
|
||||
// // Returns true if the encoder supports the given scalability mode.
|
||||
// static bool
|
||||
// IsScalabilityModeSupported(const absl::string_view scalability_mode);
|
||||
// IsScalabilityModeSupported(ScalabilityMode scalability_mode);
|
||||
//
|
||||
// Note that the order of the template arguments matter as the factory will
|
||||
// query/return the first encoder implementation supporting the given
|
||||
@ -66,6 +67,18 @@ class VideoEncoderFactoryTemplate : public VideoEncoderFactory {
|
||||
return absl::c_count(V::SupportedFormats(), format) > 0;
|
||||
}
|
||||
|
||||
template <typename V>
|
||||
bool IsScalabilityModeSupported(
|
||||
const absl::optional<std::string>& scalability_mode_string) const {
|
||||
if (!scalability_mode_string.has_value()) {
|
||||
return true;
|
||||
}
|
||||
absl::optional<ScalabilityMode> scalability_mode =
|
||||
ScalabilityModeFromString(*scalability_mode_string);
|
||||
return scalability_mode.has_value() &&
|
||||
V::IsScalabilityModeSupported(*scalability_mode);
|
||||
}
|
||||
|
||||
template <typename V, typename... Vs>
|
||||
void GetSupportedFormatsInternal(std::vector<SdpVideoFormat>& formats) const {
|
||||
auto supported_formats = V::SupportedFormats();
|
||||
@ -99,8 +112,7 @@ class VideoEncoderFactoryTemplate : public VideoEncoderFactory {
|
||||
const SdpVideoFormat& format,
|
||||
const absl::optional<std::string>& scalability_mode) const {
|
||||
if (IsFormatSupported<V>(format)) {
|
||||
return {.is_supported = !scalability_mode ||
|
||||
V::IsScalabilityModeSupported(*scalability_mode)};
|
||||
return {.is_supported = IsScalabilityModeSupported<V>(scalability_mode)};
|
||||
}
|
||||
|
||||
if constexpr (sizeof...(Vs) > 0) {
|
||||
|
@ -14,9 +14,8 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "modules/video_coding/codecs/av1/av1_svc_config.h"
|
||||
#include "modules/video_coding/codecs/av1/libaom_av1_encoder.h"
|
||||
#include "modules/video_coding/svc/create_scalability_structure.h"
|
||||
#include "modules/video_coding/svc/scalability_mode_util.h"
|
||||
|
||||
namespace webrtc {
|
||||
struct LibaomAv1EncoderTemplateAdapter {
|
||||
@ -29,13 +28,8 @@ struct LibaomAv1EncoderTemplateAdapter {
|
||||
return CreateLibaomAv1Encoder();
|
||||
}
|
||||
|
||||
static bool IsScalabilityModeSupported(absl::string_view mode_string) {
|
||||
// For libaom AV1, the scalability mode is supported if we can create the
|
||||
// scalability structure.
|
||||
absl::optional<ScalabilityMode> scalability_mode =
|
||||
ScalabilityModeFromString(mode_string);
|
||||
return scalability_mode != absl::nullopt &&
|
||||
ScalabilityStructureConfig(*scalability_mode) != absl::nullopt;
|
||||
static bool IsScalabilityModeSupported(ScalabilityMode scalability_mode) {
|
||||
return LibaomAv1EncoderSupportsScalabilityMode(scalability_mode);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -27,8 +27,7 @@ struct LibvpxVp8EncoderTemplateAdapter {
|
||||
return VP8Encoder::Create();
|
||||
}
|
||||
|
||||
static bool IsScalabilityModeSupported(
|
||||
const absl::string_view scalability_mode) {
|
||||
static bool IsScalabilityModeSupported(ScalabilityMode scalability_mode) {
|
||||
return VP8Encoder::SupportsScalabilityMode(scalability_mode);
|
||||
}
|
||||
};
|
||||
|
@ -27,8 +27,7 @@ struct LibvpxVp9EncoderTemplateAdapter {
|
||||
return VP9Encoder::Create();
|
||||
}
|
||||
|
||||
static bool IsScalabilityModeSupported(
|
||||
const absl::string_view scalability_mode) {
|
||||
static bool IsScalabilityModeSupported(ScalabilityMode scalability_mode) {
|
||||
return VP9Encoder::SupportsScalabilityMode(scalability_mode);
|
||||
}
|
||||
};
|
||||
|
@ -30,8 +30,7 @@ struct OpenH264EncoderTemplateAdapter {
|
||||
return H264Encoder::Create(cricket::VideoCodec(format));
|
||||
}
|
||||
|
||||
static bool IsScalabilityModeSupported(
|
||||
const absl::string_view scalability_mode) {
|
||||
static bool IsScalabilityModeSupported(ScalabilityMode scalability_mode) {
|
||||
return H264Encoder::SupportsScalabilityMode(scalability_mode);
|
||||
}
|
||||
};
|
||||
|
@ -215,8 +215,10 @@ 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:av1_svc_config",
|
||||
"../modules/video_coding/codecs/av1:libaom_av1_decoder",
|
||||
"../modules/video_coding/codecs/av1:libaom_av1_encoder_if_supported",
|
||||
"../modules/video_coding/svc:scalability_mode_util",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:logging",
|
||||
"../rtc_base/system:rtc_export",
|
||||
|
@ -16,10 +16,12 @@
|
||||
#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/av1_svc_config.h"
|
||||
#include "modules/video_coding/codecs/av1/libaom_av1_encoder_supported.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"
|
||||
#include "modules/video_coding/svc/scalability_mode_util.h"
|
||||
#include "rtc_base/logging.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -59,36 +61,40 @@ std::unique_ptr<VideoEncoder> InternalEncoderFactory::CreateVideoEncoder(
|
||||
|
||||
VideoEncoderFactory::CodecSupport InternalEncoderFactory::QueryCodecSupport(
|
||||
const SdpVideoFormat& format,
|
||||
absl::optional<std::string> scalability_mode) const {
|
||||
absl::optional<std::string> scalability_mode_string) const {
|
||||
// Query for supported formats and check if the specified format is supported.
|
||||
// Begin with filtering out unsupported scalability modes.
|
||||
if (scalability_mode) {
|
||||
bool scalability_mode_supported = false;
|
||||
if (scalability_mode_string) {
|
||||
static constexpr VideoEncoderFactory::CodecSupport kUnsupported = {
|
||||
.is_supported = false, .is_power_efficient = false};
|
||||
absl::optional<ScalabilityMode> scalability_mode =
|
||||
ScalabilityModeFromString(*scalability_mode_string);
|
||||
if (!scalability_mode.has_value()) {
|
||||
return kUnsupported;
|
||||
}
|
||||
if (absl::EqualsIgnoreCase(format.name, cricket::kVp8CodecName)) {
|
||||
scalability_mode_supported =
|
||||
VP8Encoder::SupportsScalabilityMode(*scalability_mode);
|
||||
if (!VP8Encoder::SupportsScalabilityMode(*scalability_mode)) {
|
||||
return kUnsupported;
|
||||
}
|
||||
} else if (absl::EqualsIgnoreCase(format.name, cricket::kVp9CodecName)) {
|
||||
scalability_mode_supported =
|
||||
VP9Encoder::SupportsScalabilityMode(*scalability_mode);
|
||||
if (!VP9Encoder::SupportsScalabilityMode(*scalability_mode)) {
|
||||
return kUnsupported;
|
||||
}
|
||||
} else if (absl::EqualsIgnoreCase(format.name, cricket::kH264CodecName)) {
|
||||
scalability_mode_supported =
|
||||
H264Encoder::SupportsScalabilityMode(*scalability_mode);
|
||||
if (!H264Encoder::SupportsScalabilityMode(*scalability_mode)) {
|
||||
return kUnsupported;
|
||||
}
|
||||
} else if (kIsLibaomAv1EncoderSupported &&
|
||||
absl::EqualsIgnoreCase(format.name, cricket::kAv1CodecName)) {
|
||||
scalability_mode_supported =
|
||||
LibaomAv1EncoderSupportsScalabilityMode(*scalability_mode);
|
||||
}
|
||||
|
||||
static constexpr VideoEncoderFactory::CodecSupport kUnsupported = {
|
||||
/*is_supported=*/false, /*is_power_efficient=*/false};
|
||||
if (!scalability_mode_supported) {
|
||||
if (!LibaomAv1EncoderSupportsScalabilityMode(*scalability_mode)) {
|
||||
return kUnsupported;
|
||||
}
|
||||
} else {
|
||||
return kUnsupported;
|
||||
}
|
||||
}
|
||||
|
||||
CodecSupport codec_support;
|
||||
codec_support.is_supported = format.IsCodecInList(GetSupportedFormats());
|
||||
return codec_support;
|
||||
return {.is_supported = format.IsCodecInList(GetSupportedFormats())};
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
@ -555,6 +555,7 @@ rtc_library("webrtc_h264") {
|
||||
"../../api/video:video_frame",
|
||||
"../../api/video:video_frame_i010",
|
||||
"../../api/video:video_rtp_headers",
|
||||
"../../api/video_codecs:scalability_mode",
|
||||
"../../api/video_codecs:video_codecs_api",
|
||||
"../../common_video",
|
||||
"../../media:rtc_media_base",
|
||||
@ -661,6 +662,7 @@ rtc_library("webrtc_vp8") {
|
||||
"../../api/video:encoded_image",
|
||||
"../../api/video:video_frame",
|
||||
"../../api/video:video_rtp_headers",
|
||||
"../../api/video_codecs:scalability_mode",
|
||||
"../../api/video_codecs:video_codecs_api",
|
||||
"../../api/video_codecs:vp8_temporal_layers_factory",
|
||||
"../../common_video",
|
||||
@ -766,6 +768,7 @@ rtc_library("webrtc_vp9") {
|
||||
"../../api/video:video_frame",
|
||||
"../../api/video:video_frame_i010",
|
||||
"../../api/video:video_rtp_headers",
|
||||
"../../api/video_codecs:scalability_mode",
|
||||
"../../api/video_codecs:video_codecs_api",
|
||||
"../../common_video",
|
||||
"../../media:rtc_media_base",
|
||||
|
@ -21,6 +21,12 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
bool LibaomAv1EncoderSupportsScalabilityMode(ScalabilityMode scalability_mode) {
|
||||
// For libaom AV1, the scalability mode is supported if we can create the
|
||||
// scalability structure.
|
||||
return ScalabilityStructureConfig(scalability_mode) != absl::nullopt;
|
||||
}
|
||||
|
||||
bool SetAv1SvcConfig(VideoCodec& video_codec) {
|
||||
RTC_DCHECK_EQ(video_codec.codecType, kVideoCodecAV1);
|
||||
|
||||
|
@ -14,6 +14,8 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
bool LibaomAv1EncoderSupportsScalabilityMode(ScalabilityMode scalability_mode);
|
||||
|
||||
// Fills `video_codec.spatialLayers` using other members.
|
||||
bool SetAv1SvcConfig(VideoCodec& video_codec);
|
||||
|
||||
|
@ -9,9 +9,6 @@
|
||||
*/
|
||||
#include "modules/video_coding/codecs/av1/libaom_av1_encoder_supported.h"
|
||||
|
||||
#include "modules/video_coding/svc/create_scalability_structure.h"
|
||||
#include "modules/video_coding/svc/scalability_mode_util.h"
|
||||
|
||||
#if defined(RTC_USE_LIBAOM_AV1_ENCODER)
|
||||
#include "modules/video_coding/codecs/av1/libaom_av1_encoder.h" // nogncheck
|
||||
#endif
|
||||
@ -22,24 +19,11 @@ ABSL_CONST_INIT const bool kIsLibaomAv1EncoderSupported = true;
|
||||
std::unique_ptr<VideoEncoder> CreateLibaomAv1EncoderIfSupported() {
|
||||
return CreateLibaomAv1Encoder();
|
||||
}
|
||||
bool LibaomAv1EncoderSupportsScalabilityMode(absl::string_view mode_string) {
|
||||
absl::optional<ScalabilityMode> scalability_mode =
|
||||
ScalabilityModeFromString(mode_string);
|
||||
|
||||
// For libaom AV1, the scalability mode is supported if we can create the
|
||||
// scalability structure.
|
||||
return scalability_mode.has_value() &&
|
||||
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
|
||||
|
@ -21,8 +21,6 @@ namespace webrtc {
|
||||
ABSL_CONST_INIT extern const bool kIsLibaomAv1EncoderSupported;
|
||||
|
||||
std::unique_ptr<VideoEncoder> CreateLibaomAv1EncoderIfSupported();
|
||||
bool LibaomAv1EncoderSupportsScalabilityMode(
|
||||
absl::string_view scalability_mode);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
|
@ -44,7 +44,8 @@ bool IsH264CodecSupported() {
|
||||
#endif
|
||||
}
|
||||
|
||||
constexpr absl::string_view kSupportedScalabilityModes[] = {"L1T2", "L1T3"};
|
||||
constexpr ScalabilityMode kSupportedScalabilityModes[] = {
|
||||
ScalabilityMode::kL1T1, ScalabilityMode::kL1T2, ScalabilityMode::kL1T3};
|
||||
|
||||
} // namespace
|
||||
|
||||
@ -127,7 +128,7 @@ bool H264Encoder::IsSupported() {
|
||||
return IsH264CodecSupported();
|
||||
}
|
||||
|
||||
bool H264Encoder::SupportsScalabilityMode(absl::string_view scalability_mode) {
|
||||
bool H264Encoder::SupportsScalabilityMode(ScalabilityMode scalability_mode) {
|
||||
for (const auto& entry : kSupportedScalabilityModes) {
|
||||
if (entry == scalability_mode) {
|
||||
return true;
|
||||
|
@ -16,8 +16,8 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/video_codecs/h264_profile_level_id.h"
|
||||
#include "api/video_codecs/scalability_mode.h"
|
||||
#include "media/base/codec.h"
|
||||
#include "modules/video_coding/include/video_codec_interface.h"
|
||||
#include "rtc_base/system/rtc_export.h"
|
||||
@ -52,7 +52,7 @@ class RTC_EXPORT H264Encoder : public VideoEncoder {
|
||||
static std::unique_ptr<H264Encoder> Create(const cricket::VideoCodec& codec);
|
||||
// If H.264 is supported (any implementation).
|
||||
static bool IsSupported();
|
||||
static bool SupportsScalabilityMode(absl::string_view scalability_mode);
|
||||
static bool SupportsScalabilityMode(ScalabilityMode scalability_mode);
|
||||
|
||||
~H264Encoder() override {}
|
||||
};
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "absl/base/attributes.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/video_codecs/scalability_mode.h"
|
||||
#include "api/video_codecs/video_encoder.h"
|
||||
#include "api/video_codecs/vp8_frame_buffer_controller.h"
|
||||
#include "modules/video_coding/include/video_codec_interface.h"
|
||||
@ -40,7 +40,7 @@ class VP8Encoder {
|
||||
|
||||
static std::unique_ptr<VideoEncoder> Create();
|
||||
static std::unique_ptr<VideoEncoder> Create(Settings settings);
|
||||
static bool SupportsScalabilityMode(absl::string_view scalability_mode);
|
||||
static bool SupportsScalabilityMode(ScalabilityMode scalability_mode);
|
||||
|
||||
ABSL_DEPRECATED("")
|
||||
static std::unique_ptr<VideoEncoder> Create(
|
||||
|
@ -49,7 +49,8 @@ constexpr char kVP8IosMaxNumberOfThreadFieldTrial[] =
|
||||
constexpr char kVP8IosMaxNumberOfThreadFieldTrialParameter[] = "max_thread";
|
||||
#endif
|
||||
|
||||
constexpr absl::string_view kSupportedScalabilityModes[] = {"L1T2", "L1T3"};
|
||||
constexpr ScalabilityMode kSupportedScalabilityModes[] = {
|
||||
ScalabilityMode::kL1T1, ScalabilityMode::kL1T2, ScalabilityMode::kL1T3};
|
||||
|
||||
constexpr char kVp8ForcePartitionResilience[] =
|
||||
"WebRTC-VP8-ForcePartitionResilience";
|
||||
@ -232,7 +233,7 @@ std::unique_ptr<VideoEncoder> VP8Encoder::Create(
|
||||
std::move(settings));
|
||||
}
|
||||
|
||||
bool VP8Encoder::SupportsScalabilityMode(absl::string_view scalability_mode) {
|
||||
bool VP8Encoder::SupportsScalabilityMode(ScalabilityMode scalability_mode) {
|
||||
for (const auto& entry : kSupportedScalabilityModes) {
|
||||
if (entry == scalability_mode) {
|
||||
return true;
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/video_codecs/scalability_mode.h"
|
||||
#include "api/video_codecs/sdp_video_format.h"
|
||||
#include "media/base/codec.h"
|
||||
#include "modules/video_coding/include/video_codec_interface.h"
|
||||
@ -37,7 +37,7 @@ class VP9Encoder : public VideoEncoder {
|
||||
static std::unique_ptr<VP9Encoder> Create();
|
||||
// Parses VP9 Profile from `codec` and returns the appropriate implementation.
|
||||
static std::unique_ptr<VP9Encoder> Create(const cricket::VideoCodec& codec);
|
||||
static bool SupportsScalabilityMode(absl::string_view scalability_mode);
|
||||
static bool SupportsScalabilityMode(ScalabilityMode scalability_mode);
|
||||
|
||||
~VP9Encoder() override {}
|
||||
};
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <memory>
|
||||
|
||||
#include "api/transport/field_trial_based_config.h"
|
||||
#include "api/video_codecs/scalability_mode.h"
|
||||
#include "api/video_codecs/sdp_video_format.h"
|
||||
#include "api/video_codecs/vp9_profile.h"
|
||||
#include "modules/video_coding/codecs/vp9/libvpx_vp9_decoder.h"
|
||||
@ -24,11 +25,18 @@
|
||||
|
||||
namespace webrtc {
|
||||
namespace {
|
||||
constexpr absl::string_view kSupportedScalabilityModes[] = {
|
||||
"L1T2", "L1T3", "L2T1", "L2T2", "L2T3", "L3T1",
|
||||
"L3T2", "L3T3", "L1T2h", "L1T3h", "L2T1h", "L2T2h",
|
||||
"L2T3h", "L3T1h", "L3T2h", "L3T3h", "L2T2_KEY", "L2T3_KEY",
|
||||
"L3T1_KEY", "L3T2_KEY", "L3T3_KEY"};
|
||||
constexpr ScalabilityMode kSupportedScalabilityModes[] = {
|
||||
ScalabilityMode::kL1T2, ScalabilityMode::kL1T3,
|
||||
ScalabilityMode::kL2T1, ScalabilityMode::kL2T2,
|
||||
ScalabilityMode::kL2T3, ScalabilityMode::kL3T1,
|
||||
ScalabilityMode::kL3T2, ScalabilityMode::kL3T3,
|
||||
ScalabilityMode::kL1T2h, ScalabilityMode::kL1T3h,
|
||||
ScalabilityMode::kL2T1h, ScalabilityMode::kL2T2h,
|
||||
ScalabilityMode::kL2T3h, ScalabilityMode::kL3T1h,
|
||||
ScalabilityMode::kL3T2h, ScalabilityMode::kL3T3h,
|
||||
ScalabilityMode::kL2T2_KEY, ScalabilityMode::kL2T3_KEY,
|
||||
ScalabilityMode::kL3T1_KEY, ScalabilityMode::kL3T2_KEY,
|
||||
ScalabilityMode::kL3T3_KEY};
|
||||
} // namespace
|
||||
|
||||
std::vector<SdpVideoFormat> SupportedVP9Codecs() {
|
||||
@ -93,7 +101,7 @@ std::unique_ptr<VP9Encoder> VP9Encoder::Create(
|
||||
#endif
|
||||
}
|
||||
|
||||
bool VP9Encoder::SupportsScalabilityMode(absl::string_view scalability_mode) {
|
||||
bool VP9Encoder::SupportsScalabilityMode(ScalabilityMode scalability_mode) {
|
||||
for (const auto& entry : kSupportedScalabilityModes) {
|
||||
if (entry == scalability_mode) {
|
||||
return true;
|
||||
|
@ -23,8 +23,12 @@ absl::optional<ScalabilityMode> ScalabilityModeFromString(
|
||||
return ScalabilityMode::kL1T1;
|
||||
if (mode_string == "L1T2")
|
||||
return ScalabilityMode::kL1T2;
|
||||
if (mode_string == "L1T2h")
|
||||
return ScalabilityMode::kL1T2h;
|
||||
if (mode_string == "L1T3")
|
||||
return ScalabilityMode::kL1T3;
|
||||
if (mode_string == "L1T3h")
|
||||
return ScalabilityMode::kL1T3h;
|
||||
|
||||
if (mode_string == "L2T1")
|
||||
return ScalabilityMode::kL2T1;
|
||||
@ -35,17 +39,37 @@ absl::optional<ScalabilityMode> ScalabilityModeFromString(
|
||||
|
||||
if (mode_string == "L2T2")
|
||||
return ScalabilityMode::kL2T2;
|
||||
if (mode_string == "L2T2h")
|
||||
return ScalabilityMode::kL2T2h;
|
||||
if (mode_string == "L2T2_KEY")
|
||||
return ScalabilityMode::kL2T2_KEY;
|
||||
if (mode_string == "L2T2_KEY_SHIFT")
|
||||
return ScalabilityMode::kL2T2_KEY_SHIFT;
|
||||
if (mode_string == "L2T3")
|
||||
return ScalabilityMode::kL2T3;
|
||||
if (mode_string == "L2T3h")
|
||||
return ScalabilityMode::kL2T3h;
|
||||
if (mode_string == "L2T3_KEY")
|
||||
return ScalabilityMode::kL2T3_KEY;
|
||||
|
||||
if (mode_string == "L3T1")
|
||||
return ScalabilityMode::kL3T1;
|
||||
if (mode_string == "L3T1h")
|
||||
return ScalabilityMode::kL3T1h;
|
||||
if (mode_string == "L3T1_KEY")
|
||||
return ScalabilityMode::kL3T1_KEY;
|
||||
|
||||
if (mode_string == "L3T2")
|
||||
return ScalabilityMode::kL3T2;
|
||||
if (mode_string == "L3T2h")
|
||||
return ScalabilityMode::kL3T2h;
|
||||
if (mode_string == "L3T2_KEY")
|
||||
return ScalabilityMode::kL3T2_KEY;
|
||||
|
||||
if (mode_string == "L3T3")
|
||||
return ScalabilityMode::kL3T3;
|
||||
if (mode_string == "L3T3h")
|
||||
return ScalabilityMode::kL3T3h;
|
||||
if (mode_string == "L3T3_KEY")
|
||||
return ScalabilityMode::kL3T3_KEY;
|
||||
|
||||
@ -63,8 +87,12 @@ absl::string_view ScalabilityModeToString(ScalabilityMode scalability_mode) {
|
||||
return "L1T1";
|
||||
case ScalabilityMode::kL1T2:
|
||||
return "L1T2";
|
||||
case ScalabilityMode::kL1T2h:
|
||||
return "L1T2h";
|
||||
case ScalabilityMode::kL1T3:
|
||||
return "L1T3";
|
||||
case ScalabilityMode::kL1T3h:
|
||||
return "L1T3h";
|
||||
case ScalabilityMode::kL2T1:
|
||||
return "L2T1";
|
||||
case ScalabilityMode::kL2T1h:
|
||||
@ -73,16 +101,34 @@ absl::string_view ScalabilityModeToString(ScalabilityMode scalability_mode) {
|
||||
return "L2T1_KEY";
|
||||
case ScalabilityMode::kL2T2:
|
||||
return "L2T2";
|
||||
case ScalabilityMode::kL2T2h:
|
||||
return "L2T2h";
|
||||
case ScalabilityMode::kL2T2_KEY:
|
||||
return "L2T2_KEY";
|
||||
case ScalabilityMode::kL2T2_KEY_SHIFT:
|
||||
return "L2T2_KEY_SHIFT";
|
||||
case ScalabilityMode::kL2T3:
|
||||
return "L2T3";
|
||||
case ScalabilityMode::kL2T3h:
|
||||
return "L2T3h";
|
||||
case ScalabilityMode::kL2T3_KEY:
|
||||
return "L2T3_KEY";
|
||||
case ScalabilityMode::kL3T1:
|
||||
return "L3T1";
|
||||
case ScalabilityMode::kL3T1h:
|
||||
return "L3T1h";
|
||||
case ScalabilityMode::kL3T1_KEY:
|
||||
return "L3T1_KEY";
|
||||
case ScalabilityMode::kL3T2:
|
||||
return "L3T2";
|
||||
case ScalabilityMode::kL3T2h:
|
||||
return "L3T2h";
|
||||
case ScalabilityMode::kL3T2_KEY:
|
||||
return "L3T2_KEY";
|
||||
case ScalabilityMode::kL3T3:
|
||||
return "L3T3";
|
||||
case ScalabilityMode::kL3T3h:
|
||||
return "L3T3h";
|
||||
case ScalabilityMode::kL3T3_KEY:
|
||||
return "L3T3_KEY";
|
||||
case ScalabilityMode::kS2T1:
|
||||
|
Reference in New Issue
Block a user