Commit graph

15 commits

Author SHA1 Message Date
Stephan Hartmann
6dcd43f1e4 GCC: make UnitBase::operator*(double) constexpr
cricket::Interpolate Interpolate is constexpr and therefore requires
UnitBase::operator* to be constexpr too. For consistency mark UnitBase::operator/ constexpr as well.

Bug: chromium:819294
Change-Id: I6f1bf812a452de3307b0720a00b85a127631992e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/268186
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37495}
2022-07-08 13:21:51 +00:00
Danil Chapovalov
ef9bcd17a5 Make webrtc units division by integer constexpr
std::round is not constexpr until c++23 and force conversion to floating point which is unnecessary for integer devision

For integer division change rounding to 'round down' from 'round to nearest' as less surprising.

Bug: webrtc:13756
Change-Id: I9c2382bafc9ddccb0f54d6e7bf8cac4f2a3175a1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/265863
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37250}
2022-06-17 10:34:09 +00:00
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
Peter Kasting
662d7f11d5 Fixes to support building in -std=c++20 mode.
* Structs with user-declared constructors are no longer considered
  aggregates, so remove the declarations when possible
* Types of both arguments to "==" must match to avoid "ambiguous
  function call" warning
* Various types of math involving enums are deprecated, so replace with
  constexprs where necessary
* ABSL_CONST_INIT must be used on definition as well as declaration
* volatile memory may no longer be read from and written to by the same
  operator, so replace e.g. "n++" with "n = n + 1"
* Replace an outdated check for no_unique_address support with
  __has_cpp_attribute
* std::result_of(f(x)) has been removed, replace with
  std::invoke_result(f, x)

Bug: chromium:1284275
Change-Id: I77b366ab1da7eb2c1e4c825b2714417c31ee5903
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/261221
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Tomas Gunnarsson <tommi@google.com>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36786}
2022-05-05 17:15:58 +00:00
Evan Shrubsole
21e97f9b9d Add unary operator- to units
This will be used in the frame buffer 3 scheduler.

Bug: webrtc:13343
Change-Id: Ib699072021da30022a34aabe24e36a37e89ddf41
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/245642
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35658}
2022-01-11 14:12:54 +00:00
Mirko Bonadei
cfa0e8ffe2 Fix errors C2238, C2248 and C2059 on MSVC bots.
This CL fixes the following errors on MSVC bots:

../../rtc_base/units/unit_base_unittest.cc(42): error C2059:
  syntax error: '<'

../../rtc_base/units/unit_base_unittest.cc(42): error C2238:
  unexpected token(s) preceding ';'

../..\rtc_base/units/unit_base.h(39): error C2248:
  'webrtc::`anonymous-namespace'::TestUnit::TestUnit':
  cannot access protected member declared in class
  'webrtc::`anonymous-namespace'::TestUnit'

No-Try: True
Bug: None
Change-Id: Ic63a75132107381474aca2e1d42ba96d1f6a1c00
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/172621
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30972}
2020-04-02 09:54:27 +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
Mirko Bonadei
ccbe95fd8a Reformat GN files.
`gn format` recently [1] changed its formatting behavior
for deps, source, and a few other elements when they
are assigned (with =) single-element lists to be consistent
with the formatting of updates (with +=) with single-element.

Now that we've rolled in a GN binary with the change,
reformat all files so that people don't get presubmit
warnings due to this.

CL generated with:
$ git ls-files | grep BUILD.gn | xargs gn format
$ gn format build_overrides/build.gni
$ gn format build_overrides/gtest.gni
$ gn format modules/audio_coding/audio_coding.gni
$ gn format webrtc.gni
$ gn format .gn

Plus a few manual changes to add exceptions for
"public_deps" (after changing these lines the presubmit
started to complain).

[1] - https://gn-review.googlesource.com/c/gn/+/6860

Bug: webrtc:11302
Change-Id: Iac29d23c1618ebef925c972e2891cd9f4e8cd613
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/166882
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30334}
2020-01-21 12:13:11 +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
Mirko Bonadei
86d053c2db Use source_sets in component builds and static_library in release builds.
Static libraries don't guarantee that an exported symbol gets linked
into a shared library (and in order to support Chromium's component
build mode, WebRTC needs to be linked as a shared library).

Source sets always pass all the object files to the linker.

On the flip side, source_sets link more object files in release builds
and to avoid this, this CL introduces a the GN template "rtc_library" that
expands to static_library during release builds and to source_set during
component builds.

See: https://gn.googlesource.com/gn/+/master/docs/reference.md#func_source_set

Bug: webrtc:9419
Change-Id: I4667e820c2b3fcec417becbd2034acc13e4f04fe
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/157168
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#29525}
2019-10-17 21:17:18 +00:00
Jonas Olsson
a4d873786f Format almost everything.
This CL was generated by running

git ls-files | grep -P "(\.h|\.cc)$" | grep -v 'sdk/' | grep -v 'rtc_base/ssl_' | \
grep -v 'fake_rtc_certificate_generator.h' | grep -v 'modules/audio_device/win/' | \
grep -v 'system_wrappers/source/clock.cc' | grep -v 'rtc_base/trace_event.h' | \
grep -v 'modules/audio_coding/codecs/ilbc/' | grep -v 'screen_capturer_mac.h' | \
grep -v 'spl_inl_mips.h' | grep -v 'data_size_unittest.cc' | grep -v 'timestamp_unittest.cc' \
| xargs clang-format -i ; git cl format

Most of these changes are clang-format grouping and reordering includes
differently.

Bug: webrtc:9340
Change-Id: Ic83ddbc169bfacd21883e381b5181c3dd4fe8a63
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/144051
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28505}
2019-07-08 13:45:15 +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
9930929303 Adds srte@ as OWNER of units.
Bug: webrtc:9883
Change-Id: I003a459ba5c37b7fe844a0aff7178c2fd8b2de81
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/139247
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28171}
2019-06-05 15:08:57 +00:00
Bjorn Terelius
18f65dc20a Don't attempt to unwrap RTP timestamps for RTX stream.
This fixes a bug where the event_log_visualizer hits a DCHECK when the RTP timestamp jumps.

TBR = kwiberg

Bug: webrtc:10170
Change-Id: I127a8e6165265d0726892a912f5bcdc33d98ced5
Reviewed-on: https://webrtc-review.googlesource.com/c/119664
Commit-Queue: Björn Terelius <terelius@webrtc.org>
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26410}
2019-01-25 15:59:22 +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