Move VP8 SupportsScalabilityMode utility to its own build target
Intended to let Vp8TemporalLayersFactory (an api/ target) reuse this function, without depending on the codec implementation, and without introducing a dependency cycle with the webrtc_vp8 build target. Bug: webrtc:11607 Change-Id: I671422e994e1005da8c7d768e8dd8ff795553e51 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/261308 Commit-Queue: Niels Moller <nisse@webrtc.org> Reviewed-by: Åsa Persson <asapersson@webrtc.org> Cr-Commit-Position: refs/heads/main@{#36816}
This commit is contained in:
parent
dd52f625ea
commit
14d01508be
@ -136,7 +136,10 @@ rtc_source_set("video_encoder_factory_template_libvpx_vp8_adapter") {
|
||||
allow_poison = [ "software_video_codecs" ]
|
||||
public = [ "video_encoder_factory_template_libvpx_vp8_adapter.h" ]
|
||||
|
||||
deps = [ "../../modules/video_coding:webrtc_vp8" ]
|
||||
deps = [
|
||||
"../../modules/video_coding:webrtc_vp8",
|
||||
"../../modules/video_coding:webrtc_vp8_scalability",
|
||||
]
|
||||
}
|
||||
|
||||
rtc_source_set("video_encoder_factory_template_libvpx_vp9_adapter") {
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "modules/video_coding/codecs/vp8/include/vp8.h"
|
||||
#include "modules/video_coding/codecs/vp8/vp8_scalability.h"
|
||||
|
||||
namespace webrtc {
|
||||
struct LibvpxVp8EncoderTemplateAdapter {
|
||||
@ -28,7 +29,7 @@ struct LibvpxVp8EncoderTemplateAdapter {
|
||||
}
|
||||
|
||||
static bool IsScalabilityModeSupported(ScalabilityMode scalability_mode) {
|
||||
return VP8Encoder::SupportsScalabilityMode(scalability_mode);
|
||||
return VP8SupportsScalabilityMode(scalability_mode);
|
||||
}
|
||||
};
|
||||
} // namespace webrtc
|
||||
|
||||
@ -214,6 +214,7 @@ rtc_library("rtc_internal_video_codecs") {
|
||||
"../modules/video_coding:webrtc_h264",
|
||||
"../modules/video_coding:webrtc_multiplex",
|
||||
"../modules/video_coding:webrtc_vp8",
|
||||
"../modules/video_coding:webrtc_vp8_scalability",
|
||||
"../modules/video_coding:webrtc_vp9",
|
||||
"../modules/video_coding/codecs/av1:av1_svc_config",
|
||||
"../modules/video_coding/codecs/av1:libaom_av1_decoder",
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
#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/vp8/vp8_scalability.h"
|
||||
#include "modules/video_coding/codecs/vp9/include/vp9.h"
|
||||
#include "modules/video_coding/svc/scalability_mode_util.h"
|
||||
#include "rtc_base/logging.h"
|
||||
@ -73,7 +74,7 @@ VideoEncoderFactory::CodecSupport InternalEncoderFactory::QueryCodecSupport(
|
||||
return kUnsupported;
|
||||
}
|
||||
if (absl::EqualsIgnoreCase(format.name, cricket::kVp8CodecName)) {
|
||||
if (!VP8Encoder::SupportsScalabilityMode(*scalability_mode)) {
|
||||
if (!VP8SupportsScalabilityMode(*scalability_mode)) {
|
||||
return kUnsupported;
|
||||
}
|
||||
} else if (absl::EqualsIgnoreCase(format.name, cricket::kVp9CodecName)) {
|
||||
|
||||
@ -662,7 +662,6 @@ 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",
|
||||
@ -689,6 +688,14 @@ rtc_library("webrtc_vp8") {
|
||||
}
|
||||
}
|
||||
|
||||
rtc_source_set("webrtc_vp8_scalability") {
|
||||
sources = [
|
||||
"codecs/vp8/vp8_scalability.cc",
|
||||
"codecs/vp8/vp8_scalability.h",
|
||||
]
|
||||
deps = [ "../../api/video_codecs:scalability_mode" ]
|
||||
}
|
||||
|
||||
rtc_library("webrtc_vp8_temporal_layers") {
|
||||
visibility = [ "*" ]
|
||||
sources = [
|
||||
|
||||
@ -15,7 +15,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "absl/base/attributes.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 +39,6 @@ class VP8Encoder {
|
||||
|
||||
static std::unique_ptr<VideoEncoder> Create();
|
||||
static std::unique_ptr<VideoEncoder> Create(Settings settings);
|
||||
static bool SupportsScalabilityMode(ScalabilityMode scalability_mode);
|
||||
|
||||
ABSL_DEPRECATED("")
|
||||
static std::unique_ptr<VideoEncoder> Create(
|
||||
|
||||
@ -49,9 +49,6 @@ constexpr char kVP8IosMaxNumberOfThreadFieldTrial[] =
|
||||
constexpr char kVP8IosMaxNumberOfThreadFieldTrialParameter[] = "max_thread";
|
||||
#endif
|
||||
|
||||
constexpr ScalabilityMode kSupportedScalabilityModes[] = {
|
||||
ScalabilityMode::kL1T1, ScalabilityMode::kL1T2, ScalabilityMode::kL1T3};
|
||||
|
||||
constexpr char kVp8ForcePartitionResilience[] =
|
||||
"WebRTC-VP8-ForcePartitionResilience";
|
||||
|
||||
@ -233,15 +230,6 @@ std::unique_ptr<VideoEncoder> VP8Encoder::Create(
|
||||
std::move(settings));
|
||||
}
|
||||
|
||||
bool VP8Encoder::SupportsScalabilityMode(ScalabilityMode scalability_mode) {
|
||||
for (const auto& entry : kSupportedScalabilityModes) {
|
||||
if (entry == scalability_mode) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
vpx_enc_frame_flags_t LibvpxVp8Encoder::EncodeFlags(
|
||||
const Vp8FrameConfig& references) {
|
||||
RTC_DCHECK(!references.drop_frame);
|
||||
|
||||
26
modules/video_coding/codecs/vp8/vp8_scalability.cc
Normal file
26
modules/video_coding/codecs/vp8/vp8_scalability.cc
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "modules/video_coding/codecs/vp8/vp8_scalability.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
bool VP8SupportsScalabilityMode(ScalabilityMode scalability_mode) {
|
||||
constexpr ScalabilityMode kSupportedScalabilityModes[] = {
|
||||
ScalabilityMode::kL1T1, ScalabilityMode::kL1T2, ScalabilityMode::kL1T3};
|
||||
for (const auto& entry : kSupportedScalabilityModes) {
|
||||
if (entry == scalability_mode) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
22
modules/video_coding/codecs/vp8/vp8_scalability.h
Normal file
22
modules/video_coding/codecs/vp8/vp8_scalability.h
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* 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_VP8_VP8_SCALABILITY_H_
|
||||
#define MODULES_VIDEO_CODING_CODECS_VP8_VP8_SCALABILITY_H_
|
||||
|
||||
#include "api/video_codecs/scalability_mode.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
bool VP8SupportsScalabilityMode(ScalabilityMode scalability_mode);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // MODULES_VIDEO_CODING_CODECS_VP8_VP8_SCALABILITY_H_
|
||||
Loading…
x
Reference in New Issue
Block a user