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}diff --git a/api/BUILD.gn b/api/BUILD.gn
index c394584..989858f 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -493,6 +493,7 @@
"../rtc_base:rtc_base_approved",
"../rtc_base:rtc_base_tests_utils",
"../test:test_support",
+ "units:units_unittests",
]
}
}
diff --git a/modules/congestion_controller/network_control/units/BUILD.gn b/api/units/BUILD.gn
similarity index 75%
rename from modules/congestion_controller/network_control/units/BUILD.gn
rename to api/units/BUILD.gn
index 214b4ca..7dbddf4 100644
--- a/modules/congestion_controller/network_control/units/BUILD.gn
+++ b/api/units/BUILD.gn
@@ -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 @@
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 @@
]
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 @@
]
deps = [
- "../../../../rtc_base:checks",
- "../../../../rtc_base:rtc_base_approved",
+ "../../rtc_base:checks",
+ "../../rtc_base:rtc_base_approved",
]
}
@@ -53,8 +53,8 @@
deps = [
":time_delta",
- "../../../../rtc_base:checks",
- "../../../../rtc_base:rtc_base_approved",
+ "../../rtc_base:checks",
+ "../../rtc_base:rtc_base_approved",
]
}
@@ -72,7 +72,7 @@
":data_size",
":time_delta",
":timestamp",
- "../../../../test:test_support",
+ "../../test:test_support",
]
}
}
diff --git a/modules/congestion_controller/network_control/units/data_rate.cc b/api/units/data_rate.cc
similarity index 90%
rename from modules/congestion_controller/network_control/units/data_rate.cc
rename to api/units/data_rate.cc
index b59fad4..4e31d51 100644
--- a/modules/congestion_controller/network_control/units/data_rate.cc
+++ b/api/units/data_rate.cc
@@ -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"
diff --git a/modules/congestion_controller/network_control/units/data_rate.h b/api/units/data_rate.h
similarity index 91%
rename from modules/congestion_controller/network_control/units/data_rate.h
rename to api/units/data_rate.h
index d71e273..067b200 100644
--- a/modules/congestion_controller/network_control/units/data_rate.h
+++ b/api/units/data_rate.h
@@ -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 @@
} // namespace webrtc
-#endif // MODULES_CONGESTION_CONTROLLER_NETWORK_CONTROL_UNITS_DATA_RATE_H_
+#endif // API_UNITS_DATA_RATE_H_
diff --git a/modules/congestion_controller/network_control/units/data_rate_unittest.cc b/api/units/data_rate_unittest.cc
similarity index 97%
rename from modules/congestion_controller/network_control/units/data_rate_unittest.cc
rename to api/units/data_rate_unittest.cc
index 68375b1..d4dd192 100644
--- a/modules/congestion_controller/network_control/units/data_rate_unittest.cc
+++ b/api/units/data_rate_unittest.cc
@@ -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 {
diff --git a/modules/congestion_controller/network_control/units/data_size.cc b/api/units/data_size.cc
similarity index 90%
rename from modules/congestion_controller/network_control/units/data_size.cc
rename to api/units/data_size.cc
index cd78e89..4440f89 100644
--- a/modules/congestion_controller/network_control/units/data_size.cc
+++ b/api/units/data_size.cc
@@ -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"
diff --git a/modules/congestion_controller/network_control/units/data_size.h b/api/units/data_size.h
similarity index 93%
rename from modules/congestion_controller/network_control/units/data_size.h
rename to api/units/data_size.h
index fc0b60f..74ab19e 100644
--- a/modules/congestion_controller/network_control/units/data_size.h
+++ b/api/units/data_size.h
@@ -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 @@
} // namespace webrtc
-#endif // MODULES_CONGESTION_CONTROLLER_NETWORK_CONTROL_UNITS_DATA_SIZE_H_
+#endif // API_UNITS_DATA_SIZE_H_
diff --git a/modules/congestion_controller/network_control/units/data_size_unittest.cc b/api/units/data_size_unittest.cc
similarity index 96%
rename from modules/congestion_controller/network_control/units/data_size_unittest.cc
rename to api/units/data_size_unittest.cc
index febc170..35cff01 100644
--- a/modules/congestion_controller/network_control/units/data_size_unittest.cc
+++ b/api/units/data_size_unittest.cc
@@ -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 {
diff --git a/modules/congestion_controller/network_control/units/time_delta.cc b/api/units/time_delta.cc
similarity index 90%
rename from modules/congestion_controller/network_control/units/time_delta.cc
rename to api/units/time_delta.cc
index f432238..398df77 100644
--- a/modules/congestion_controller/network_control/units/time_delta.cc
+++ b/api/units/time_delta.cc
@@ -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"
diff --git a/modules/congestion_controller/network_control/units/time_delta.h b/api/units/time_delta.h
similarity index 95%
rename from modules/congestion_controller/network_control/units/time_delta.h
rename to api/units/time_delta.h
index 71859c1..826e1a3 100644
--- a/modules/congestion_controller/network_control/units/time_delta.h
+++ b/api/units/time_delta.h
@@ -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 @@
std::string ToString(const TimeDelta& value);
} // namespace webrtc
-#endif // MODULES_CONGESTION_CONTROLLER_NETWORK_CONTROL_UNITS_TIME_DELTA_H_
+#endif // API_UNITS_TIME_DELTA_H_
diff --git a/modules/congestion_controller/network_control/units/time_delta_unittest.cc b/api/units/time_delta_unittest.cc
similarity index 97%
rename from modules/congestion_controller/network_control/units/time_delta_unittest.cc
rename to api/units/time_delta_unittest.cc
index c1384a4..493c6bf 100644
--- a/modules/congestion_controller/network_control/units/time_delta_unittest.cc
+++ b/api/units/time_delta_unittest.cc
@@ -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"
diff --git a/modules/congestion_controller/network_control/units/timestamp.cc b/api/units/timestamp.cc
similarity index 91%
rename from modules/congestion_controller/network_control/units/timestamp.cc
rename to api/units/timestamp.cc
index 40f421d..7ae084c 100644
--- a/modules/congestion_controller/network_control/units/timestamp.cc
+++ b/api/units/timestamp.cc
@@ -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"
diff --git a/modules/congestion_controller/network_control/units/timestamp.h b/api/units/timestamp.h
similarity index 90%
rename from modules/congestion_controller/network_control/units/timestamp.h
rename to api/units/timestamp.h
index 98dcd7c1..af62b3b 100644
--- a/modules/congestion_controller/network_control/units/timestamp.h
+++ b/api/units/timestamp.h
@@ -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 @@
} // namespace webrtc
-#endif // MODULES_CONGESTION_CONTROLLER_NETWORK_CONTROL_UNITS_TIMESTAMP_H_
+#endif // API_UNITS_TIMESTAMP_H_
diff --git a/modules/congestion_controller/network_control/units/timestamp_unittest.cc b/api/units/timestamp_unittest.cc
similarity index 96%
rename from modules/congestion_controller/network_control/units/timestamp_unittest.cc
rename to api/units/timestamp_unittest.cc
index a6c4535..549a9c8 100644
--- a/modules/congestion_controller/network_control/units/timestamp_unittest.cc
+++ b/api/units/timestamp_unittest.cc
@@ -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 {
diff --git a/modules/congestion_controller/bbr/BUILD.gn b/modules/congestion_controller/bbr/BUILD.gn
index 0299505..3abebaa 100644
--- a/modules/congestion_controller/bbr/BUILD.gn
+++ b/modules/congestion_controller/bbr/BUILD.gn
@@ -45,11 +45,11 @@
"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 @@
"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 @@
":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).
diff --git a/modules/congestion_controller/bbr/data_transfer_tracker.h b/modules/congestion_controller/bbr/data_transfer_tracker.h
index 1de8c8a..25e3997 100644
--- a/modules/congestion_controller/bbr/data_transfer_tracker.h
+++ b/modules/congestion_controller/bbr/data_transfer_tracker.h
@@ -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 {
diff --git a/modules/congestion_controller/bbr/rtt_stats.h b/modules/congestion_controller/bbr/rtt_stats.h
index 7f20949..bb0bda1 100644
--- a/modules/congestion_controller/bbr/rtt_stats.h
+++ b/modules/congestion_controller/bbr/rtt_stats.h
@@ -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"
diff --git a/modules/congestion_controller/bbr/windowed_filter_unittest.cc b/modules/congestion_controller/bbr/windowed_filter_unittest.cc
index e8cd642..3eb5177 100644
--- a/modules/congestion_controller/bbr/windowed_filter_unittest.cc
+++ b/modules/congestion_controller/bbr/windowed_filter_unittest.cc
@@ -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"
diff --git a/modules/congestion_controller/network_control/BUILD.gn b/modules/congestion_controller/network_control/BUILD.gn
index a9c4d34..190d662 100644
--- a/modules/congestion_controller/network_control/BUILD.gn
+++ b/modules/congestion_controller/network_control/BUILD.gn
@@ -18,12 +18,12 @@
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 @@
deps = [
":network_control",
"../../../test:test_support",
- "units:units_unittests",
]
}
}
diff --git a/modules/congestion_controller/network_control/include/network_types.h b/modules/congestion_controller/network_control/include/network_types.h
index 59e9d5f..8a1a16c 100644
--- a/modules/congestion_controller/network_control/include/network_types.h
+++ b/modules/congestion_controller/network_control/include/network_types.h
@@ -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 {
diff --git a/rtc_base/timedelta.h b/rtc_base/timedelta.h
index c8dcf03..70d8877 100644
--- a/rtc_base/timedelta.h
+++ b/rtc_base/timedelta.h
@@ -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) {}