Commit graph

24 commits

Author SHA1 Message Date
Dor Hen
de972c1126 Apply include-cleaner to api/units
Bug: webrtc:42226242
Change-Id: Ic646947aee054f597d1fb069c7a6d0bbaadeb1dc
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/359562
Commit-Queue: Dor Hen <dorhen@meta.com>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42796}
2024-08-18 06:55:23 +00:00
Tommi
55c3600781 Remove <ostream> dependencies
Some dependencies still exist but are a bit more complex to remove.
This CL removes either unused or easily replaced with ToString()
instances of ostream usage. In one case, moving the operator<<
implementation to the one test file that requires it.

Bug: webrtc:8982
Change-Id: Ia5c840b12a42893494af401317a3daf2fe50ba9b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/356240
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42582}
2024-07-03 12:27:55 +00:00
Danil Chapovalov
f6e48bf4d1 Add IWYU pragmas for some api headers
Bug: None
Change-Id: I1912e05dbc31d960f36c97151dcb387446535c71
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/280965
Reviewed-by: Florent Castelli <orphis@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38510}
2022-10-31 15:43:16 +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
Andrey Logvin
b95d90b78a Rename UNIT_TEST to WEBRTC_UNIT_TEST
Current name conflicts with upstream project code.

Bug: webrtc:12247
Change-Id: Ibd78273a75262772fc18fca688c29b9ba9525ce5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/196653
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Andrey Logvin <landrey@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32813}
2020-12-10 11:04:58 +00:00
Danil Chapovalov
ea820932d8 Delete legacy TimeDelta and Timestamp factories
Bug: webrtc:9709
Change-Id: Ic294a6dc324fde06d868a3d00941b0f2fc970935
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168490
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30510}
2020-02-13 08:50:22 +00:00
Danil Chapovalov
0c626afcf3 Use newer version of TimeDelta and TimeStamp factories in webrtc
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::Micros<\(.*\)>()/TimeDelta::Micros(\1)/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::Millis<\(.*\)>()/TimeDelta::Millis(\1)/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::Seconds<\(.*\)>()/TimeDelta::Seconds(\1)/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::us/TimeDelta::Micros/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::ms/TimeDelta::Millis/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::seconds/TimeDelta::Seconds/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::Micros<\(.*\)>()/Timestamp::Micros(\1)/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::Millis<\(.*\)>()/Timestamp::Millis(\1)/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::Seconds<\(.*\)>()/Timestamp::Seconds(\1)/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::us/Timestamp::Micros/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::ms/Timestamp::Millis/g"
find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::seconds/Timestamp::Seconds/g"
git cl format

Bug: None
Change-Id: I87469d2e4a38369654da839ab7c838215a7911e7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168402
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30491}
2020-02-10 12:21:17 +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
d7fade5738 Makes all units and operations constexpr
Since RTC_DCHECK was made constexpr compatible, we can now
make the unit classes fully constexpr.

Bug: webrtc:9883
Change-Id: I18973c2f318449869cf0bd45699c41be53fba806
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/167722
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Ali Tofigh <alito@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30403}
2020-01-29 10:57:54 +00:00
Danil Chapovalov
7356a5666d Remove unit_base functions FromStaticX
instead make functions FromX constexpr and use them.

Bug: None
Change-Id: I826c8ad5ac8b3bd97f298a99c40b31b8c63b5f85
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/159220
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30321}
2020-01-20 13:04:56 +00:00
Sebastian Jansson
26b5e35276 Adds Frequency unit type.
Bug: webrtc:10674
Change-Id: Ic0ddca46d8522d994bbeba072a73836b506fe40f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/138261
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28192}
2019-06-07 09:54:02 +00:00
Sebastian Jansson
b113862ccd Allow log print of data units.
Bug: webrtc:9709
Change-Id: I5987a9779e645115dc1893944302a73d540bcf2f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/125680
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27578}
2019-04-12 07:36:49 +00:00
Sebastian Jansson
0c3f4d3709 Friendlier error messages from data unit classes.
By explicitly checking that the template argument is arithmetic, we
avoid exposing internal implementation details in the error message.

Bug: webrtc:9709
Change-Id: Ib1c4b46076af36fe0c4aead968487bb441d03b9a
Reviewed-on: https://webrtc-review.googlesource.com/c/112422
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25853}
2018-11-30 09:40:44 +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
Yves Gerey
988cc0870b [Cleanup] Add missing #include. Remove useless ones.
This CL is the result of running include-what-you-use tool on part
of the code base (audio target and dependencies) plus manual fixes.

bug: webrtc:8311
Change-Id: I277d281ce943c3ecc1bd45fd8d83055931743604
Reviewed-on: https://webrtc-review.googlesource.com/c/106280
Commit-Queue: Yves Gerey <yvesg@google.com>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25311}
2018-10-23 11:32:56 +00:00
Jonas Olsson
941a07cca3 Remove all remaining non-test uses of std::stringstream.
Bug: webrtc:8982
Change-Id: I635a8545c46dc8c89663d64af351e22e65cbcb33
Reviewed-on: https://webrtc-review.googlesource.com/98880
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24715}
2018-09-13 08:52: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
2afd281ec4 Adds debug printing of units in unit tests.
Bug: webrtc:9656
Change-Id: I643b79bc214643f47b2b64967ce713665dbef5c9
Reviewed-on: https://webrtc-review.googlesource.com/95652
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24436}
2018-08-27 08:28:12 +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
5f83cf0c6d Replacing rtc::TimeDelta with webrtc::TimeDelta.
This removes the redundant type and replaces all usages. A slight change
in behavior is that we no longer get nanosecond resolution. This should
not matter since no current code requires nanosecond resolution.

Bug: webrtc:9155
Change-Id: I04334e08c686d95731621a6c8a7e40400d0ae3b2
Reviewed-on: https://webrtc-review.googlesource.com/71163
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23174}
2018-05-08 13:22:53 +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.h (Browse further)