Moves network unit types to API.

This prepares for being able to inject network congestion controllers.
And makes it easier to use the units in other parts of the code.

Bug: webrtc:9155
Change-Id: Ib8f9c1c97b06d791a01c3376046933d576ae46f9
Reviewed-on: https://webrtc-review.googlesource.com/70201
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23168}
This commit is contained in:
Sebastian Jansson
2018-05-08 10:43:18 +02:00
committed by Commit Bot
parent 76c106725a
commit 6fae6ec2ee
21 changed files with 58 additions and 58 deletions

View File

@ -493,6 +493,7 @@ if (rtc_include_tests) {
"../rtc_base:rtc_base_approved",
"../rtc_base:rtc_base_tests_utils",
"../test:test_support",
"units:units_unittests",
]
}
}

View File

@ -6,7 +6,7 @@
# 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")
import("../../webrtc.gni")
rtc_source_set("data_rate") {
sources = [
@ -17,8 +17,8 @@ rtc_source_set("data_rate") {
deps = [
":data_size",
":time_delta",
"../../../../rtc_base:checks",
"../../../../rtc_base:rtc_base_approved",
"../../rtc_base:checks",
"../../rtc_base:rtc_base_approved",
]
}
@ -29,8 +29,8 @@ rtc_source_set("data_size") {
]
deps = [
"../../../../rtc_base:checks",
"../../../../rtc_base:rtc_base_approved",
"../../rtc_base:checks",
"../../rtc_base:rtc_base_approved",
]
}
rtc_source_set("time_delta") {
@ -40,8 +40,8 @@ rtc_source_set("time_delta") {
]
deps = [
"../../../../rtc_base:checks",
"../../../../rtc_base:rtc_base_approved",
"../../rtc_base:checks",
"../../rtc_base:rtc_base_approved",
]
}
@ -53,8 +53,8 @@ rtc_source_set("timestamp") {
deps = [
":time_delta",
"../../../../rtc_base:checks",
"../../../../rtc_base:rtc_base_approved",
"../../rtc_base:checks",
"../../rtc_base:rtc_base_approved",
]
}
@ -72,7 +72,7 @@ if (rtc_include_tests) {
":data_size",
":time_delta",
":timestamp",
"../../../../test:test_support",
"../../test:test_support",
]
}
}

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/units/data_rate.h"
#include "api/units/data_rate.h"
#include "rtc_base/strings/string_builder.h"

View File

@ -8,9 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef MODULES_CONGESTION_CONTROLLER_NETWORK_CONTROL_UNITS_DATA_RATE_H_
#define MODULES_CONGESTION_CONTROLLER_NETWORK_CONTROL_UNITS_DATA_RATE_H_
#ifndef API_UNITS_DATA_RATE_H_
#define API_UNITS_DATA_RATE_H_
#include <stdint.h>
#include <cmath>
#include <limits>
@ -18,8 +17,8 @@
#include "rtc_base/checks.h"
#include "modules/congestion_controller/network_control/units/data_size.h"
#include "modules/congestion_controller/network_control/units/time_delta.h"
#include "api/units/data_size.h"
#include "api/units/time_delta.h"
namespace webrtc {
namespace data_rate_impl {
@ -131,4 +130,4 @@ std::string ToString(const DataRate& value);
} // namespace webrtc
#endif // MODULES_CONGESTION_CONTROLLER_NETWORK_CONTROL_UNITS_DATA_RATE_H_
#endif // API_UNITS_DATA_RATE_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/units/data_rate.h"
#include "api/units/data_rate.h"
#include "test/gtest.h"
namespace webrtc {

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/units/data_size.h"
#include "api/units/data_size.h"
#include "rtc_base/strings/string_builder.h"

View File

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef MODULES_CONGESTION_CONTROLLER_NETWORK_CONTROL_UNITS_DATA_SIZE_H_
#define MODULES_CONGESTION_CONTROLLER_NETWORK_CONTROL_UNITS_DATA_SIZE_H_
#ifndef API_UNITS_DATA_SIZE_H_
#define API_UNITS_DATA_SIZE_H_
#include <stdint.h>
#include <cmath>
@ -102,4 +102,4 @@ std::string ToString(const DataSize& value);
} // namespace webrtc
#endif // MODULES_CONGESTION_CONTROLLER_NETWORK_CONTROL_UNITS_DATA_SIZE_H_
#endif // API_UNITS_DATA_SIZE_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/units/data_size.h"
#include "api/units/data_size.h"
#include "test/gtest.h"
namespace webrtc {

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/units/time_delta.h"
#include "api/units/time_delta.h"
#include "rtc_base/strings/string_builder.h"

View File

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef MODULES_CONGESTION_CONTROLLER_NETWORK_CONTROL_UNITS_TIME_DELTA_H_
#define MODULES_CONGESTION_CONTROLLER_NETWORK_CONTROL_UNITS_TIME_DELTA_H_
#ifndef API_UNITS_TIME_DELTA_H_
#define API_UNITS_TIME_DELTA_H_
#include <stdint.h>
#include <cmath>
@ -142,4 +142,4 @@ inline TimeDelta operator/(const TimeDelta& delta, const int64_t& scalar) {
std::string ToString(const TimeDelta& value);
} // namespace webrtc
#endif // MODULES_CONGESTION_CONTROLLER_NETWORK_CONTROL_UNITS_TIME_DELTA_H_
#endif // API_UNITS_TIME_DELTA_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/units/time_delta.h"
#include "api/units/time_delta.h"
#include "test/gtest.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/units/timestamp.h"
#include "api/units/timestamp.h"
#include "rtc_base/strings/string_builder.h"

View File

@ -8,14 +8,14 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef MODULES_CONGESTION_CONTROLLER_NETWORK_CONTROL_UNITS_TIMESTAMP_H_
#define MODULES_CONGESTION_CONTROLLER_NETWORK_CONTROL_UNITS_TIMESTAMP_H_
#ifndef API_UNITS_TIMESTAMP_H_
#define API_UNITS_TIMESTAMP_H_
#include <stdint.h>
#include <limits>
#include <string>
#include "modules/congestion_controller/network_control/units/time_delta.h"
#include "api/units/time_delta.h"
#include "rtc_base/checks.h"
namespace webrtc {
@ -92,4 +92,4 @@ std::string ToString(const Timestamp& value);
} // namespace webrtc
#endif // MODULES_CONGESTION_CONTROLLER_NETWORK_CONTROL_UNITS_TIMESTAMP_H_
#endif // API_UNITS_TIMESTAMP_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/units/timestamp.h"
#include "api/units/timestamp.h"
#include "test/gtest.h"
namespace webrtc {

View File

@ -45,11 +45,11 @@ rtc_source_set("data_transfer_tracker") {
"data_transfer_tracker.h",
]
deps = [
"../../../api/units:data_size",
"../../../api/units:time_delta",
"../../../api/units:timestamp",
"../../../rtc_base:checks",
"../../../rtc_base:rtc_base_approved",
"../network_control/units:data_size",
"../network_control/units:time_delta",
"../network_control/units:timestamp",
]
}
rtc_source_set("rtt_stats") {
@ -59,9 +59,9 @@ rtc_source_set("rtt_stats") {
"rtt_stats.h",
]
deps = [
"../../../api/units:time_delta",
"../../../api/units:timestamp",
"../../../rtc_base:rtc_base_approved",
"../network_control/units:time_delta",
"../network_control/units:timestamp",
]
}
rtc_source_set("windowed_filter") {
@ -85,10 +85,10 @@ if (rtc_include_tests) {
":data_transfer_tracker",
":rtt_stats",
":windowed_filter",
"../../../api/units:data_rate",
"../../../api/units:time_delta",
"../../../test:test_support",
"../network_control:network_control_test",
"../network_control/units:data_rate",
"../network_control/units:time_delta",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).

View File

@ -11,9 +11,10 @@
#define MODULES_CONGESTION_CONTROLLER_BBR_DATA_TRANSFER_TRACKER_H_
#include <deque>
#include "modules/congestion_controller/network_control/units/data_size.h"
#include "modules/congestion_controller/network_control/units/time_delta.h"
#include "modules/congestion_controller/network_control/units/timestamp.h"
#include "api/units/data_size.h"
#include "api/units/time_delta.h"
#include "api/units/timestamp.h"
namespace webrtc {
namespace bbr {

View File

@ -16,8 +16,8 @@
#include <algorithm>
#include <cstdint>
#include "modules/congestion_controller/network_control/units/time_delta.h"
#include "modules/congestion_controller/network_control/units/timestamp.h"
#include "api/units/time_delta.h"
#include "api/units/timestamp.h"
#include "rtc_base/constructormagic.h"
#include "rtc_base/logging.h"

View File

@ -10,8 +10,8 @@
#include "modules/congestion_controller/bbr/windowed_filter.h"
#include "modules/congestion_controller/network_control/units/data_rate.h"
#include "modules/congestion_controller/network_control/units/time_delta.h"
#include "api/units/data_rate.h"
#include "api/units/time_delta.h"
#include "modules/congestion_controller/bbr/rtt_stats.h"
#include "test/gtest.h"

View File

@ -18,12 +18,12 @@ rtc_static_library("network_control") {
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",
"units:data_rate",
"units:data_size",
"units:time_delta",
"units:timestamp",
]
}
@ -49,7 +49,6 @@ if (rtc_include_tests) {
deps = [
":network_control",
"../../../test:test_support",
"units:units_unittests",
]
}
}

View File

@ -12,13 +12,12 @@
#define MODULES_CONGESTION_CONTROLLER_NETWORK_CONTROL_INCLUDE_NETWORK_TYPES_H_
#include <stdint.h>
#include <vector>
#include "modules/congestion_controller/network_control/units/data_rate.h"
#include "modules/congestion_controller/network_control/units/data_size.h"
#include "modules/congestion_controller/network_control/units/time_delta.h"
#include "modules/congestion_controller/network_control/units/timestamp.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 {

View File

@ -23,6 +23,7 @@
// https://code.google.com/p/chromium/codesearch#chromium/src/base/time/time.h
namespace rtc {
// TODO(srte): Replace usage of this class with webrtc::TimeDelta.
class TimeDelta {
public:
TimeDelta() : delta_(0) {}