From 1db70d5c7b8366f7ec3f0f7c1a6bea0137a245e6 Mon Sep 17 00:00:00 2001 From: Danil Chapovalov Date: Thu, 20 Feb 2020 14:54:28 +0000 Subject: [PATCH] Reland "Delete legacy DataSize and DataRate factories" This reverts commit 74c5b0ac239141606b3c09022088d440941bfe3b. Reason for revert: downstream code adjusted Original change's description: > Revert "Delete legacy DataSize and DataRate factories" > > This reverts commit 70490aa3a0b08c9342ea9a12d5ac1fa9666fb7fb. > > Reason for revert: Breaks downstream project. > > Original change's description: > > 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 > > Commit-Queue: Danil Chapovalov > > Cr-Commit-Position: refs/heads/master@{#30564} > > TBR=danilchap@webrtc.org,srte@webrtc.org > > Change-Id: I3f5a8b4ec473bd2af80ca3acfe0e9c82f25a12ba > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:9709 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168940 > Reviewed-by: Mirko Bonadei > Commit-Queue: Mirko Bonadei > Cr-Commit-Position: refs/heads/master@{#30574} TBR=danilchap@webrtc.org,mbonadei@webrtc.org,srte@webrtc.org Change-Id: If05a6b2aa3d4c50caac52f50c13ba56c1e2c810d Bug: webrtc:9709 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168960 Commit-Queue: Danil Chapovalov Reviewed-by: Danil Chapovalov Cr-Commit-Position: refs/heads/master@{#30589} --- api/units/data_rate.h | 26 +------------------ api/units/data_size.h | 11 -------- .../pcc/pcc_network_controller.cc | 5 ++-- 3 files changed, 3 insertions(+), 39 deletions(-) diff --git a/api/units/data_rate.h b/api/units/data_rate.h index f83b9a1da4..5c8a61fd9c 100644 --- a/api/units/data_rate.h +++ b/api/units/data_rate.h @@ -49,31 +49,7 @@ class DataRate final : public rtc_units_impl::RelativeUnit { 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 - static constexpr DataRate BitsPerSec() { - return FromValue(bps); - } - template - static constexpr DataRate KilobitsPerSec() { - return FromFraction(1000, kbps); - } - template - static constexpr DataRate bps(T bits_per_second) { - static_assert(std::is_arithmetic::value, ""); - return FromValue(bits_per_second); - } - template - static constexpr DataRate bytes_per_sec(T bytes_per_second) { - static_assert(std::is_arithmetic::value, ""); - return FromFraction(8, bytes_per_second); - } - template - static constexpr DataRate kbps(T kilobits_per_sec) { - static_assert(std::is_arithmetic::value, ""); - return FromFraction(1000, kilobits_per_sec); - } + template constexpr T bps() const { return ToValue(); diff --git a/api/units/data_size.h b/api/units/data_size.h index 82c4423529..27a2a4e4dc 100644 --- a/api/units/data_size.h +++ b/api/units/data_size.h @@ -32,18 +32,7 @@ class DataSize final : public rtc_units_impl::RelativeUnit { static constexpr DataSize Infinity() { return PlusInfinity(); } DataSize() = delete; - // TODO(danilchap): Migrate all code to the factory above and delete the - // 2 factories below. - template - static constexpr DataSize Bytes() { - return FromValue(bytes); - } - template - static constexpr DataSize bytes(T bytes) { - static_assert(std::is_arithmetic::value, ""); - return FromValue(bytes); - } template constexpr T bytes() const { return ToValue(); diff --git a/modules/congestion_controller/pcc/pcc_network_controller.cc b/modules/congestion_controller/pcc/pcc_network_controller.cc index 9801b098b9..8653470955 100644 --- a/modules/congestion_controller/pcc/pcc_network_controller.cc +++ b/modules/congestion_controller/pcc/pcc_network_controller.cc @@ -32,9 +32,8 @@ constexpr int64_t kMinPacketsNumberPerInterval = 20; const TimeDelta kMinDurationOfMonitorInterval = TimeDelta::Millis(50); const TimeDelta kStartupDuration = TimeDelta::Millis(500); constexpr double kMinRateChangeBps = 4000; -constexpr DataRate kMinRateHaveMultiplicativeRateChange = - DataRate::BitsPerSec(kMinRateChangeBps / - kDefaultSamplingStep)>(); +constexpr DataRate kMinRateHaveMultiplicativeRateChange = DataRate::BitsPerSec( + static_cast(kMinRateChangeBps / kDefaultSamplingStep)); // Bitrate controller constants. constexpr double kInitialConversionFactor = 5;