aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrik Boström <hbos@webrtc.org>2020-06-03 09:24:06 +0200
committerCommit Bot <commit-bot@chromium.org>2020-06-03 08:51:29 +0000
commite2e8c17cbff03a3113ffe0f3c44f8f2b7eb58eb4 (patch)
tree90d9f58fc1d0d7005a0a9e33ecab170ae6ea6d8e
parent3ca2836f701fc2fbc2ddaa0000d6ad655b5e3caa (diff)
downloadwebrtc-e2e8c17cbff03a3113ffe0f3c44f8f2b7eb58eb4.tar.gz
[Adaptation] Move Resource to api/ folder.
This is a prerequisite to implementing it externally. Bug: webrtc:11525 Change-Id: I9cb3b4418396485d3eb9f25cafa51cbff6db7817 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176401 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Stefan Holmer <stefan@webrtc.org> Reviewed-by: Evan Shrubsole <eshr@google.com> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Cr-Commit-Position: refs/heads/master@{#31418}
-rw-r--r--api/adaptation/BUILD.gn22
-rw-r--r--api/adaptation/DEPS7
-rw-r--r--api/adaptation/resource.cc (renamed from call/adaptation/resource.cc)5
-rw-r--r--api/adaptation/resource.h (renamed from call/adaptation/resource.h)8
-rw-r--r--call/adaptation/BUILD.gn5
-rw-r--r--call/adaptation/adaptation_constraint.h2
-rw-r--r--call/adaptation/adaptation_listener.h2
-rw-r--r--call/adaptation/resource_adaptation_processor.h2
-rw-r--r--call/adaptation/resource_adaptation_processor_interface.h2
-rw-r--r--call/adaptation/resource_adaptation_processor_unittest.cc2
-rw-r--r--call/adaptation/resource_unittest.cc2
-rw-r--r--call/adaptation/test/fake_resource.h2
-rw-r--r--call/adaptation/video_source_restrictions.cc14
-rw-r--r--call/adaptation/video_source_restrictions.h14
-rw-r--r--call/adaptation/video_stream_adapter.h2
-rw-r--r--video/BUILD.gn2
-rw-r--r--video/adaptation/BUILD.gn1
-rw-r--r--video/adaptation/video_stream_encoder_resource.h2
-rw-r--r--video/adaptation/video_stream_encoder_resource_manager.cc2
-rw-r--r--video/adaptation/video_stream_encoder_resource_manager.h2
-rw-r--r--video/video_source_sink_controller.cc1
-rw-r--r--video/video_stream_encoder.h2
22 files changed, 67 insertions, 36 deletions
diff --git a/api/adaptation/BUILD.gn b/api/adaptation/BUILD.gn
new file mode 100644
index 0000000000..9716748e25
--- /dev/null
+++ b/api/adaptation/BUILD.gn
@@ -0,0 +1,22 @@
+# 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.
+
+import("../../webrtc.gni")
+
+rtc_source_set("resource_adaptation_api") {
+ visibility = [ "*" ]
+ sources = [
+ "resource.cc",
+ "resource.h",
+ ]
+ deps = [
+ "../../api:scoped_refptr",
+ "../../rtc_base:refcount",
+ "../../rtc_base:rtc_base_approved",
+ ]
+}
diff --git a/api/adaptation/DEPS b/api/adaptation/DEPS
new file mode 100644
index 0000000000..cab7fb8e14
--- /dev/null
+++ b/api/adaptation/DEPS
@@ -0,0 +1,7 @@
+specific_include_rules = {
+ "resource\.h": [
+ # ref_count.h is a public_deps of rtc_base_approved. Necessary because of
+ # rtc::RefCountInterface.
+ "+rtc_base/ref_count.h",
+ ],
+} \ No newline at end of file
diff --git a/call/adaptation/resource.cc b/api/adaptation/resource.cc
index 6b1028eb73..0a9c83a311 100644
--- a/call/adaptation/resource.cc
+++ b/api/adaptation/resource.cc
@@ -8,10 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "call/adaptation/resource.h"
-
-#include "absl/algorithm/container.h"
-#include "rtc_base/checks.h"
+#include "api/adaptation/resource.h"
namespace webrtc {
diff --git a/call/adaptation/resource.h b/api/adaptation/resource.h
index a58b69fed5..1a5bdd4ae4 100644
--- a/call/adaptation/resource.h
+++ b/api/adaptation/resource.h
@@ -8,14 +8,12 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef CALL_ADAPTATION_RESOURCE_H_
-#define CALL_ADAPTATION_RESOURCE_H_
+#ifndef API_ADAPTATION_RESOURCE_H_
+#define API_ADAPTATION_RESOURCE_H_
#include <string>
#include "api/scoped_refptr.h"
-#include "call/adaptation/video_source_restrictions.h"
-#include "call/adaptation/video_stream_input_state.h"
#include "rtc_base/ref_count.h"
namespace webrtc {
@@ -64,4 +62,4 @@ class Resource : public rtc::RefCountInterface {
} // namespace webrtc
-#endif // CALL_ADAPTATION_RESOURCE_H_
+#endif // API_ADAPTATION_RESOURCE_H_
diff --git a/call/adaptation/BUILD.gn b/call/adaptation/BUILD.gn
index dac6b2db5e..30df3df7a9 100644
--- a/call/adaptation/BUILD.gn
+++ b/call/adaptation/BUILD.gn
@@ -16,8 +16,6 @@ rtc_library("resource_adaptation") {
"adaptation_listener.h",
"encoder_settings.cc",
"encoder_settings.h",
- "resource.cc",
- "resource.h",
"resource_adaptation_processor.cc",
"resource_adaptation_processor.h",
"resource_adaptation_processor_interface.cc",
@@ -34,6 +32,7 @@ rtc_library("resource_adaptation") {
deps = [
"../../api:rtp_parameters",
"../../api:scoped_refptr",
+ "../../api/adaptation:resource_adaptation_api",
"../../api/task_queue:task_queue",
"../../api/video:video_adaptation",
"../../api/video:video_frame",
@@ -66,6 +65,7 @@ if (rtc_include_tests) {
":resource_adaptation",
":resource_adaptation_test_utilities",
"../../api:scoped_refptr",
+ "../../api/adaptation:resource_adaptation_api",
"../../api/task_queue:default_task_queue_factory",
"../../api/task_queue:task_queue",
"../../api/video:video_adaptation",
@@ -98,6 +98,7 @@ if (rtc_include_tests) {
deps = [
":resource_adaptation",
"../../api:scoped_refptr",
+ "../../api/adaptation:resource_adaptation_api",
"../../api/task_queue:task_queue",
"../../api/video:video_stream_encoder",
"../../rtc_base:rtc_base_approved",
diff --git a/call/adaptation/adaptation_constraint.h b/call/adaptation/adaptation_constraint.h
index ce15e32a13..9ff15d6b86 100644
--- a/call/adaptation/adaptation_constraint.h
+++ b/call/adaptation/adaptation_constraint.h
@@ -13,8 +13,8 @@
#include <string>
+#include "api/adaptation/resource.h"
#include "api/scoped_refptr.h"
-#include "call/adaptation/resource.h"
#include "call/adaptation/video_source_restrictions.h"
#include "call/adaptation/video_stream_input_state.h"
diff --git a/call/adaptation/adaptation_listener.h b/call/adaptation/adaptation_listener.h
index 028897ea9d..4a96baef8e 100644
--- a/call/adaptation/adaptation_listener.h
+++ b/call/adaptation/adaptation_listener.h
@@ -11,8 +11,8 @@
#ifndef CALL_ADAPTATION_ADAPTATION_LISTENER_H_
#define CALL_ADAPTATION_ADAPTATION_LISTENER_H_
+#include "api/adaptation/resource.h"
#include "api/scoped_refptr.h"
-#include "call/adaptation/resource.h"
#include "call/adaptation/video_source_restrictions.h"
#include "call/adaptation/video_stream_input_state.h"
diff --git a/call/adaptation/resource_adaptation_processor.h b/call/adaptation/resource_adaptation_processor.h
index f052993df1..3dc21845a5 100644
--- a/call/adaptation/resource_adaptation_processor.h
+++ b/call/adaptation/resource_adaptation_processor.h
@@ -17,6 +17,7 @@
#include <vector>
#include "absl/types/optional.h"
+#include "api/adaptation/resource.h"
#include "api/rtp_parameters.h"
#include "api/scoped_refptr.h"
#include "api/task_queue/task_queue_base.h"
@@ -24,7 +25,6 @@
#include "api/video/video_stream_encoder_observer.h"
#include "call/adaptation/adaptation_constraint.h"
#include "call/adaptation/adaptation_listener.h"
-#include "call/adaptation/resource.h"
#include "call/adaptation/resource_adaptation_processor_interface.h"
#include "call/adaptation/video_source_restrictions.h"
#include "call/adaptation/video_stream_adapter.h"
diff --git a/call/adaptation/resource_adaptation_processor_interface.h b/call/adaptation/resource_adaptation_processor_interface.h
index d482409ba9..eb71d51cdc 100644
--- a/call/adaptation/resource_adaptation_processor_interface.h
+++ b/call/adaptation/resource_adaptation_processor_interface.h
@@ -12,6 +12,7 @@
#define CALL_ADAPTATION_RESOURCE_ADAPTATION_PROCESSOR_INTERFACE_H_
#include "absl/types/optional.h"
+#include "api/adaptation/resource.h"
#include "api/rtp_parameters.h"
#include "api/scoped_refptr.h"
#include "api/task_queue/task_queue_base.h"
@@ -20,7 +21,6 @@
#include "call/adaptation/adaptation_constraint.h"
#include "call/adaptation/adaptation_listener.h"
#include "call/adaptation/encoder_settings.h"
-#include "call/adaptation/resource.h"
#include "call/adaptation/video_source_restrictions.h"
namespace webrtc {
diff --git a/call/adaptation/resource_adaptation_processor_unittest.cc b/call/adaptation/resource_adaptation_processor_unittest.cc
index 6cb11ce6ac..efdbb0e73c 100644
--- a/call/adaptation/resource_adaptation_processor_unittest.cc
+++ b/call/adaptation/resource_adaptation_processor_unittest.cc
@@ -10,9 +10,9 @@
#include "call/adaptation/resource_adaptation_processor.h"
+#include "api/adaptation/resource.h"
#include "api/scoped_refptr.h"
#include "api/video/video_adaptation_counters.h"
-#include "call/adaptation/resource.h"
#include "call/adaptation/resource_adaptation_processor_interface.h"
#include "call/adaptation/test/fake_adaptation_constraint.h"
#include "call/adaptation/test/fake_adaptation_listener.h"
diff --git a/call/adaptation/resource_unittest.cc b/call/adaptation/resource_unittest.cc
index 49b932420f..ee57f91f0d 100644
--- a/call/adaptation/resource_unittest.cc
+++ b/call/adaptation/resource_unittest.cc
@@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "call/adaptation/resource.h"
+#include "api/adaptation/resource.h"
#include <memory>
diff --git a/call/adaptation/test/fake_resource.h b/call/adaptation/test/fake_resource.h
index 0f42c51351..e88d97db7a 100644
--- a/call/adaptation/test/fake_resource.h
+++ b/call/adaptation/test/fake_resource.h
@@ -15,8 +15,8 @@
#include <vector>
#include "absl/types/optional.h"
+#include "api/adaptation/resource.h"
#include "api/scoped_refptr.h"
-#include "call/adaptation/resource.h"
namespace webrtc {
diff --git a/call/adaptation/video_source_restrictions.cc b/call/adaptation/video_source_restrictions.cc
index 6fbdcb42a6..e9d6c26137 100644
--- a/call/adaptation/video_source_restrictions.cc
+++ b/call/adaptation/video_source_restrictions.cc
@@ -13,6 +13,7 @@
#include <limits>
#include "rtc_base/checks.h"
+#include "rtc_base/strings/string_builder.h"
namespace webrtc {
@@ -36,6 +37,19 @@ VideoSourceRestrictions::VideoSourceRestrictions(
RTC_DCHECK(!max_frame_rate_.has_value() || max_frame_rate_.value() > 0.0);
}
+std::string VideoSourceRestrictions::ToString() const {
+ rtc::StringBuilder ss;
+ ss << "{";
+ if (max_frame_rate_)
+ ss << " max_fps=" << max_frame_rate_.value();
+ if (max_pixels_per_frame_)
+ ss << " max_pixels_per_frame=" << max_pixels_per_frame_.value();
+ if (target_pixels_per_frame_)
+ ss << " target_pixels_per_frame=" << target_pixels_per_frame_.value();
+ ss << " }";
+ return ss.Release();
+}
+
const absl::optional<size_t>& VideoSourceRestrictions::max_pixels_per_frame()
const {
return max_pixels_per_frame_;
diff --git a/call/adaptation/video_source_restrictions.h b/call/adaptation/video_source_restrictions.h
index 9ee670dba5..7f79a48e5d 100644
--- a/call/adaptation/video_source_restrictions.h
+++ b/call/adaptation/video_source_restrictions.h
@@ -15,7 +15,6 @@
#include <utility>
#include "absl/types/optional.h"
-#include "rtc_base/strings/string_builder.h"
namespace webrtc {
@@ -40,18 +39,7 @@ class VideoSourceRestrictions {
return !(*this == rhs);
}
- std::string ToString() const {
- rtc::StringBuilder ss;
- ss << "{";
- if (max_frame_rate_)
- ss << " max_fps=" << max_frame_rate_.value();
- if (max_pixels_per_frame_)
- ss << " max_pixels_per_frame=" << max_pixels_per_frame_.value();
- if (target_pixels_per_frame_)
- ss << " target_pixels_per_frame=" << target_pixels_per_frame_.value();
- ss << " }";
- return ss.Release();
- }
+ std::string ToString() const;
// The source must produce a resolution less than or equal to
// max_pixels_per_frame().
diff --git a/call/adaptation/video_stream_adapter.h b/call/adaptation/video_stream_adapter.h
index 179412fbcc..cd21cee989 100644
--- a/call/adaptation/video_stream_adapter.h
+++ b/call/adaptation/video_stream_adapter.h
@@ -14,9 +14,9 @@
#include <memory>
#include "absl/types/optional.h"
+#include "api/adaptation/resource.h"
#include "api/rtp_parameters.h"
#include "api/video/video_adaptation_counters.h"
-#include "call/adaptation/resource.h"
#include "call/adaptation/video_source_restrictions.h"
#include "call/adaptation/video_stream_input_state.h"
#include "modules/video_coding/utility/quality_scaler.h"
diff --git a/video/BUILD.gn b/video/BUILD.gn
index 73f0fd4aec..718870ef99 100644
--- a/video/BUILD.gn
+++ b/video/BUILD.gn
@@ -212,6 +212,7 @@ rtc_library("video_stream_encoder_impl") {
deps = [
"../api:rtp_parameters",
+ "../api/adaptation:resource_adaptation_api",
"../api/task_queue:task_queue",
"../api/units:data_rate",
"../api/video:encoded_image",
@@ -564,6 +565,7 @@ if (rtc_include_tests) {
"../api:scoped_refptr",
"../api:simulated_network_api",
"../api:transport_api",
+ "../api/adaptation:resource_adaptation_api",
"../api/crypto:options",
"../api/rtc_event_log",
"../api/task_queue",
diff --git a/video/adaptation/BUILD.gn b/video/adaptation/BUILD.gn
index e27e5b5297..ec7e4aa086 100644
--- a/video/adaptation/BUILD.gn
+++ b/video/adaptation/BUILD.gn
@@ -25,6 +25,7 @@ rtc_library("video_adaptation") {
deps = [
"../../api:rtp_parameters",
"../../api:scoped_refptr",
+ "../../api/adaptation:resource_adaptation_api",
"../../api/task_queue:task_queue",
"../../api/video:video_adaptation",
"../../api/video:video_frame",
diff --git a/video/adaptation/video_stream_encoder_resource.h b/video/adaptation/video_stream_encoder_resource.h
index 0802c5cd61..739702c363 100644
--- a/video/adaptation/video_stream_encoder_resource.h
+++ b/video/adaptation/video_stream_encoder_resource.h
@@ -15,10 +15,10 @@
#include <vector>
#include "absl/types/optional.h"
+#include "api/adaptation/resource.h"
#include "api/task_queue/task_queue_base.h"
#include "call/adaptation/adaptation_constraint.h"
#include "call/adaptation/adaptation_listener.h"
-#include "call/adaptation/resource.h"
#include "rtc_base/critical_section.h"
#include "rtc_base/synchronization/sequence_checker.h"
diff --git a/video/adaptation/video_stream_encoder_resource_manager.cc b/video/adaptation/video_stream_encoder_resource_manager.cc
index 5b20e1f4e2..eb7e3063c7 100644
--- a/video/adaptation/video_stream_encoder_resource_manager.cc
+++ b/video/adaptation/video_stream_encoder_resource_manager.cc
@@ -19,10 +19,10 @@
#include "absl/algorithm/container.h"
#include "absl/base/macros.h"
+#include "api/adaptation/resource.h"
#include "api/task_queue/task_queue_base.h"
#include "api/video/video_adaptation_reason.h"
#include "api/video/video_source_interface.h"
-#include "call/adaptation/resource.h"
#include "call/adaptation/video_source_restrictions.h"
#include "rtc_base/logging.h"
#include "rtc_base/numerics/safe_conversions.h"
diff --git a/video/adaptation/video_stream_encoder_resource_manager.h b/video/adaptation/video_stream_encoder_resource_manager.h
index ef426363cf..c9b8740d29 100644
--- a/video/adaptation/video_stream_encoder_resource_manager.h
+++ b/video/adaptation/video_stream_encoder_resource_manager.h
@@ -20,6 +20,7 @@
#include <vector>
#include "absl/types/optional.h"
+#include "api/adaptation/resource.h"
#include "api/rtp_parameters.h"
#include "api/scoped_refptr.h"
#include "api/task_queue/task_queue_base.h"
@@ -31,7 +32,6 @@
#include "api/video_codecs/video_codec.h"
#include "api/video_codecs/video_encoder.h"
#include "api/video_codecs/video_encoder_config.h"
-#include "call/adaptation/resource.h"
#include "call/adaptation/resource_adaptation_processor_interface.h"
#include "call/adaptation/video_stream_adapter.h"
#include "call/adaptation/video_stream_input_state_provider.h"
diff --git a/video/video_source_sink_controller.cc b/video/video_source_sink_controller.cc
index ea1059c2e9..7c24eadef5 100644
--- a/video/video_source_sink_controller.cc
+++ b/video/video_source_sink_controller.cc
@@ -16,6 +16,7 @@
#include "rtc_base/logging.h"
#include "rtc_base/numerics/safe_conversions.h"
+#include "rtc_base/strings/string_builder.h"
namespace webrtc {
diff --git a/video/video_stream_encoder.h b/video/video_stream_encoder.h
index 83b69113a2..0402ecc595 100644
--- a/video/video_stream_encoder.h
+++ b/video/video_stream_encoder.h
@@ -17,6 +17,7 @@
#include <string>
#include <vector>
+#include "api/adaptation/resource.h"
#include "api/units/data_rate.h"
#include "api/video/video_bitrate_allocator.h"
#include "api/video/video_rotation.h"
@@ -28,7 +29,6 @@
#include "api/video_codecs/video_encoder.h"
#include "call/adaptation/adaptation_constraint.h"
#include "call/adaptation/adaptation_listener.h"
-#include "call/adaptation/resource.h"
#include "call/adaptation/resource_adaptation_processor_interface.h"
#include "call/adaptation/video_source_restrictions.h"
#include "call/adaptation/video_stream_input_state_provider.h"