Adds bytes per second to DataType class.

This is useful for internal calculations in bitrate control code as we
can skip conversion constants.

DataRate Example(TimeDelta time, DataSize size) {
 double time_seconds = time.seconds<double>();
 double size_bytes = size.bytes<double>();
 double rate_bytes_per_sec = size_bytes/time_seconds;
 return DataRate::bytes_per_sec(std::max(0.0,rate_bytes_per_sec));
}

Bug: webrtc:9709
Change-Id: I8eefed578b6e8eee67fc36af723216407e0d0323
Reviewed-on: https://webrtc-review.googlesource.com/c/120720
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26488}
diff --git a/api/units/data_rate.h b/api/units/data_rate.h
index 8a3836d..9b09aa9 100644
--- a/api/units/data_rate.h
+++ b/api/units/data_rate.h
@@ -56,6 +56,11 @@
     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);
@@ -65,6 +70,10 @@
     return ToValue<T>();
   }
   template <typename T = int64_t>
+  constexpr T bytes_per_sec() const {
+    return ToFraction<8, T>();
+  }
+  template <typename T = int64_t>
   T kbps() const {
     return ToFraction<1000, T>();
   }