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
@ -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