Delete legacy DataSize and DataRate factories
Bug: webrtc:9709
Change-Id: Ia9464893ec9868c51d72eedaee8efc82b0c17b28
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168722
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30564}
diff --git a/api/units/data_rate.h b/api/units/data_rate.h
index f83b9a1..5c8a61f 100644
--- a/api/units/data_rate.h
+++ b/api/units/data_rate.h
@@ -49,31 +49,7 @@
static constexpr DataRate Infinity() { return PlusInfinity(); }
DataRate() = delete;
- // TODO(danilchap): Migrate all code to the 3 factories above and delete the
- // 5 factories below.
- template <int64_t bps>
- static constexpr DataRate BitsPerSec() {
- return FromValue(bps);
- }
- template <int64_t kbps>
- static constexpr DataRate KilobitsPerSec() {
- return FromFraction(1000, kbps);
- }
- template <typename T>
- static constexpr DataRate bps(T bits_per_second) {
- static_assert(std::is_arithmetic<T>::value, "");
- return FromValue(bits_per_second);
- }
- template <typename T>
- static constexpr DataRate bytes_per_sec(T bytes_per_second) {
- static_assert(std::is_arithmetic<T>::value, "");
- return FromFraction(8, bytes_per_second);
- }
- template <typename T>
- static constexpr DataRate kbps(T kilobits_per_sec) {
- static_assert(std::is_arithmetic<T>::value, "");
- return FromFraction(1000, kilobits_per_sec);
- }
+
template <typename T = int64_t>
constexpr T bps() const {
return ToValue<T>();
diff --git a/api/units/data_size.h b/api/units/data_size.h
index 82c4423..27a2a4e 100644
--- a/api/units/data_size.h
+++ b/api/units/data_size.h
@@ -32,18 +32,7 @@
static constexpr DataSize Infinity() { return PlusInfinity(); }
DataSize() = delete;
- // TODO(danilchap): Migrate all code to the factory above and delete the
- // 2 factories below.
- template <int64_t bytes>
- static constexpr DataSize Bytes() {
- return FromValue(bytes);
- }
- template <typename T>
- static constexpr DataSize bytes(T bytes) {
- static_assert(std::is_arithmetic<T>::value, "");
- return FromValue(bytes);
- }
template <typename T = int64_t>
constexpr T bytes() const {
return ToValue<T>();
diff --git a/modules/congestion_controller/pcc/pcc_network_controller.cc b/modules/congestion_controller/pcc/pcc_network_controller.cc
index 9801b09..8653470 100644
--- a/modules/congestion_controller/pcc/pcc_network_controller.cc
+++ b/modules/congestion_controller/pcc/pcc_network_controller.cc
@@ -32,9 +32,8 @@
const TimeDelta kMinDurationOfMonitorInterval = TimeDelta::Millis(50);
const TimeDelta kStartupDuration = TimeDelta::Millis(500);
constexpr double kMinRateChangeBps = 4000;
-constexpr DataRate kMinRateHaveMultiplicativeRateChange =
- DataRate::BitsPerSec<static_cast<int64_t>(kMinRateChangeBps /
- kDefaultSamplingStep)>();
+constexpr DataRate kMinRateHaveMultiplicativeRateChange = DataRate::BitsPerSec(
+ static_cast<int64_t>(kMinRateChangeBps / kDefaultSamplingStep));
// Bitrate controller constants.
constexpr double kInitialConversionFactor = 5;