Moves network control interface to API.

This prepares for allowing injection of a network controller.

Bug: webrtc:9155
Change-Id: I5624f47738db9c5cd4750eac76cb6289e06a7aa3
Reviewed-on: https://webrtc-review.googlesource.com/73100
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23188}
This commit is contained in:
Sebastian Jansson 2018-05-09 10:33:39 +02:00 committed by Commit Bot
parent 7eca805ce3
commit c6c44268bc
26 changed files with 114 additions and 124 deletions

View File

@ -18,3 +18,37 @@ rtc_source_set("bitrate_settings") {
"..:optional",
]
}
rtc_static_library("network_control") {
sources = [
"network_control.h",
"network_types.cc",
"network_types.h",
]
deps = [
"..:optional",
"../units:data_rate",
"../units:data_size",
"../units:time_delta",
"../units:timestamp",
]
}
if (rtc_include_tests) {
rtc_source_set("network_control_test") {
testonly = true
sources = [
"test/mock_network_control.h",
"test/network_control_tester.cc",
"test/network_control_tester.h",
]
deps = [
":network_control",
"../:optional",
"../../rtc_base:checks",
"../../rtc_base:rtc_base_approved",
"../../test:test_support",
]
}
}

View File

@ -8,12 +8,12 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef MODULES_CONGESTION_CONTROLLER_NETWORK_CONTROL_INCLUDE_NETWORK_CONTROL_H_
#define MODULES_CONGESTION_CONTROLLER_NETWORK_CONTROL_INCLUDE_NETWORK_CONTROL_H_
#ifndef API_TRANSPORT_NETWORK_CONTROL_H_
#define API_TRANSPORT_NETWORK_CONTROL_H_
#include <stdint.h>
#include <memory>
#include "modules/congestion_controller/network_control/include/network_types.h"
#include "api/transport/network_types.h"
namespace webrtc {
@ -78,6 +78,8 @@ class NetworkControllerInterface {
// controller.
class NetworkControllerFactoryInterface {
public:
virtual ~NetworkControllerFactoryInterface() = default;
// Used to create a new network controller, requires an observer to be
// provided to handle callbacks.
virtual std::unique_ptr<NetworkControllerInterface> Create(
@ -85,8 +87,7 @@ class NetworkControllerFactoryInterface {
// Returns the interval by which the network controller expects
// OnProcessInterval calls.
virtual TimeDelta GetProcessInterval() const = 0;
virtual ~NetworkControllerFactoryInterface() = default;
};
} // namespace webrtc
#endif // MODULES_CONGESTION_CONTROLLER_NETWORK_CONTROL_INCLUDE_NETWORK_CONTROL_H_
#endif // API_TRANSPORT_NETWORK_CONTROL_H_

View File

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "modules/congestion_controller/network_control/include/network_types.h"
#include "api/transport/network_types.h"
namespace webrtc {
@ -65,4 +65,20 @@ NetworkControlUpdate::NetworkControlUpdate(const NetworkControlUpdate&) =
default;
NetworkControlUpdate::~NetworkControlUpdate() = default;
PacedPacketInfo::PacedPacketInfo() = default;
PacedPacketInfo::PacedPacketInfo(int probe_cluster_id,
int probe_cluster_min_probes,
int probe_cluster_min_bytes)
: probe_cluster_id(probe_cluster_id),
probe_cluster_min_probes(probe_cluster_min_probes),
probe_cluster_min_bytes(probe_cluster_min_bytes) {}
bool PacedPacketInfo::operator==(const PacedPacketInfo& rhs) const {
return send_bitrate_bps == rhs.send_bitrate_bps &&
probe_cluster_id == rhs.probe_cluster_id &&
probe_cluster_min_probes == rhs.probe_cluster_min_probes &&
probe_cluster_min_bytes == rhs.probe_cluster_min_bytes;
}
} // namespace webrtc

View File

@ -8,17 +8,16 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef MODULES_CONGESTION_CONTROLLER_NETWORK_CONTROL_INCLUDE_NETWORK_TYPES_H_
#define MODULES_CONGESTION_CONTROLLER_NETWORK_CONTROL_INCLUDE_NETWORK_TYPES_H_
#ifndef API_TRANSPORT_NETWORK_TYPES_H_
#define API_TRANSPORT_NETWORK_TYPES_H_
#include <stdint.h>
#include <vector>
#include "api/optional.h"
#include "api/units/data_rate.h"
#include "api/units/data_size.h"
#include "api/units/time_delta.h"
#include "api/units/timestamp.h"
#include "modules/include/module_common_types.h"
#include "rtc_base/constructormagic.h"
namespace webrtc {
@ -66,6 +65,22 @@ struct NetworkRouteChange {
rtc::Optional<DataRate> starting_rate;
};
struct PacedPacketInfo {
PacedPacketInfo();
PacedPacketInfo(int probe_cluster_id,
int probe_cluster_min_probes,
int probe_cluster_min_bytes);
bool operator==(const PacedPacketInfo& rhs) const;
// TODO(srte): Move probing info to a separate, optional struct.
static constexpr int kNotAProbe = -1;
int send_bitrate_bps = -1;
int probe_cluster_id = kNotAProbe;
int probe_cluster_min_probes = -1;
int probe_cluster_min_bytes = -1;
};
struct SentPacket {
Timestamp send_time = Timestamp::Infinity();
DataSize size = DataSize::Zero();
@ -176,4 +191,4 @@ struct ProcessInterval {
};
} // namespace webrtc
#endif // MODULES_CONGESTION_CONTROLLER_NETWORK_CONTROL_INCLUDE_NETWORK_TYPES_H_
#endif // API_TRANSPORT_NETWORK_TYPES_H_

View File

@ -8,10 +8,10 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef MODULES_CONGESTION_CONTROLLER_NETWORK_CONTROL_TEST_MOCK_NETWORK_CONTROL_H_
#define MODULES_CONGESTION_CONTROLLER_NETWORK_CONTROL_TEST_MOCK_NETWORK_CONTROL_H_
#ifndef API_TRANSPORT_TEST_MOCK_NETWORK_CONTROL_H_
#define API_TRANSPORT_TEST_MOCK_NETWORK_CONTROL_H_
#include "modules/congestion_controller/network_control/include/network_control.h"
#include "api/transport/include/network_control.h"
#include "test/gmock.h"
namespace webrtc {
@ -23,4 +23,4 @@ class MockTargetTransferRateObserver : public TargetTransferRateObserver {
} // namespace test
} // namespace webrtc
#endif // MODULES_CONGESTION_CONTROLLER_NETWORK_CONTROL_TEST_MOCK_NETWORK_CONTROL_H_
#endif // API_TRANSPORT_TEST_MOCK_NETWORK_CONTROL_H_

View File

@ -8,11 +8,11 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "modules/congestion_controller/network_control/test/network_control_tester.h"
#include "api/transport/test/network_control_tester.h"
#include <algorithm>
#include "modules/congestion_controller/network_control/include/network_control.h"
#include "api/transport/network_control.h"
#include "rtc_base/logging.h"
namespace webrtc {

View File

@ -8,15 +8,15 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef MODULES_CONGESTION_CONTROLLER_NETWORK_CONTROL_TEST_NETWORK_CONTROL_TESTER_H_
#define MODULES_CONGESTION_CONTROLLER_NETWORK_CONTROL_TEST_NETWORK_CONTROL_TESTER_H_
#ifndef API_TRANSPORT_TEST_NETWORK_CONTROL_TESTER_H_
#define API_TRANSPORT_TEST_NETWORK_CONTROL_TESTER_H_
#include <deque>
#include <functional>
#include <memory>
#include "api/optional.h"
#include "modules/congestion_controller/network_control/include/network_control.h"
#include "api/transport/network_control.h"
namespace webrtc {
namespace test {
@ -73,4 +73,4 @@ class NetworkControllerTester {
} // namespace test
} // namespace webrtc
#endif // MODULES_CONGESTION_CONTROLLER_NETWORK_CONTROL_TEST_NETWORK_CONTROL_TESTER_H_
#endif // API_TRANSPORT_TEST_NETWORK_CONTROL_TESTER_H_

View File

@ -103,8 +103,8 @@ rtc_source_set("rtp_sender") {
":bitrate_configurator",
":rtp_interfaces",
"..:webrtc_common",
"../api/transport:network_control",
"../modules/congestion_controller",
"../modules/congestion_controller/network_control",
"../modules/congestion_controller/rtp:congestion_controller",
"../modules/pacing",
"../modules/utility",
@ -178,6 +178,7 @@ rtc_static_library("call") {
"../api:callfactory_api",
"../api:optional",
"../api:transport_api",
"../api/transport:network_control",
"../audio",
"../logging:rtc_event_audio",
"../logging:rtc_event_log_api",
@ -186,7 +187,6 @@ rtc_static_library("call") {
"../logging:rtc_stream_config",
"../modules/bitrate_controller",
"../modules/congestion_controller",
"../modules/congestion_controller/network_control",
"../modules/pacing",
"../modules/rtp_rtcp",
"../modules/rtp_rtcp:rtp_rtcp_format",

View File

@ -17,6 +17,7 @@
#include <vector>
#include "api/optional.h"
#include "api/transport/network_control.h"
#include "audio/audio_receive_stream.h"
#include "audio/audio_send_stream.h"
#include "audio/audio_state.h"
@ -37,7 +38,6 @@
#include "logging/rtc_event_log/rtc_stream_config.h"
#include "modules/bitrate_controller/include/bitrate_controller.h"
#include "modules/congestion_controller/include/receive_side_congestion_controller.h"
#include "modules/congestion_controller/network_control/include/network_control.h"
#include "modules/rtp_rtcp/include/flexfec_receiver.h"
#include "modules/rtp_rtcp/include/rtp_header_extension_map.h"
#include "modules/rtp_rtcp/include/rtp_header_parser.h"
@ -54,8 +54,8 @@
#include "rtc_base/ptr_util.h"
#include "rtc_base/rate_limiter.h"
#include "rtc_base/sequenced_task_checker.h"
#include "rtc_base/synchronization/rw_lock_wrapper.h"
#include "rtc_base/strings/string_builder.h"
#include "rtc_base/synchronization/rw_lock_wrapper.h"
#include "rtc_base/task_queue.h"
#include "rtc_base/thread_annotations.h"
#include "rtc_base/trace_event.h"

View File

@ -56,6 +56,7 @@ rtc_source_set("module_api") {
"../api:optional",
"../api:video_frame_api",
"../api:video_frame_api_i420",
"../api/transport:network_control",
"../rtc_base:deprecation",
"../rtc_base:rtc_base_approved",
"video_coding:codec_globals_headers",

View File

@ -185,7 +185,6 @@ if (rtc_include_tests) {
"../rtp_rtcp:rtp_rtcp_format",
"bbr:bbr_unittests",
"goog_cc:goog_cc_unittests",
"network_control:network_control_unittests",
"rtp:congestion_controller_unittests",
]
if (!build_with_chromium && is_clang) {

View File

@ -15,8 +15,8 @@ rtc_static_library("bbr") {
]
deps = [
":bbr_controller",
"../../../api/transport:network_control",
"../../../rtc_base:rtc_base_approved",
"../network_control",
]
}
@ -31,11 +31,11 @@ rtc_source_set("bbr_controller") {
":rtt_stats",
":windowed_filter",
"../../../api:optional",
"../../../api/transport:network_control",
"../../../rtc_base:checks",
"../../../rtc_base:rtc_base_approved",
"../../../rtc_base/experiments:congestion_controller_experiment",
"../../../rtc_base/system:fallthrough",
"../network_control",
]
}
rtc_source_set("data_transfer_tracker") {
@ -85,10 +85,10 @@ if (rtc_include_tests) {
":data_transfer_tracker",
":rtt_stats",
":windowed_filter",
"../../../api/transport:network_control_test",
"../../../api/units:data_rate",
"../../../api/units:time_delta",
"../../../test:test_support",
"../network_control:network_control_test",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).

View File

@ -13,7 +13,7 @@
#include <memory>
#include "modules/congestion_controller/network_control/include/network_control.h"
#include "api/transport/network_control.h"
namespace webrtc {

View File

@ -18,11 +18,11 @@
#include <string>
#include <vector>
#include "api/transport/network_control.h"
#include "api/transport/network_types.h"
#include "modules/congestion_controller/bbr/data_transfer_tracker.h"
#include "modules/congestion_controller/bbr/rtt_stats.h"
#include "modules/congestion_controller/bbr/windowed_filter.h"
#include "modules/congestion_controller/network_control/include/network_control.h"
#include "modules/congestion_controller/network_control/include/network_types.h"
#include "api/optional.h"
#include "rtc_base/random.h"

View File

@ -11,9 +11,9 @@
#include <algorithm>
#include <memory>
#include "api/transport/test/network_control_tester.h"
#include "modules/congestion_controller/bbr/bbr_factory.h"
#include "modules/congestion_controller/bbr/bbr_network_controller.h"
#include "modules/congestion_controller/network_control/test/network_control_tester.h"
#include "test/gmock.h"
#include "test/gtest.h"

View File

@ -44,6 +44,7 @@ rtc_static_library("goog_cc") {
"../../..:webrtc_common",
"../../../:typedefs",
"../../../api:optional",
"../../../api/transport:network_control",
"../../../logging:rtc_event_log_api",
"../../../logging:rtc_event_pacing",
"../../../rtc_base:checks",
@ -56,7 +57,6 @@ rtc_static_library("goog_cc") {
"../../pacing",
"../../remote_bitrate_estimator",
"../../rtp_rtcp:rtp_rtcp_format",
"../network_control",
]
}
@ -144,6 +144,8 @@ if (rtc_include_tests) {
":delay_based_bwe",
":estimators",
":goog_cc",
"../../../api/transport:network_control",
"../../../api/transport:network_control_test",
"../../../rtc_base:checks",
"../../../rtc_base:rtc_base_approved",
"../../../rtc_base:rtc_base_tests_utils",
@ -154,8 +156,6 @@ if (rtc_include_tests) {
"../../pacing",
"../../remote_bitrate_estimator",
"../../rtp_rtcp:rtp_rtcp_format",
"../network_control",
"../network_control:network_control_test",
"//testing/gmock",
]
if (!build_with_chromium && is_clang) {

View File

@ -17,13 +17,13 @@
#include <vector>
#include "api/optional.h"
#include "api/transport/network_control.h"
#include "logging/rtc_event_log/rtc_event_log.h"
#include "modules/bitrate_controller/send_side_bandwidth_estimation.h"
#include "modules/congestion_controller/goog_cc/acknowledged_bitrate_estimator.h"
#include "modules/congestion_controller/goog_cc/alr_detector.h"
#include "modules/congestion_controller/goog_cc/delay_based_bwe.h"
#include "modules/congestion_controller/goog_cc/probe_controller.h"
#include "modules/congestion_controller/network_control/include/network_control.h"
#include "rtc_base/constructormagic.h"
namespace webrtc {

View File

@ -12,7 +12,7 @@
#define MODULES_CONGESTION_CONTROLLER_GOOG_CC_INCLUDE_GOOG_CC_FACTORY_H_
#include <memory>
#include "modules/congestion_controller/network_control/include/network_control.h"
#include "api/transport/network_control.h"
namespace webrtc {
class Clock;

View File

@ -17,7 +17,8 @@
#include <vector>
#include "api/optional.h"
#include "modules/congestion_controller/network_control/include/network_control.h"
#include "api/transport/network_control.h"
#include "rtc_base/constructormagic.h"
namespace webrtc {

View File

@ -9,8 +9,8 @@
*/
#include <memory>
#include "api/transport/network_types.h"
#include "modules/congestion_controller/goog_cc/probe_controller.h"
#include "modules/congestion_controller/network_control/include/network_types.h"
#include "rtc_base/logging.h"
#include "system_wrappers/include/clock.h"
#include "test/gmock.h"

View File

@ -1,54 +0,0 @@
# Copyright (c) 2018 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_static_library("network_control") {
sources = [
"include/network_control.h",
"include/network_types.h",
"network_types.cc",
]
deps = [
"../../:module_api",
"../../../api:optional",
"../../../api/units:data_rate",
"../../../api/units:data_size",
"../../../api/units:time_delta",
"../../../api/units:timestamp",
"../../../rtc_base:checks",
"../../../rtc_base:rtc_base_approved",
]
}
if (rtc_include_tests) {
rtc_source_set("network_control_test") {
testonly = true
sources = [
"test/mock_network_control.h",
"test/network_control_tester.cc",
"test/network_control_tester.h",
]
deps = [
":network_control",
"../../../api:optional",
"../../../rtc_base:checks",
"../../../rtc_base:rtc_base_approved",
"../../../test:test_support",
]
}
rtc_source_set("network_control_unittests") {
testonly = true
sources = []
deps = [
":network_control",
"../../../test:test_support",
]
}
}

View File

@ -39,6 +39,7 @@ rtc_static_library("congestion_controller") {
"../:congestion_controller",
"../..:module_api",
"../../..:webrtc_common",
"../../../api/transport:network_control",
"../../../rtc_base:checks",
"../../../rtc_base:rate_limiter",
"../../../rtc_base:rtc_task_queue_api",
@ -54,7 +55,6 @@ rtc_static_library("congestion_controller") {
"../../rtp_rtcp:rtp_rtcp_format",
"../bbr",
"../goog_cc",
"../network_control",
]
if (!build_with_mozilla) {
@ -96,6 +96,7 @@ if (rtc_include_tests) {
":transport_feedback",
"../:congestion_controller",
"../:mock_congestion_controller",
"../../../api/transport:network_control",
"../../../logging:mocks",
"../../../rtc_base:checks",
"../../../rtc_base:rtc_base",
@ -109,7 +110,6 @@ if (rtc_include_tests) {
"../../pacing:pacing",
"../../remote_bitrate_estimator:remote_bitrate_estimator",
"../../rtp_rtcp:rtp_rtcp_format",
"../network_control",
"//testing/gmock",
]
if (!build_with_chromium && is_clang) {

View File

@ -17,10 +17,10 @@
#include <memory>
#include <vector>
#include "api/transport/network_control.h"
#include "api/transport/network_types.h"
#include "common_types.h" // NOLINT(build/include)
#include "modules/congestion_controller/include/send_side_congestion_controller_interface.h"
#include "modules/congestion_controller/network_control/include/network_control.h"
#include "modules/congestion_controller/network_control/include/network_types.h"
#include "modules/congestion_controller/rtp/pacer_controller.h"
#include "modules/congestion_controller/rtp/transport_feedback_adapter.h"
#include "modules/include/module.h"

View File

@ -13,7 +13,7 @@
#include <memory>
#include "modules/congestion_controller/network_control/include/network_types.h"
#include "api/transport/network_types.h"
#include "modules/pacing/paced_sender.h"
#include "rtc_base/sequenced_task_checker.h"

View File

@ -14,9 +14,9 @@
#include <functional>
#include <memory>
#include <vector>
#include "api/transport/network_types.h"
#include "modules/congestion_controller/bbr/bbr_factory.h"
#include "modules/congestion_controller/goog_cc/include/goog_cc_factory.h"
#include "modules/congestion_controller/network_control/include/network_types.h"
#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
#include "rtc_base/bind.h"
#include "rtc_base/checks.h"

View File

@ -19,6 +19,7 @@
#include "api/optional.h"
#include "api/rtp_headers.h"
#include "api/transport/network_types.h"
#include "api/video/video_rotation.h"
#include "common_types.h" // NOLINT(build/include)
#include "modules/include/module_common_types_public.h"
@ -272,30 +273,6 @@ class CallStatsObserver {
virtual ~CallStatsObserver() {}
};
struct PacedPacketInfo {
PacedPacketInfo() {}
PacedPacketInfo(int probe_cluster_id,
int probe_cluster_min_probes,
int probe_cluster_min_bytes)
: probe_cluster_id(probe_cluster_id),
probe_cluster_min_probes(probe_cluster_min_probes),
probe_cluster_min_bytes(probe_cluster_min_bytes) {}
bool operator==(const PacedPacketInfo& rhs) const {
return send_bitrate_bps == rhs.send_bitrate_bps &&
probe_cluster_id == rhs.probe_cluster_id &&
probe_cluster_min_probes == rhs.probe_cluster_min_probes &&
probe_cluster_min_bytes == rhs.probe_cluster_min_bytes;
}
static constexpr int kNotAProbe = -1;
int send_bitrate_bps = -1;
int probe_cluster_id = kNotAProbe;
int probe_cluster_min_probes = -1;
int probe_cluster_min_bytes = -1;
};
} // namespace webrtc
#endif // MODULES_INCLUDE_MODULE_COMMON_TYPES_H_