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}
This commit is contained in:
Peter Kasting
2022-05-04 12:57:00 -07:00
committed by WebRTC LUCI CQ
parent 95897aea2f
commit 662d7f11d5
14 changed files with 48 additions and 52 deletions

View File

@ -26,10 +26,10 @@ namespace media_optimization {
// Number of time periods used for (max) window filter for packet loss
// TODO(marpan): set reasonable window size for filtered packet loss,
// adjustment should be based on logged/real data of loss stats/correlation.
enum { kLossPrHistorySize = 10 };
constexpr int kLossPrHistorySize = 10;
// 1000 ms, total filter length is (kLossPrHistorySize * 1000) ms
enum { kLossPrShortFilterWinMs = 1000 };
constexpr int kLossPrShortFilterWinMs = 1000;
// The type of filter used on the received packet loss reports.
enum FilterPacketLossMode {
@ -41,11 +41,11 @@ enum FilterPacketLossMode {
// Thresholds for hybrid NACK/FEC
// common to media optimization and the jitter buffer.
const int64_t kLowRttNackMs = 20;
constexpr int64_t kLowRttNackMs = 20;
// If the RTT is higher than this an extra RTT wont be added to to the jitter
// buffer delay.
const int kMaxRttDelayThreshold = 500;
constexpr int kMaxRttDelayThreshold = 500;
struct VCMProtectionParameters {
VCMProtectionParameters();
@ -175,15 +175,15 @@ class VCMFecMethod : public VCMProtectionMethod {
int BitsPerFrame(const VCMProtectionParameters* parameters);
protected:
enum { kUpperLimitFramesFec = 6 };
static constexpr int kUpperLimitFramesFec = 6;
// Thresholds values for the bytes/frame and round trip time, below which we
// may turn off FEC, depending on `_numLayers` and `_maxFramesFec`.
// Max bytes/frame for VGA, corresponds to ~140k at 25fps.
enum { kMaxBytesPerFrameForFec = 700 };
static constexpr int kMaxBytesPerFrameForFec = 700;
// Max bytes/frame for CIF and lower: corresponds to ~80k at 25fps.
enum { kMaxBytesPerFrameForFecLow = 400 };
static constexpr int kMaxBytesPerFrameForFecLow = 400;
// Max bytes/frame for frame size larger than VGA, ~200k at 25fps.
enum { kMaxBytesPerFrameForFecHigh = 1000 };
static constexpr int kMaxBytesPerFrameForFecHigh = 1000;
const RateControlSettings rate_control_settings_;
};