Commit graph

11 commits

Author SHA1 Message Date
Danil Chapovalov
adaf511221 Extend UnitBase multiplication to support size_t
Bug: None
Change-Id: I8dcb85cdb2819df54d4cb0cae59b77d7d629123a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/260941
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36828}
2022-05-10 07:41:30 +00:00
Evan Shrubsole
d425f506ad Switch VideoReceiveStream2 internals to Time units
Change-Id: Ifcee6372120e968499acbdf3bf2c0d002d1c4724
Bug: webrtc:13756
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/259777
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Johannes Kron <kron@google.com>
Cr-Commit-Position: refs/heads/main@{#36685}
2022-04-28 09:38:54 +00:00
Danil Chapovalov
8d94dc23a6 Add TimeDelta and Timestamp factories
These factories suppose to replace set of old constexpr factories that
takes parameter as template rather than function parameter,
as well as fix function naming to follow style guide of the second set
of factory functions.

Bug: None
Change-Id: Icd76302b821b2a4027f9d6765cf91bc9190f551c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/167521
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30482}
2020-02-07 11:30:36 +00:00
Sebastian Jansson
72bba625d5 Adds shared base class for data units.
This reduces code duplication and ensures common behavior
between the unit classes.

Bug: webrtc:9709
Change-Id: I9529ef10b3f538355f53250a2b67c6b4e250cce8
Reviewed-on: https://webrtc-review.googlesource.com/c/110901
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25690}
2018-11-19 12:41:33 +00:00
Sebastian Jansson
0a8bd9cdc9 Adds clamping to TimeDelta.
Bug: webrtc:9709
Change-Id: I6447d8b0ac55b38eaa187b4d44426ec95c377ffb
Reviewed-on: https://webrtc-review.googlesource.com/c/110787
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25681}
2018-11-19 09:34:09 +00:00
Sebastian Jansson
9de4ef4b24 Adds signed infinity to timestamps.
Negative infinity is useful in comparisons as it represents a value
guaranteed to be less than any other timestamp. This avoid using
Timestamp::ms(0) to represent such a value or having to use optional
for the special case of first time execution.

To avoid ambiguity, Timestamp::Infinity is renamed to PlusInfinity.

Bug: webrtc:9709
Change-Id: Ib2debff91036e94d1dc903ec0c6faae30febde4e
Reviewed-on: https://webrtc-review.googlesource.com/79440
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24556}
2018-09-04 17:14:05 +00:00
Sebastian Jansson
88c1a9ecbc Adds infinite addition and subtraction to time units.
This prepares for allowing use making arithmetic operators constexpr.

This also makes it easier to use for comparisons with offsets.
Now a > b + 10 ms works even if b is infinite.

Bug: webrtc:9574
Change-Id: Ie36092b72c2ec0f0c541641199a39155f5a796f3
Reviewed-on: https://webrtc-review.googlesource.com/96820
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24530}
2018-09-03 09:12:10 +00:00
Sebastian Jansson
c1c8b8e836 Adds constexpr create functions for units.
This adds new constexpr create function for DataSize, DataRate,
TimeDelta and Timestamp. The names are capitalized to mirror the
naming scheme of the previously constexpr methods (Zero and
Infinity create functions). They are also kept longer since they
are not expected to be used in complex expressions.

Bug: webrtc:9574
Change-Id: I5950548718675050fc5d66699de295455c310861
Reviewed-on: https://webrtc-review.googlesource.com/91161
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24218}
2018-08-08 07:38:14 +00:00
Sebastian Jansson
8e06419ee9 Makes units constexpr when possible.
This makes the constructor and the unchecked create functions
constexpr on the unit classes Timestamp, TimeDelta, Datarate and
DataSize. This allows using the units in constexpr constants.
Unchecked access methods are made constexpr as well. Making them
usable in static asserts.

Constexpr create functions for checked construction is added in
a separate CL.

Bug: webrtc:9574
Change-Id: I605ae2e8572195dbb2078c283056208be0f43333
Reviewed-on: https://webrtc-review.googlesource.com/91160
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24206}
2018-08-07 11:30:21 +00:00
Sebastian Jansson
942b360d82 Add conversions to and from double for units.
Bug: webrtc:8415
Change-Id: I6b1f7afb163daa327e45c51f1a3fb7cafbb1444e
Reviewed-on: https://webrtc-review.googlesource.com/78183
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23451}
2018-05-30 14:34:02 +00:00
Sebastian Jansson
6fae6ec2ee 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}
2018-05-08 11:46:22 +00:00
Renamed from modules/congestion_controller/network_control/units/time_delta_unittest.cc (Browse further)