Add DataSize and DataRate factories
Bug: webrtc:9709 Change-Id: I8a3af8c62f7ed52de84efb8b1306701fa2e40278 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168606 Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Reviewed-by: Sebastian Jansson <srte@webrtc.org> Cr-Commit-Position: refs/heads/master@{#30533}
This commit is contained in:
committed by
Commit Bot
parent
e209fe6c68
commit
e638ada5c9
@ -24,8 +24,16 @@ namespace webrtc {
|
||||
// DataSize is a class represeting a count of bytes.
|
||||
class DataSize final : public rtc_units_impl::RelativeUnit<DataSize> {
|
||||
public:
|
||||
DataSize() = delete;
|
||||
template <typename T>
|
||||
static constexpr DataSize Bytes(T value) {
|
||||
static_assert(std::is_arithmetic<T>::value, "");
|
||||
return FromValue(value);
|
||||
}
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user