tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 406032792e6196aa87eb2136273936d97455f006
parent fe65c62f1c19f4798600b33b6f603072f33b4948
Author: Michael Froman <mfroman@mozilla.com>
Date:   Thu,  9 Oct 2025 02:34:29 +0000

Bug 1980501 - remove all Mozilla c++20 mitigations from libwebrtc and revendor. r=ng

Differential Revision: https://phabricator.services.mozilla.com/D267992

Diffstat:
Mdom/media/webrtc/libwebrtc_overrides/moz.build | 3---
Ddom/media/webrtc/libwebrtc_overrides/rtc_base/containers/identity.h | 40----------------------------------------
Mthird_party/libwebrtc/api/crypto/crypto_options.cc | 5-----
Mthird_party/libwebrtc/api/video_codecs/h264_profile_level_id.cc | 3+--
Mthird_party/libwebrtc/common_audio/resampler/sinc_resampler.cc | 11+++++++----
Mthird_party/libwebrtc/common_audio/window_generator.cc | 5+++--
Mthird_party/libwebrtc/modules/audio_coding/neteq/dtmf_tone_generator.cc | 20++++++++++----------
Mthird_party/libwebrtc/modules/audio_processing/aec3/comfort_noise_generator.cc | 9+++++++--
Mthird_party/libwebrtc/modules/audio_processing/agc/utility.cc | 4+++-
Mthird_party/libwebrtc/modules/audio_processing/ns/fast_math.cc | 5+++--
Mthird_party/libwebrtc/modules/audio_processing/ns/noise_estimator.cc | 8+++++++-
Mthird_party/libwebrtc/modules/audio_processing/three_band_filter_bank.cc | 13+++++++++----
Mthird_party/libwebrtc/modules/rtp_rtcp/source/rtp_header_extension_map.cc | 3+--
Dthird_party/libwebrtc/moz-patch-stack/s0122.patch | 24------------------------
Dthird_party/libwebrtc/moz-patch-stack/s0124.patch | 26--------------------------
Dthird_party/libwebrtc/moz-patch-stack/s0126.patch | 249-------------------------------------------------------------------------------
Dthird_party/libwebrtc/moz-patch-stack/s0127.patch | 30------------------------------
Dthird_party/libwebrtc/moz-patch-stack/s0128.patch | 30------------------------------
Dthird_party/libwebrtc/moz-patch-stack/s0130.patch | 61-------------------------------------------------------------
Dthird_party/libwebrtc/moz-patch-stack/s0132.patch | 42------------------------------------------
Dthird_party/libwebrtc/moz-patch-stack/s0133.patch | 48------------------------------------------------
Dthird_party/libwebrtc/moz-patch-stack/s0138.patch | 32--------------------------------
Dthird_party/libwebrtc/rtc_base/arraysize.h | 32--------------------------------
Mthird_party/libwebrtc/rtc_base/containers/flat_set.h | 4----
Mthird_party/libwebrtc/rtc_base/numerics/event_based_exponential_moving_average.cc | 3++-
Mthird_party/libwebrtc/rtc_base/random.cc | 3++-
Mthird_party/libwebrtc/rtc_base/win32.cc | 4++--
27 files changed, 57 insertions(+), 660 deletions(-)

diff --git a/dom/media/webrtc/libwebrtc_overrides/moz.build b/dom/media/webrtc/libwebrtc_overrides/moz.build @@ -41,9 +41,6 @@ EXPORTS.libwebrtc_overrides.rtc_base += [ "rtc_base/logging.h", "rtc_base/trace_event.h", ] -EXPORTS.libwebrtc_overrides.rtc_base.containers += [ - "rtc_base/containers/identity.h", -] EXPORTS.libwebrtc_overrides.X11.extensions += [ "X11/extensions/Xrandr.h", ] diff --git a/dom/media/webrtc/libwebrtc_overrides/rtc_base/containers/identity.h b/dom/media/webrtc/libwebrtc_overrides/rtc_base/containers/identity.h @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2021 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// This implementation is borrowed from Chromium. - -#ifndef RTC_BASE_CONTAINERS_IDENTITY_H_ -#define RTC_BASE_CONTAINERS_IDENTITY_H_ - -#include <utility> - -namespace webrtc { - -// Implementation of C++20's std::identity. -// -// Reference: -// - https://en.cppreference.com/w/cpp/utility/functional/identity -// - https://wg21.link/func.identity -struct identity { - template <typename T> - constexpr T&& operator()(T&& t) const noexcept { - return std::forward<T>(t); - } - - using is_transparent = void; -}; - -} // namespace webrtc - -namespace std { -using identity = webrtc::identity; -} // namespace std - -#endif // RTC_BASE_CONTAINERS_IDENTITY_H_ diff --git a/third_party/libwebrtc/api/crypto/crypto_options.cc b/third_party/libwebrtc/api/crypto/crypto_options.cc @@ -106,12 +106,7 @@ CryptoOptions::EphemeralKeyExchangeCipherGroups::GetSupported() { } void CryptoOptions::EphemeralKeyExchangeCipherGroups::AddFirst(uint16_t group) { -#if defined(WEBRTC_MOZILLA_BUILD) - // until we support c++20 - enabled_.erase(std::remove(enabled_.begin(), enabled_.end(), group)); -#else std::erase(enabled_, group); -#endif enabled_.insert(enabled_.begin(), group); } diff --git a/third_party/libwebrtc/api/video_codecs/h264_profile_level_id.cc b/third_party/libwebrtc/api/video_codecs/h264_profile_level_id.cc @@ -18,7 +18,6 @@ #include <string> #include "api/rtp_parameters.h" -#include "rtc_base/arraysize.h" namespace webrtc { @@ -166,7 +165,7 @@ std::optional<H264Level> H264SupportedLevel(int max_frame_pixel_count, float max_fps) { static const int kPixelsPerMacroblock = 16 * 16; - for (int i = arraysize(kLevelConstraints) - 1; i >= 0; --i) { + for (int i = std::ssize(kLevelConstraints) - 1; i >= 0; --i) { const LevelConstraint& level_constraint = kLevelConstraints[i]; if (level_constraint.max_macroblock_frame_size * kPixelsPerMacroblock <= max_frame_pixel_count && diff --git a/third_party/libwebrtc/common_audio/resampler/sinc_resampler.cc b/third_party/libwebrtc/common_audio/resampler/sinc_resampler.cc @@ -88,6 +88,7 @@ #include <cstdint> #include <cstring> #include <limits> +#include <numbers> #include "rtc_base/checks.h" #include "rtc_base/cpu_info.h" @@ -207,14 +208,16 @@ void SincResampler::InitializeKernel() { for (size_t i = 0; i < kKernelSize; ++i) { const size_t idx = i + offset_idx * kKernelSize; const float pre_sinc = static_cast<float>( - M_PI * (static_cast<int>(i) - static_cast<int>(kKernelSize / 2) - - subsample_offset)); + std::numbers::pi * + (static_cast<int>(i) - static_cast<int>(kKernelSize / 2) - + subsample_offset)); kernel_pre_sinc_storage_[idx] = pre_sinc; // Compute Blackman window, matching the offset of the sinc(). const float x = (i - subsample_offset) / kKernelSize; - const float window = static_cast<float>(kA0 - kA1 * cos(2.0 * M_PI * x) + - kA2 * cos(4.0 * M_PI * x)); + const float window = + static_cast<float>(kA0 - kA1 * cos(2.0 * std::numbers::pi * x) + + kA2 * cos(4.0 * std::numbers::pi * x)); kernel_window_storage_[idx] = window; // Compute the sinc with offset, then window the sinc() function and store diff --git a/third_party/libwebrtc/common_audio/window_generator.cc b/third_party/libwebrtc/common_audio/window_generator.cc @@ -13,6 +13,7 @@ #include <cmath> #include <complex> #include <cstddef> +#include <numbers> #include "rtc_base/checks.h" @@ -40,7 +41,7 @@ void WindowGenerator::Hanning(int length, float* window) { RTC_CHECK(window != nullptr); for (int i = 0; i < length; ++i) { window[i] = - 0.5f * (1 - cosf(2 * static_cast<float>(M_PI) * i / (length - 1))); + 0.5f * (1 - cosf(2 * std::numbers::pi_v<float> * i / (length - 1))); } } @@ -55,7 +56,7 @@ void WindowGenerator::KaiserBesselDerived(float alpha, for (size_t i = 0; i <= half; ++i) { complex<float> r = (4.0f * i) / length - 1.0f; - sum += I0(static_cast<float>(M_PI) * alpha * sqrt(1.0f - r * r)).real(); + sum += I0(std::numbers::pi_v<float> * alpha * sqrt(1.0f - r * r)).real(); window[i] = sum; } for (size_t i = length - 1; i >= half; --i) { diff --git a/third_party/libwebrtc/modules/audio_coding/neteq/dtmf_tone_generator.cc b/third_party/libwebrtc/modules/audio_coding/neteq/dtmf_tone_generator.cc @@ -32,10 +32,10 @@ #include <cstddef> #include <cstdint> +#include <iterator> #include "modules/audio_coding/neteq/audio_multi_vector.h" #include "modules/audio_coding/neteq/audio_vector.h" -#include "rtc_base/arraysize.h" #include "rtc_base/checks.h" namespace webrtc { @@ -137,26 +137,26 @@ int DtmfToneGenerator::Init(int fs, int event, int attenuation) { // Look up oscillator coefficient for low and high frequencies. RTC_DCHECK_LE(0, fs_index); - RTC_DCHECK_GT(arraysize(kCoeff1), fs_index); - RTC_DCHECK_GT(arraysize(kCoeff2), fs_index); + RTC_DCHECK_GT(std::size(kCoeff1), fs_index); + RTC_DCHECK_GT(std::size(kCoeff2), fs_index); RTC_DCHECK_LE(0, event); - RTC_DCHECK_GT(arraysize(kCoeff1[fs_index]), event); - RTC_DCHECK_GT(arraysize(kCoeff2[fs_index]), event); + RTC_DCHECK_GT(std::ssize(kCoeff1[fs_index]), event); + RTC_DCHECK_GT(std::ssize(kCoeff2[fs_index]), event); coeff1_ = kCoeff1[fs_index][event]; coeff2_ = kCoeff2[fs_index][event]; // Look up amplitude multiplier. RTC_DCHECK_LE(0, attenuation); - RTC_DCHECK_GT(arraysize(kAmplitude), attenuation); + RTC_DCHECK_GT(std::ssize(kAmplitude), attenuation); amplitude_ = kAmplitude[attenuation]; // Initialize sample history. RTC_DCHECK_LE(0, fs_index); - RTC_DCHECK_GT(arraysize(kInitValue1), fs_index); - RTC_DCHECK_GT(arraysize(kInitValue2), fs_index); + RTC_DCHECK_GT(std::size(kInitValue1), fs_index); + RTC_DCHECK_GT(std::size(kInitValue2), fs_index); RTC_DCHECK_LE(0, event); - RTC_DCHECK_GT(arraysize(kInitValue1[fs_index]), event); - RTC_DCHECK_GT(arraysize(kInitValue2[fs_index]), event); + RTC_DCHECK_GT(std::ssize(kInitValue1[fs_index]), event); + RTC_DCHECK_GT(std::ssize(kInitValue2[fs_index]), event); sample_history1_[0] = kInitValue1[fs_index][event]; sample_history1_[1] = 0; sample_history2_[0] = kInitValue2[fs_index][event]; diff --git a/third_party/libwebrtc/modules/audio_processing/aec3/comfort_noise_generator.cc b/third_party/libwebrtc/modules/audio_processing/aec3/comfort_noise_generator.cc @@ -16,6 +16,7 @@ #include <cstddef> #include <cstdint> #include <memory> +#include <numbers> #include <numeric> #include <vector> @@ -35,6 +36,8 @@ namespace webrtc { namespace { +using std::numbers::sqrt2_v; + // Computes the noise floor value that matches a WGN input of noise_floor_dbfs. float GetNoiseFloorFactor(float noise_floor_dbfs) { // kdBfsNormalization = 20.f*log10(32768.f). @@ -43,14 +46,16 @@ float GetNoiseFloorFactor(float noise_floor_dbfs) { } // Table of sqrt(2) * sin(2*pi*i/32). +// clang-format off constexpr float kSqrt2Sin[32] = { +0.0000000f, +0.2758994f, +0.5411961f, +0.7856950f, +1.0000000f, - +1.1758756f, +1.3065630f, +1.3870398f, +1.4142136f, +1.3870398f, + +1.1758756f, +1.3065630f, +1.3870398f, +sqrt2_v<float>, +1.3870398f, +1.3065630f, +1.1758756f, +1.0000000f, +0.7856950f, +0.5411961f, +0.2758994f, +0.0000000f, -0.2758994f, -0.5411961f, -0.7856950f, - -1.0000000f, -1.1758756f, -1.3065630f, -1.3870398f, -1.4142136f, + -1.0000000f, -1.1758756f, -1.3065630f, -1.3870398f, -sqrt2_v<float>, -1.3870398f, -1.3065630f, -1.1758756f, -1.0000000f, -0.7856950f, -0.5411961f, -0.2758994f}; +// clang-format on void GenerateComfortNoise(Aec3Optimization optimization, const std::array<float, kFftLengthBy2Plus1>& N2, diff --git a/third_party/libwebrtc/modules/audio_processing/agc/utility.cc b/third_party/libwebrtc/modules/audio_processing/agc/utility.cc @@ -12,9 +12,11 @@ #include <math.h> +#include <numbers> + namespace webrtc { -static const double kLog10 = 2.30258509299; +static const double kLog10 = std::numbers::ln10; static const double kLinear2DbScale = 20.0 / kLog10; static const double kLinear2LoudnessScale = 13.4 / kLog10; diff --git a/third_party/libwebrtc/modules/audio_processing/ns/fast_math.cc b/third_party/libwebrtc/modules/audio_processing/ns/fast_math.cc @@ -13,6 +13,7 @@ #include <cmath> #include <cstddef> #include <cstdint> +#include <numbers> #include "api/array_view.h" #include "rtc_base/checks.h" @@ -55,7 +56,7 @@ float PowApproximation(float x, float p) { } float LogApproximation(float x) { - constexpr float kLogOf2 = 0.69314718056f; + constexpr float kLogOf2 = std::numbers::ln2_v<float>; return FastLog2f(x) * kLogOf2; } @@ -66,7 +67,7 @@ void LogApproximation(ArrayView<const float> x, ArrayView<float> y) { } float ExpApproximation(float x) { - constexpr float kLog10Ofe = 0.4342944819f; + constexpr float kLog10Ofe = std::numbers::log10e_v<float>; return PowApproximation(10.f, x * kLog10Ofe); } diff --git a/third_party/libwebrtc/modules/audio_processing/ns/noise_estimator.cc b/third_party/libwebrtc/modules/audio_processing/ns/noise_estimator.cc @@ -14,6 +14,7 @@ #include <array> #include <cstddef> #include <cstdint> +#include <numbers> #include "api/array_view.h" #include "modules/audio_processing/ns/fast_math.h" @@ -25,10 +26,14 @@ namespace webrtc { namespace { +using std::numbers::ln10_v; + // Log(i). +// clang-format off constexpr std::array<float, 129> log_table = { 0.f, 0.f, 0.f, 0.f, 0.f, 1.609438f, 1.791759f, - 1.945910f, 2.079442f, 2.197225f, 2.302585f, 2.397895f, 2.484907f, 2.564949f, + 1.945910f, 2.079442f, 2.197225f, ln10_v<float>, 2.397895f, 2.484907f, + 2.564949f, 2.639057f, 2.708050f, 2.772589f, 2.833213f, 2.890372f, 2.944439f, 2.995732f, 3.044522f, 3.091043f, 3.135494f, 3.178054f, 3.218876f, 3.258097f, 3.295837f, 3.332205f, 3.367296f, 3.401197f, 3.433987f, 3.465736f, 3.496507f, 3.526361f, @@ -46,6 +51,7 @@ constexpr std::array<float, 129> log_table = { 4.718499f, 4.727388f, 4.736198f, 4.744932f, 4.753591f, 4.762174f, 4.770685f, 4.779124f, 4.787492f, 4.795791f, 4.804021f, 4.812184f, 4.820282f, 4.828314f, 4.836282f, 4.844187f, 4.852030f}; +// clang-format on } // namespace diff --git a/third_party/libwebrtc/modules/audio_processing/three_band_filter_bank.cc b/third_party/libwebrtc/modules/audio_processing/three_band_filter_bank.cc @@ -34,6 +34,7 @@ #include <algorithm> #include <array> +#include <numbers> #include "api/array_view.h" #include "rtc_base/checks.h" @@ -90,17 +91,21 @@ const float constexpr int kZeroFilterIndex1 = 3; constexpr int kZeroFilterIndex2 = 9; +constexpr float kSqrt3 = std::numbers::sqrt3_v<float>; + +// clang-format off const float kDctModulation[ThreeBandFilterBank::kNumNonZeroFilters][kDctSize] = {{2.f, 2.f, 2.f}, - {1.73205077f, 0.f, -1.73205077f}, + {kSqrt3, 0.f, -kSqrt3}, {1.f, -2.f, 1.f}, {-1.f, 2.f, -1.f}, - {-1.73205077f, 0.f, 1.73205077f}, + {-kSqrt3, 0.f, kSqrt3}, {-2.f, -2.f, -2.f}, - {-1.73205077f, 0.f, 1.73205077f}, + {-kSqrt3, 0.f, kSqrt3}, {-1.f, 2.f, -1.f}, {1.f, -2.f, 1.f}, - {1.73205077f, 0.f, -1.73205077f}}; + {kSqrt3, 0.f, -kSqrt3}}; +// clang-format on // Filters the input signal `in` with the filter `filter` using a shift by // `in_shift`, taking into account the previous state. diff --git a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_header_extension_map.cc b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_header_extension_map.cc @@ -21,7 +21,6 @@ #include "modules/rtp_rtcp/source/rtp_generic_frame_descriptor_extension.h" #include "modules/rtp_rtcp/source/rtp_header_extensions.h" #include "modules/rtp_rtcp/source/rtp_video_layers_allocation_extension.h" -#include "rtc_base/arraysize.h" #include "rtc_base/checks.h" #include "rtc_base/logging.h" @@ -64,7 +63,7 @@ constexpr ExtensionInfo kExtensions[] = { // Because of kRtpExtensionNone, NumberOfExtension is 1 bigger than the actual // number of known extensions. -static_assert(arraysize(kExtensions) == +static_assert(std::ssize(kExtensions) == static_cast<int>(kRtpExtensionNumberOfExtensions) - 1, "kExtensions expect to list all known extensions"); diff --git a/third_party/libwebrtc/moz-patch-stack/s0122.patch b/third_party/libwebrtc/moz-patch-stack/s0122.patch @@ -1,24 +0,0 @@ -From: Michael Froman <mfroman@mozilla.com> -Date: Wed, 6 Aug 2025 15:31:00 -0500 -Subject: Bug 1980479 - (fix-e83cf6587a) fixes for c++20 support - -Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/a54236b6124ec4850290e0b12bf071e3b6325530 ---- - rtc_base/containers/flat_set.h | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/rtc_base/containers/flat_set.h b/rtc_base/containers/flat_set.h -index 22001d3d5c..6c999db3d8 100644 ---- a/rtc_base/containers/flat_set.h -+++ b/rtc_base/containers/flat_set.h -@@ -18,6 +18,10 @@ - - #include "rtc_base/containers/flat_tree.h" // IWYU pragma: export - -+#if __cplusplus < 202002 -+# include "rtc_base/containers/identity.h" // Mozilla: remove when fixing Bug 1980501 -+#endif -+ - namespace webrtc { - - // flat_set is a container with a std::set-like interface that stores its diff --git a/third_party/libwebrtc/moz-patch-stack/s0124.patch b/third_party/libwebrtc/moz-patch-stack/s0124.patch @@ -1,26 +0,0 @@ -From: Michael Froman <mfroman@mozilla.com> -Date: Thu, 7 Aug 2025 11:55:00 -0500 -Subject: Bug 1980479 - (fix-1e750debf5) fixes for c++20 support - -Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/43c2cad5c4e576f3b23f71513b23a3adcb248506 ---- - api/crypto/crypto_options.cc | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/api/crypto/crypto_options.cc b/api/crypto/crypto_options.cc -index e939f390e5..0f1e3683ef 100644 ---- a/api/crypto/crypto_options.cc -+++ b/api/crypto/crypto_options.cc -@@ -106,7 +106,12 @@ CryptoOptions::EphemeralKeyExchangeCipherGroups::GetSupported() { - } - - void CryptoOptions::EphemeralKeyExchangeCipherGroups::AddFirst(uint16_t group) { -+#if defined(WEBRTC_MOZILLA_BUILD) -+ // until we support c++20 -+ enabled_.erase(std::remove(enabled_.begin(), enabled_.end(), group)); -+#else - std::erase(enabled_, group); -+#endif - enabled_.insert(enabled_.begin(), group); - } - diff --git a/third_party/libwebrtc/moz-patch-stack/s0126.patch b/third_party/libwebrtc/moz-patch-stack/s0126.patch @@ -1,249 +0,0 @@ -From: Michael Froman <mfroman@mozilla.com> -Date: Fri, 8 Aug 2025 15:49:00 -0500 -Subject: Bug 1980479 - (fix-cc46fb91c5) fixes for c++20 support - -Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/313582b2ffb3f3f9aaffd399e07f55c2589a587d ---- - common_audio/window_generator.cc | 5 ++--- - .../aec3/comfort_noise_generator.cc | 9 ++------- - modules/audio_processing/agc/utility.cc | 4 +--- - modules/audio_processing/ns/fast_math.cc | 5 ++--- - modules/audio_processing/ns/noise_estimator.cc | 8 +------- - modules/audio_processing/three_band_filter_bank.cc | 13 ++++--------- - .../event_based_exponential_moving_average.cc | 3 +-- - rtc_base/random.cc | 3 +-- - 8 files changed, 14 insertions(+), 36 deletions(-) - -diff --git a/common_audio/window_generator.cc b/common_audio/window_generator.cc -index 5a6de1aec1..d364eed826 100644 ---- a/common_audio/window_generator.cc -+++ b/common_audio/window_generator.cc -@@ -13,7 +13,6 @@ - #include <cmath> - #include <complex> - #include <cstddef> --#include <numbers> - - #include "rtc_base/checks.h" - -@@ -41,7 +40,7 @@ void WindowGenerator::Hanning(int length, float* window) { - RTC_CHECK(window != nullptr); - for (int i = 0; i < length; ++i) { - window[i] = -- 0.5f * (1 - cosf(2 * std::numbers::pi_v<float> * i / (length - 1))); -+ 0.5f * (1 - cosf(2 * static_cast<float>(M_PI) * i / (length - 1))); - } - } - -@@ -56,7 +55,7 @@ void WindowGenerator::KaiserBesselDerived(float alpha, - - for (size_t i = 0; i <= half; ++i) { - complex<float> r = (4.0f * i) / length - 1.0f; -- sum += I0(std::numbers::pi_v<float> * alpha * sqrt(1.0f - r * r)).real(); -+ sum += I0(static_cast<float>(M_PI) * alpha * sqrt(1.0f - r * r)).real(); - window[i] = sum; - } - for (size_t i = length - 1; i >= half; --i) { -diff --git a/modules/audio_processing/aec3/comfort_noise_generator.cc b/modules/audio_processing/aec3/comfort_noise_generator.cc -index ce500a57d5..21d6ef9b5c 100644 ---- a/modules/audio_processing/aec3/comfort_noise_generator.cc -+++ b/modules/audio_processing/aec3/comfort_noise_generator.cc -@@ -16,7 +16,6 @@ - #include <cstddef> - #include <cstdint> - #include <memory> --#include <numbers> - #include <numeric> - #include <vector> - -@@ -36,8 +35,6 @@ namespace webrtc { - - namespace { - --using std::numbers::sqrt2_v; -- - // Computes the noise floor value that matches a WGN input of noise_floor_dbfs. - float GetNoiseFloorFactor(float noise_floor_dbfs) { - // kdBfsNormalization = 20.f*log10(32768.f). -@@ -46,16 +43,14 @@ float GetNoiseFloorFactor(float noise_floor_dbfs) { - } - - // Table of sqrt(2) * sin(2*pi*i/32). --// clang-format off - constexpr float kSqrt2Sin[32] = { - +0.0000000f, +0.2758994f, +0.5411961f, +0.7856950f, +1.0000000f, -- +1.1758756f, +1.3065630f, +1.3870398f, +sqrt2_v<float>, +1.3870398f, -+ +1.1758756f, +1.3065630f, +1.3870398f, +1.4142136f, +1.3870398f, - +1.3065630f, +1.1758756f, +1.0000000f, +0.7856950f, +0.5411961f, - +0.2758994f, +0.0000000f, -0.2758994f, -0.5411961f, -0.7856950f, -- -1.0000000f, -1.1758756f, -1.3065630f, -1.3870398f, -sqrt2_v<float>, -+ -1.0000000f, -1.1758756f, -1.3065630f, -1.3870398f, -1.4142136f, - -1.3870398f, -1.3065630f, -1.1758756f, -1.0000000f, -0.7856950f, - -0.5411961f, -0.2758994f}; --// clang-format on - - void GenerateComfortNoise(Aec3Optimization optimization, - const std::array<float, kFftLengthBy2Plus1>& N2, -diff --git a/modules/audio_processing/agc/utility.cc b/modules/audio_processing/agc/utility.cc -index b8fa3605ea..2a87e5ce74 100644 ---- a/modules/audio_processing/agc/utility.cc -+++ b/modules/audio_processing/agc/utility.cc -@@ -12,11 +12,9 @@ - - #include <math.h> - --#include <numbers> -- - namespace webrtc { - --static const double kLog10 = std::numbers::ln10; -+static const double kLog10 = 2.30258509299; - static const double kLinear2DbScale = 20.0 / kLog10; - static const double kLinear2LoudnessScale = 13.4 / kLog10; - -diff --git a/modules/audio_processing/ns/fast_math.cc b/modules/audio_processing/ns/fast_math.cc -index 7d52252201..d7c7a7b4fa 100644 ---- a/modules/audio_processing/ns/fast_math.cc -+++ b/modules/audio_processing/ns/fast_math.cc -@@ -13,7 +13,6 @@ - #include <cmath> - #include <cstddef> - #include <cstdint> --#include <numbers> - - #include "api/array_view.h" - #include "rtc_base/checks.h" -@@ -56,7 +55,7 @@ float PowApproximation(float x, float p) { - } - - float LogApproximation(float x) { -- constexpr float kLogOf2 = std::numbers::ln2_v<float>; -+ constexpr float kLogOf2 = 0.69314718056f; - return FastLog2f(x) * kLogOf2; - } - -@@ -67,7 +66,7 @@ void LogApproximation(ArrayView<const float> x, ArrayView<float> y) { - } - - float ExpApproximation(float x) { -- constexpr float kLog10Ofe = std::numbers::log10e_v<float>; -+ constexpr float kLog10Ofe = 0.4342944819f; - return PowApproximation(10.f, x * kLog10Ofe); - } - -diff --git a/modules/audio_processing/ns/noise_estimator.cc b/modules/audio_processing/ns/noise_estimator.cc -index 00b647ca35..bf21d38d0b 100644 ---- a/modules/audio_processing/ns/noise_estimator.cc -+++ b/modules/audio_processing/ns/noise_estimator.cc -@@ -14,7 +14,6 @@ - #include <array> - #include <cstddef> - #include <cstdint> --#include <numbers> - - #include "api/array_view.h" - #include "modules/audio_processing/ns/fast_math.h" -@@ -26,14 +25,10 @@ namespace webrtc { - - namespace { - --using std::numbers::ln10_v; -- - // Log(i). --// clang-format off - constexpr std::array<float, 129> log_table = { - 0.f, 0.f, 0.f, 0.f, 0.f, 1.609438f, 1.791759f, -- 1.945910f, 2.079442f, 2.197225f, ln10_v<float>, 2.397895f, 2.484907f, -- 2.564949f, -+ 1.945910f, 2.079442f, 2.197225f, 2.302585f, 2.397895f, 2.484907f, 2.564949f, - 2.639057f, 2.708050f, 2.772589f, 2.833213f, 2.890372f, 2.944439f, 2.995732f, - 3.044522f, 3.091043f, 3.135494f, 3.178054f, 3.218876f, 3.258097f, 3.295837f, - 3.332205f, 3.367296f, 3.401197f, 3.433987f, 3.465736f, 3.496507f, 3.526361f, -@@ -51,7 +46,6 @@ constexpr std::array<float, 129> log_table = { - 4.718499f, 4.727388f, 4.736198f, 4.744932f, 4.753591f, 4.762174f, 4.770685f, - 4.779124f, 4.787492f, 4.795791f, 4.804021f, 4.812184f, 4.820282f, 4.828314f, - 4.836282f, 4.844187f, 4.852030f}; --// clang-format on - - } // namespace - -diff --git a/modules/audio_processing/three_band_filter_bank.cc b/modules/audio_processing/three_band_filter_bank.cc -index a04852a4c7..291026ca44 100644 ---- a/modules/audio_processing/three_band_filter_bank.cc -+++ b/modules/audio_processing/three_band_filter_bank.cc -@@ -34,7 +34,6 @@ - - #include <algorithm> - #include <array> --#include <numbers> - - #include "api/array_view.h" - #include "rtc_base/checks.h" -@@ -91,21 +90,17 @@ const float - constexpr int kZeroFilterIndex1 = 3; - constexpr int kZeroFilterIndex2 = 9; - --constexpr float kSqrt3 = std::numbers::sqrt3_v<float>; -- --// clang-format off - const float kDctModulation[ThreeBandFilterBank::kNumNonZeroFilters][kDctSize] = - {{2.f, 2.f, 2.f}, -- {kSqrt3, 0.f, -kSqrt3}, -+ {1.73205077f, 0.f, -1.73205077f}, - {1.f, -2.f, 1.f}, - {-1.f, 2.f, -1.f}, -- {-kSqrt3, 0.f, kSqrt3}, -+ {-1.73205077f, 0.f, 1.73205077f}, - {-2.f, -2.f, -2.f}, -- {-kSqrt3, 0.f, kSqrt3}, -+ {-1.73205077f, 0.f, 1.73205077f}, - {-1.f, 2.f, -1.f}, - {1.f, -2.f, 1.f}, -- {kSqrt3, 0.f, -kSqrt3}}; --// clang-format on -+ {1.73205077f, 0.f, -1.73205077f}}; - - // Filters the input signal `in` with the filter `filter` using a shift by - // `in_shift`, taking into account the previous state. -diff --git a/rtc_base/numerics/event_based_exponential_moving_average.cc b/rtc_base/numerics/event_based_exponential_moving_average.cc -index 419902dc52..27b2066a97 100644 ---- a/rtc_base/numerics/event_based_exponential_moving_average.cc -+++ b/rtc_base/numerics/event_based_exponential_moving_average.cc -@@ -13,7 +13,6 @@ - #include <cmath> - #include <cstdint> - #include <limits> --#include <numbers> - - #include "rtc_base/checks.h" - -@@ -36,7 +35,7 @@ EventBasedExponentialMovingAverage::EventBasedExponentialMovingAverage( - } - - void EventBasedExponentialMovingAverage::SetHalfTime(int half_time) { -- tau_ = static_cast<double>(half_time) / std::numbers::ln2; -+ tau_ = static_cast<double>(half_time) / log(2); - Reset(); - } - -diff --git a/rtc_base/random.cc b/rtc_base/random.cc -index 319ad72177..3e0cc45262 100644 ---- a/rtc_base/random.cc -+++ b/rtc_base/random.cc -@@ -12,7 +12,6 @@ - #include <math.h> - - #include <cstdint> --#include <numbers> - - #include "rtc_base/checks.h" - #include "rtc_base/numerics/safe_conversions.h" -@@ -74,7 +73,7 @@ double Random::Gaussian(double mean, double standard_deviation) { - // interval (0, 1]. Note that we rely on NextOutput to generate integers - // in the range [1, 2^64-1]. Normally this behavior is a bit frustrating, - // but here it is exactly what we need. -- const double kPi = std::numbers::pi; -+ const double kPi = 3.14159265358979323846; - double u1 = static_cast<double>(NextOutput()) / - static_cast<double>(0xFFFFFFFFFFFFFFFFull); - double u2 = static_cast<double>(NextOutput()) / diff --git a/third_party/libwebrtc/moz-patch-stack/s0127.patch b/third_party/libwebrtc/moz-patch-stack/s0127.patch @@ -1,30 +0,0 @@ -From: Michael Froman <mfroman@mozilla.com> -Date: Fri, 8 Aug 2025 15:58:00 -0500 -Subject: Bug 1980479 - (fix-bf70c05a1a) fixes for c++20 support - -Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/0f356d8dc1cc06aea9b5d963a12dc3d18deb5899 ---- - api/video_codecs/h264_profile_level_id.cc | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/api/video_codecs/h264_profile_level_id.cc b/api/video_codecs/h264_profile_level_id.cc -index e410fc22f2..9a11238772 100644 ---- a/api/video_codecs/h264_profile_level_id.cc -+++ b/api/video_codecs/h264_profile_level_id.cc -@@ -18,6 +18,7 @@ - #include <string> - - #include "api/rtp_parameters.h" -+#include "rtc_base/arraysize.h" - - namespace webrtc { - -@@ -165,7 +166,7 @@ std::optional<H264Level> H264SupportedLevel(int max_frame_pixel_count, - float max_fps) { - static const int kPixelsPerMacroblock = 16 * 16; - -- for (int i = std::ssize(kLevelConstraints) - 1; i >= 0; --i) { -+ for (int i = arraysize(kLevelConstraints) - 1; i >= 0; --i) { - const LevelConstraint& level_constraint = kLevelConstraints[i]; - if (level_constraint.max_macroblock_frame_size * kPixelsPerMacroblock <= - max_frame_pixel_count && diff --git a/third_party/libwebrtc/moz-patch-stack/s0128.patch b/third_party/libwebrtc/moz-patch-stack/s0128.patch @@ -1,30 +0,0 @@ -From: Michael Froman <mfroman@mozilla.com> -Date: Fri, 5 Sep 2025 13:08:00 -0500 -Subject: Bug 1985396 - (fix-f466fa7c84) fixes for c++20 support - -Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/5d527edcb188c8e4f9ea057efeaee8a346873893 ---- - modules/rtp_rtcp/source/rtp_header_extension_map.cc | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/modules/rtp_rtcp/source/rtp_header_extension_map.cc b/modules/rtp_rtcp/source/rtp_header_extension_map.cc -index 2ceb5a178b..ef28dbae20 100644 ---- a/modules/rtp_rtcp/source/rtp_header_extension_map.cc -+++ b/modules/rtp_rtcp/source/rtp_header_extension_map.cc -@@ -21,6 +21,7 @@ - #include "modules/rtp_rtcp/source/rtp_generic_frame_descriptor_extension.h" - #include "modules/rtp_rtcp/source/rtp_header_extensions.h" - #include "modules/rtp_rtcp/source/rtp_video_layers_allocation_extension.h" -+#include "rtc_base/arraysize.h" - #include "rtc_base/checks.h" - #include "rtc_base/logging.h" - -@@ -63,7 +64,7 @@ constexpr ExtensionInfo kExtensions[] = { - - // Because of kRtpExtensionNone, NumberOfExtension is 1 bigger than the actual - // number of known extensions. --static_assert(std::ssize(kExtensions) == -+static_assert(arraysize(kExtensions) == - static_cast<int>(kRtpExtensionNumberOfExtensions) - 1, - "kExtensions expect to list all known extensions"); - diff --git a/third_party/libwebrtc/moz-patch-stack/s0130.patch b/third_party/libwebrtc/moz-patch-stack/s0130.patch @@ -1,61 +0,0 @@ -From: Michael Froman <mfroman@mozilla.com> -Date: Mon, 15 Sep 2025 11:52:00 -0500 -Subject: Bug 1985396 - (fix-3dfa6f80d7) fixes for c++20 support - -Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/54b537ed2697ed8703366ac9a68a21be383f083e ---- - .../audio_coding/neteq/dtmf_tone_generator.cc | 20 +++++++++---------- - 1 file changed, 10 insertions(+), 10 deletions(-) - -diff --git a/modules/audio_coding/neteq/dtmf_tone_generator.cc b/modules/audio_coding/neteq/dtmf_tone_generator.cc -index b22385df2a..01f6ead3d9 100644 ---- a/modules/audio_coding/neteq/dtmf_tone_generator.cc -+++ b/modules/audio_coding/neteq/dtmf_tone_generator.cc -@@ -32,10 +32,10 @@ - - #include <cstddef> - #include <cstdint> --#include <iterator> - - #include "modules/audio_coding/neteq/audio_multi_vector.h" - #include "modules/audio_coding/neteq/audio_vector.h" -+#include "rtc_base/arraysize.h" - #include "rtc_base/checks.h" - - namespace webrtc { -@@ -137,26 +137,26 @@ int DtmfToneGenerator::Init(int fs, int event, int attenuation) { - - // Look up oscillator coefficient for low and high frequencies. - RTC_DCHECK_LE(0, fs_index); -- RTC_DCHECK_GT(std::size(kCoeff1), fs_index); -- RTC_DCHECK_GT(std::size(kCoeff2), fs_index); -+ RTC_DCHECK_GT(arraysize(kCoeff1), fs_index); -+ RTC_DCHECK_GT(arraysize(kCoeff2), fs_index); - RTC_DCHECK_LE(0, event); -- RTC_DCHECK_GT(std::ssize(kCoeff1[fs_index]), event); -- RTC_DCHECK_GT(std::ssize(kCoeff2[fs_index]), event); -+ RTC_DCHECK_GT(arraysize(kCoeff1[fs_index]), event); -+ RTC_DCHECK_GT(arraysize(kCoeff2[fs_index]), event); - coeff1_ = kCoeff1[fs_index][event]; - coeff2_ = kCoeff2[fs_index][event]; - - // Look up amplitude multiplier. - RTC_DCHECK_LE(0, attenuation); -- RTC_DCHECK_GT(std::ssize(kAmplitude), attenuation); -+ RTC_DCHECK_GT(arraysize(kAmplitude), attenuation); - amplitude_ = kAmplitude[attenuation]; - - // Initialize sample history. - RTC_DCHECK_LE(0, fs_index); -- RTC_DCHECK_GT(std::size(kInitValue1), fs_index); -- RTC_DCHECK_GT(std::size(kInitValue2), fs_index); -+ RTC_DCHECK_GT(arraysize(kInitValue1), fs_index); -+ RTC_DCHECK_GT(arraysize(kInitValue2), fs_index); - RTC_DCHECK_LE(0, event); -- RTC_DCHECK_GT(std::ssize(kInitValue1[fs_index]), event); -- RTC_DCHECK_GT(std::ssize(kInitValue2[fs_index]), event); -+ RTC_DCHECK_GT(arraysize(kInitValue1[fs_index]), event); -+ RTC_DCHECK_GT(arraysize(kInitValue2[fs_index]), event); - sample_history1_[0] = kInitValue1[fs_index][event]; - sample_history1_[1] = 0; - sample_history2_[0] = kInitValue2[fs_index][event]; diff --git a/third_party/libwebrtc/moz-patch-stack/s0132.patch b/third_party/libwebrtc/moz-patch-stack/s0132.patch @@ -1,42 +0,0 @@ -From: Michael Froman <mfroman@mozilla.com> -Date: Tue, 16 Sep 2025 13:25:00 -0500 -Subject: Bug 1985396 - (fix-de2bbb38ff) fixes for c++20 support - -Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/c9abd1df5df5d229e2ef8878ee7593363cdb385b ---- - common_audio/resampler/sinc_resampler.cc | 11 ++++------- - 1 file changed, 4 insertions(+), 7 deletions(-) - -diff --git a/common_audio/resampler/sinc_resampler.cc b/common_audio/resampler/sinc_resampler.cc -index fc64ba6f1d..22d984a0c6 100644 ---- a/common_audio/resampler/sinc_resampler.cc -+++ b/common_audio/resampler/sinc_resampler.cc -@@ -88,7 +88,6 @@ - #include <cstdint> - #include <cstring> - #include <limits> --#include <numbers> - - #include "rtc_base/checks.h" - #include "rtc_base/cpu_info.h" -@@ -208,16 +207,14 @@ void SincResampler::InitializeKernel() { - for (size_t i = 0; i < kKernelSize; ++i) { - const size_t idx = i + offset_idx * kKernelSize; - const float pre_sinc = static_cast<float>( -- std::numbers::pi * -- (static_cast<int>(i) - static_cast<int>(kKernelSize / 2) - -- subsample_offset)); -+ M_PI * (static_cast<int>(i) - static_cast<int>(kKernelSize / 2) - -+ subsample_offset)); - kernel_pre_sinc_storage_[idx] = pre_sinc; - - // Compute Blackman window, matching the offset of the sinc(). - const float x = (i - subsample_offset) / kKernelSize; -- const float window = -- static_cast<float>(kA0 - kA1 * cos(2.0 * std::numbers::pi * x) + -- kA2 * cos(4.0 * std::numbers::pi * x)); -+ const float window = static_cast<float>(kA0 - kA1 * cos(2.0 * M_PI * x) + -+ kA2 * cos(4.0 * M_PI * x)); - kernel_window_storage_[idx] = window; - - // Compute the sinc with offset, then window the sinc() function and store diff --git a/third_party/libwebrtc/moz-patch-stack/s0133.patch b/third_party/libwebrtc/moz-patch-stack/s0133.patch @@ -1,48 +0,0 @@ -From: Michael Froman <mfroman@mozilla.com> -Date: Tue, 16 Sep 2025 14:12:00 -0500 -Subject: Bug 1985396 - (fix-f7bbf59659) fixes for c++20 support - -Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/81dbe2990355d4fd285fb42864ddd765f01c99de ---- - rtc_base/arraysize.h | 32 ++++++++++++++++++++++++++++++++ - 1 file changed, 32 insertions(+) - create mode 100644 rtc_base/arraysize.h - -diff --git a/rtc_base/arraysize.h b/rtc_base/arraysize.h -new file mode 100644 -index 0000000000..bf8e6d8810 ---- /dev/null -+++ b/rtc_base/arraysize.h -@@ -0,0 +1,32 @@ -+/* -+ * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. -+ * -+ * Use of this source code is governed by a BSD-style license -+ * that can be found in the LICENSE file in the root of the source -+ * tree. An additional intellectual property rights grant can be found -+ * in the file PATENTS. All contributing project authors may -+ * be found in the AUTHORS file in the root of the source tree. -+ */ -+ -+#ifndef RTC_BASE_ARRAYSIZE_H_ -+#define RTC_BASE_ARRAYSIZE_H_ -+ -+#include <stddef.h> -+ -+// This file defines the arraysize() macro and is derived from Chromium's -+// base/macros.h. -+ -+// The arraysize(arr) macro returns the # of elements in an array arr. -+// The expression is a compile-time constant, and therefore can be -+// used in defining new arrays, for example. If you use arraysize on -+// a pointer by mistake, you will get a compile-time error. -+ -+// This template function declaration is used in defining arraysize. -+// Note that the function doesn't need an implementation, as we only -+// use its type. -+template <typename T, size_t N> -+char (&ArraySizeHelper(T (&array)[N]))[N]; -+ -+#define arraysize(array) (sizeof(ArraySizeHelper(array))) -+ -+#endif // RTC_BASE_ARRAYSIZE_H_ diff --git a/third_party/libwebrtc/moz-patch-stack/s0138.patch b/third_party/libwebrtc/moz-patch-stack/s0138.patch @@ -1,32 +0,0 @@ -From: Michael Froman <mfroman@mozilla.com> -Date: Fri, 19 Sep 2025 12:10:00 -0500 -Subject: Bug 1985396 - (fix-81d116b87a) fixes for c++20 support - -Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/b1e64049d586ffc490ab49de9e4c95f6307ea732 ---- - rtc_base/win32.cc | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/rtc_base/win32.cc b/rtc_base/win32.cc -index a50501750f..253e8770a1 100644 ---- a/rtc_base/win32.cc -+++ b/rtc_base/win32.cc -@@ -14,8 +14,8 @@ - #include <ws2tcpip.h> - - #include <algorithm> --#include <iterator> - -+#include "rtc_base/arraysize.h" - #include "rtc_base/byte_order.h" - #include "rtc_base/checks.h" - #include "rtc_base/string_utils.h" -@@ -88,7 +88,7 @@ const char* inet_ntop_v6(const void* src, char* dst, socklen_t size) { - int current = 1; - int max = 0; - int maxpos = -1; -- int run_array_size = std::ssize(runpos); -+ int run_array_size = arraysize(runpos); - // Run over the address marking runs of 0s. - for (int i = 0; i < run_array_size; ++i) { - if (as_shorts[i] == 0) { diff --git a/third_party/libwebrtc/rtc_base/arraysize.h b/third_party/libwebrtc/rtc_base/arraysize.h @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef RTC_BASE_ARRAYSIZE_H_ -#define RTC_BASE_ARRAYSIZE_H_ - -#include <stddef.h> - -// This file defines the arraysize() macro and is derived from Chromium's -// base/macros.h. - -// The arraysize(arr) macro returns the # of elements in an array arr. -// The expression is a compile-time constant, and therefore can be -// used in defining new arrays, for example. If you use arraysize on -// a pointer by mistake, you will get a compile-time error. - -// This template function declaration is used in defining arraysize. -// Note that the function doesn't need an implementation, as we only -// use its type. -template <typename T, size_t N> -char (&ArraySizeHelper(T (&array)[N]))[N]; - -#define arraysize(array) (sizeof(ArraySizeHelper(array))) - -#endif // RTC_BASE_ARRAYSIZE_H_ diff --git a/third_party/libwebrtc/rtc_base/containers/flat_set.h b/third_party/libwebrtc/rtc_base/containers/flat_set.h @@ -18,10 +18,6 @@ #include "rtc_base/containers/flat_tree.h" // IWYU pragma: export -#if __cplusplus < 202002 -# include "rtc_base/containers/identity.h" // Mozilla: remove when fixing Bug 1980501 -#endif - namespace webrtc { // flat_set is a container with a std::set-like interface that stores its diff --git a/third_party/libwebrtc/rtc_base/numerics/event_based_exponential_moving_average.cc b/third_party/libwebrtc/rtc_base/numerics/event_based_exponential_moving_average.cc @@ -13,6 +13,7 @@ #include <cmath> #include <cstdint> #include <limits> +#include <numbers> #include "rtc_base/checks.h" @@ -35,7 +36,7 @@ EventBasedExponentialMovingAverage::EventBasedExponentialMovingAverage( } void EventBasedExponentialMovingAverage::SetHalfTime(int half_time) { - tau_ = static_cast<double>(half_time) / log(2); + tau_ = static_cast<double>(half_time) / std::numbers::ln2; Reset(); } diff --git a/third_party/libwebrtc/rtc_base/random.cc b/third_party/libwebrtc/rtc_base/random.cc @@ -12,6 +12,7 @@ #include <math.h> #include <cstdint> +#include <numbers> #include "rtc_base/checks.h" #include "rtc_base/numerics/safe_conversions.h" @@ -73,7 +74,7 @@ double Random::Gaussian(double mean, double standard_deviation) { // interval (0, 1]. Note that we rely on NextOutput to generate integers // in the range [1, 2^64-1]. Normally this behavior is a bit frustrating, // but here it is exactly what we need. - const double kPi = 3.14159265358979323846; + const double kPi = std::numbers::pi; double u1 = static_cast<double>(NextOutput()) / static_cast<double>(0xFFFFFFFFFFFFFFFFull); double u2 = static_cast<double>(NextOutput()) / diff --git a/third_party/libwebrtc/rtc_base/win32.cc b/third_party/libwebrtc/rtc_base/win32.cc @@ -14,8 +14,8 @@ #include <ws2tcpip.h> #include <algorithm> +#include <iterator> -#include "rtc_base/arraysize.h" #include "rtc_base/byte_order.h" #include "rtc_base/checks.h" #include "rtc_base/string_utils.h" @@ -88,7 +88,7 @@ const char* inet_ntop_v6(const void* src, char* dst, socklen_t size) { int current = 1; int max = 0; int maxpos = -1; - int run_array_size = arraysize(runpos); + int run_array_size = std::ssize(runpos); // Run over the address marking runs of 0s. for (int i = 0; i < run_array_size; ++i) { if (as_shorts[i] == 0) {