[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}
This commit is contained in:
Henrik Boström 2020-06-03 09:24:06 +02:00 committed by Commit Bot
parent 3ca2836f70
commit e2e8c17cbf
22 changed files with 67 additions and 36 deletions

22
api/adaptation/BUILD.gn Normal file
View File

@ -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",
]
}

7
api/adaptation/DEPS Normal file
View File

@ -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",
],
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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().

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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