Compare commits

...

10 Commits

Author SHA1 Message Date
Jeremy Leconte
8f573d6960 Update iOS version from 17 to 18.
Change-Id: Id4b782f6f10dca3e5cc7f34c2f6620253b3f24d0
Bug: None
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/378042
Reviewed-by: Christoffer Dewerin <jansson@webrtc.org>
Commit-Queue: Jeremy Leconte <jleconte@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43949}
2025-02-21 01:42:29 -08:00
chromium-webrtc-autoroll
a756a7ad15 Roll chromium_revision c50f9710da..40885069c1 (1422420:1422971)
Change log: c50f9710da..40885069c1
Full diff: c50f9710da..40885069c1

Changed dependencies
* src/base: 9e81d0aac9..a62135f7fa
* src/build: e42ba23e14..530d40d7d3
* src/buildtools: d1ed719a33..99bd087289
* src/ios: f497e652b6..f8fdd3967c
* src/testing: 75065cfcbb..0d1f0f2d5d
* src/third_party: f004cc0a39..adf98b9a1e
* src/third_party/androidx/cipd: R1wNTeO5kH2bzp1NW4g87DLWtiDXaImAQJplHSR-108C..9i2Jdh3nRH-lCfGUTvpGecSiz9lyJ3mGDYTNz7N04csC
* src/third_party/boringssl/src: https://boringssl.googlesource.com/boringssl.git/+log/294ab9730c..0c59e9e55b
* src/third_party/catapult: https://chromium.googlesource.com/catapult.git/+log/30345af7ee..09f963b5f4
* src/third_party/depot_tools: ab387d1ddc..2259aa1766
* src/third_party/fuzztest/src: 1d61720657..409e5199f6
* src/third_party/libc++/src: e36be6784f..1a88911caa
* src/third_party/llvm-libc/src: 99782c3117..e722dac269
* src/third_party/perfetto: 1e97ffd153..072b48f0e0
* src/third_party/r8/cipd: QDwsH_fhjzc4w9ejy5IKJrAl9g6ct71e1UJiFwGoqYMC..2ChXGrcBJ9WNhFhS069j3L6VMp0jw5xyyPqKhlOqj_sC
* src/third_party/rust-toolchain_version: Linux_x64/rust-toolchain-009e73825af0e59ad4fc603562e038b3dbd6593a-2-llvmorg-20-init-3847-g69c43468.tar.xz,Mac/rust-toolchain-009e73825af0e59ad4fc603562e038b3dbd6593a-2-llvmorg-20-init-3847-g69c43468.tar.xz,Mac_arm64/rust-toolchain-009e73825af0e59ad4fc603562e038b3dbd6593a-2-llvmorg-20-init-3847-g69c43468.tar.xz,Win/rust-toolchain-009e73825af0e59ad4fc603562e038b3dbd6593a-2-llvmorg-20-init-3847-g69c43468.tar.xz..Linux_x64/rust-toolchain-9fcc9cf4a202aadfe1f44722b39c83536eba3dba-2-llvmorg-21-init-1655-g7b473dfe.tar.xz,Mac/rust-toolchain-9fcc9cf4a202aadfe1f44722b39c83536eba3dba-2-llvmorg-21-init-1655-g7b473dfe.tar.xz,Mac_arm64/rust-toolchain-9fcc9cf4a202aadfe1f44722b39c83536eba3dba-2-llvmorg-21-init-1655-g7b473dfe.tar.xz,Win/rust-toolchain-9fcc9cf4a202aadfe1f44722b39c83536eba3dba-2-llvmorg-21-init-1655-g7b473dfe.tar.xz
* src/tools: 367e383074..a4cad1e12a
DEPS diff: c50f9710da..40885069c1/DEPS

No update to Clang.

BUG=None

Change-Id: I764ffb6cc53a7d0c2a498d185c79bdb12cda5d90
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/378300
Bot-Commit: Autoroller <chromium-webrtc-autoroll@webrtc-ci.iam.gserviceaccount.com>
Commit-Queue: Autoroller <chromium-webrtc-autoroll@webrtc-ci.iam.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#43948}
2025-02-21 00:37:55 -08:00
Jeremy Leconte
e90ab59b7c Revert "Move resources to resources/BUILD.gn."
This reverts commit 7dea26d8bb0fbb2f6fe25e74d2baac9293e413a8.

Reason for revert: breaks downstream

Original change's description:
> Move resources to resources/BUILD.gn.
>
> iOS bundle all resources in the same folder and some conflicts can arise from that.
> Having all resources in the same file makes it easier to reason about it.
>
> Change-Id: I37f420dfbd265ec644804e9d4c96515c83d2a992
> Bug: b/397385850
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/377821
> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> Commit-Queue: Jeremy Leconte <jleconte@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#43944}

Bug: b/397385850
Change-Id: I80788590498fc24709c95a6a9580fdad65860f8c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/378280
Commit-Queue: Jeremy Leconte <jleconte@webrtc.org>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Jeremy Leconte <jleconte@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43947}
2025-02-21 00:01:13 -08:00
Jonas Oreland
358c94f5dd AudioState extensions
This patch modifies AudioState to always call InitRecording
before StartRecording(). This makes it possible to do
SetRecording(false) + SetRecording(true), which before this
patch would not actually work if there was sending streams.

The only way was to add/remove streams...via SDP operations, puh :(.

Bonus: We also needed to modifu AndroidAudioDeviceModule
(which is a thin wrapper) so that StopRecording() will
call AudioInput->StopRecording() even when recording is not
enabled.

BUG=b/397376626

Change-Id: I954b5caab11225b544c3e6a78c5dde357d4eedb5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/378140
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Auto-Submit: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43946}
2025-02-20 23:50:12 -08:00
webrtc-version-updater
21b5db48da Update WebRTC code version (2025-02-21T04:05:42).
Bug: None
Change-Id: I5d7a91092f6b6d059a02244e198f4381f05e9b5e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/378260
Bot-Commit: webrtc-version-updater@webrtc-ci.iam.gserviceaccount.com <webrtc-version-updater@webrtc-ci.iam.gserviceaccount.com>
Commit-Queue: webrtc-version-updater@webrtc-ci.iam.gserviceaccount.com <webrtc-version-updater@webrtc-ci.iam.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#43945}
2025-02-20 21:44:16 -08:00
Jeremy Leconte
7dea26d8bb Move resources to resources/BUILD.gn.
iOS bundle all resources in the same folder and some conflicts can arise from that.
Having all resources in the same file makes it easier to reason about it.

Change-Id: I37f420dfbd265ec644804e9d4c96515c83d2a992
Bug: b/397385850
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/377821
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Jeremy Leconte <jleconte@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43944}
2025-02-20 08:48:47 -08:00
Jeremy Leconte
cea5e723b5 Re-enable iOS simulator bots.
Change-Id: I2e05dd6f40467ee94072a0daac94142d50ff8032
Bug: b/396118151
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/378020
Commit-Queue: Jeremy Leconte <jleconte@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43943}
2025-02-20 07:48:26 -08:00
Evan Shrubsole
d9dd939d66 Move safe_minmax.h to webrtc namespace
Bug: webrtc:42232595
Change-Id: Ia3d96dfe1b1c25b6cc21bbd99d24ded7461924cd
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/378061
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43942}
2025-02-20 05:12:52 -08:00
Philipp Hancke
ad82b6e45b IWYU candidate_pair_interface
and remove the forward declaration

BUG=webrtc:42226242

Change-Id: I6bff2ef5048e641c834f9e03620ce038f6513065
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/376920
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@meta.com>
Cr-Commit-Position: refs/heads/main@{#43941}
2025-02-20 05:11:14 -08:00
Mosa Morosev
b300a9cc05 OpenH264 library enabled in Android Chromium build
H264 codec components are included in Chromium build on Android when
OpenH264 library is enabled in Chromium media using media_use_openh264
build flag.

Bug: chromium:40519162
Change-Id: I4fcc341a7d208b399a294b1f86774860f70f83b6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/372680
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43940}
2025-02-20 03:51:15 -08:00
59 changed files with 206 additions and 152 deletions

34
DEPS
View File

@ -10,7 +10,7 @@ vars = {
# chromium waterfalls. More info at: crbug.com/570091.
'checkout_configuration': 'default',
'checkout_instrumented_libraries': 'checkout_linux and checkout_configuration == "default"',
'chromium_revision': 'c50f9710da99968a7817f069dafba47c5155cdcd',
'chromium_revision': '40885069c19986b2dd96326b6e8dddd99c5f8ac4',
# Fetch the prebuilt binaries for llvm-cov and llvm-profdata. Needed to
# process the raw profiles produced by instrumented targets (built with
@ -64,24 +64,24 @@ vars = {
deps = {
# TODO(kjellander): Move this to be Android-only.
'src/base':
'https://chromium.googlesource.com/chromium/src/base@9e81d0aac944aea8355604ddd28065af1d8a24e3',
'https://chromium.googlesource.com/chromium/src/base@a62135f7fa7fb9342b98cabc1654b385888c52f8',
'src/build':
'https://chromium.googlesource.com/chromium/src/build@e42ba23e14b15bbfc89a809dee1c8f700d80c736',
'https://chromium.googlesource.com/chromium/src/build@530d40d7d32fdb762b8eec27d0b30325eeca2dfe',
'src/buildtools':
'https://chromium.googlesource.com/chromium/src/buildtools@d1ed719a33042a69290036402227949ec4d11877',
'https://chromium.googlesource.com/chromium/src/buildtools@99bd0872895b0e7da5a5fa241b24b5b58f508641',
# Gradle 6.6.1. Used for testing Android Studio project generation for WebRTC.
'src/examples/androidtests/third_party/gradle': {
'url': 'https://chromium.googlesource.com/external/github.com/gradle/gradle.git@f2d1fb54a951d8b11d25748e4711bec8d128d7e3',
'condition': 'checkout_android',
},
'src/ios': {
'url': 'https://chromium.googlesource.com/chromium/src/ios@f497e652b6cd0bfd75094548dd9bfe872cba7c30',
'url': 'https://chromium.googlesource.com/chromium/src/ios@f8fdd3967c7182ced94963b65fed98b4b77c824c',
'condition': 'checkout_ios',
},
'src/testing':
'https://chromium.googlesource.com/chromium/src/testing@75065cfcbb2b3db725f614f0d97bafcaaad3bb4b',
'https://chromium.googlesource.com/chromium/src/testing@0d1f0f2d5d1eec0d377f81f5c1dca82527ca13d3',
'src/third_party':
'https://chromium.googlesource.com/chromium/src/third_party@f004cc0a39eb7c5125a84f931ebfe1fadf8a4458',
'https://chromium.googlesource.com/chromium/src/third_party@adf98b9a1ee057cb1cf57e3fdc39ca91309627c4',
'src/buildtools/linux64': {
'packages': [
@ -164,11 +164,11 @@ deps = {
'src/third_party/clang-format/script':
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/clang/tools/clang-format.git@37f6e68a107df43b7d7e044fd36a13cbae3413f2',
'src/third_party/libc++/src':
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxx.git@e36be6784f33c592ecc89da2a829807920d374ef',
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxx.git@1a88911caa16345beb23d141f0361d58f3c4fcf5',
'src/third_party/libc++abi/src':
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxxabi.git@94c5d7a8edc09f0680aee57548c0b5d400c2840d',
'src/third_party/llvm-libc/src':
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libc.git@99782c3117bf68302f6d9080d70ac5bd86fa72f6',
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libc.git@e722dac269c4c938fcd197d0e37987eb29cb2989',
'src/third_party/libunwind/src':
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libunwind.git@62e217a12ee1133833d9890b2f7adde900e4efbd',
@ -286,11 +286,11 @@ deps = {
},
'src/third_party/boringssl/src':
'https://boringssl.googlesource.com/boringssl.git@294ab9730c570213b496cfc2fc14b3c0bfcd4bcc',
'https://boringssl.googlesource.com/boringssl.git@0c59e9e55bdaadadf49f3c092b097e72cd4b39cc',
'src/third_party/breakpad/breakpad':
'https://chromium.googlesource.com/breakpad/breakpad.git@0dfd77492fdb0dcd06027c5842095e2e908adc90',
'src/third_party/catapult':
'https://chromium.googlesource.com/catapult.git@30345af7ee8bf6e5ac59d4fc9a2fa3edbb707a4a',
'https://chromium.googlesource.com/catapult.git@09f963b5f4b4304a0f1b9e75fc610de2eb0603ef',
'src/third_party/ced/src': {
'url': 'https://chromium.googlesource.com/external/github.com/google/compact_enc_det.git@ba412eaaacd3186085babcd901679a48863c7dd5',
},
@ -303,7 +303,7 @@ deps = {
'src/third_party/crc32c/src':
'https://chromium.googlesource.com/external/github.com/google/crc32c.git@d3d60ac6e0f16780bcfcc825385e1d338801a558',
'src/third_party/depot_tools':
'https://chromium.googlesource.com/chromium/tools/depot_tools.git@ab387d1ddc530d405f662904f2df292f700e4b0f',
'https://chromium.googlesource.com/chromium/tools/depot_tools.git@2259aa176628b8c8ef67a1e1c6dab94cb69ba3c9',
'src/third_party/ffmpeg':
'https://chromium.googlesource.com/chromium/third_party/ffmpeg.git@fbce2a76c00cd2e5aeffe3c2e71d44c284ec52d6',
'src/third_party/flatbuffers/src':
@ -389,7 +389,7 @@ deps = {
'src/third_party/libFuzzer/src':
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/compiler-rt/lib/fuzzer.git@e31b99917861f891308269c36a32363b120126bb',
'src/third_party/fuzztest/src':
'https://chromium.googlesource.com/external/github.com/google/fuzztest.git@1d61720657533c73cbffda1e909e2130fcae5029',
'https://chromium.googlesource.com/external/github.com/google/fuzztest.git@409e5199f68ac4aafd4b1e9aeae0bb79e464b94a',
'src/third_party/libjpeg_turbo':
'https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git@927aabfcd26897abb9776ecf2a6c38ea5bb52ab6',
'src/third_party/libsrtp':
@ -403,7 +403,7 @@ deps = {
'condition': 'checkout_android',
},
'src/third_party/perfetto':
'https://android.googlesource.com/platform/external/perfetto.git@1e97ffd1534d3cff6b33ba2c01ba30eff2f249cb',
'https://android.googlesource.com/platform/external/perfetto.git@072b48f0e00550ae76cde0d21b5e5793c2613443',
'src/third_party/protobuf-javascript/src':
Var('chromium_git') + '/external/github.com/protocolbuffers/protobuf-javascript' + '@' + '426b2e025aa59c23a1b6e19fbacd6b4a11bfad16',
'src/third_party/libvpx/source/libvpx':
@ -438,7 +438,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/r8',
'version': 'QDwsH_fhjzc4w9ejy5IKJrAl9g6ct71e1UJiFwGoqYMC',
'version': '2ChXGrcBJ9WNhFhS069j3L6VMp0jw5xyyPqKhlOqj_sC',
},
],
'condition': 'checkout_android',
@ -462,7 +462,7 @@ deps = {
'condition': 'checkout_android',
},
'src/tools':
'https://chromium.googlesource.com/chromium/src/tools@367e3830749cae49cfaf9646b5e8c99270679b1d',
'https://chromium.googlesource.com/chromium/src/tools@a4cad1e12adcdccf32335806ce3c73fc37650d84',
'src/third_party/espresso': {
'packages': [
@ -501,7 +501,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/androidx',
'version': 'R1wNTeO5kH2bzp1NW4g87DLWtiDXaImAQJplHSR-108C',
'version': '9i2Jdh3nRH-lCfGUTvpGecSiz9lyJ3mGDYTNz7N04csC',
},
],
'condition': 'checkout_android and non_git_source',

View File

@ -18,7 +18,7 @@
namespace webrtc {
namespace {
bool Limit(float* value, float min, float max) {
float clamped = rtc::SafeClamp(*value, min, max);
float clamped = SafeClamp(*value, min, max);
clamped = std::isfinite(clamped) ? clamped : min;
bool res = *value == clamped;
*value = clamped;
@ -26,14 +26,14 @@ bool Limit(float* value, float min, float max) {
}
bool Limit(size_t* value, size_t min, size_t max) {
size_t clamped = rtc::SafeClamp(*value, min, max);
size_t clamped = SafeClamp(*value, min, max);
bool res = *value == clamped;
*value = clamped;
return res;
}
bool Limit(int* value, int min, int max) {
int clamped = rtc::SafeClamp(*value, min, max);
int clamped = SafeClamp(*value, min, max);
bool res = *value == clamped;
*value = clamped;
return res;

View File

@ -45,7 +45,7 @@ std::optional<AudioEncoderL16::Config> AudioEncoderL16::SdpToConfig(
if (ptime_iter != format.parameters.end()) {
const auto ptime = StringToNumber<int>(ptime_iter->second);
if (ptime && *ptime > 0) {
config.frame_size_ms = rtc::SafeClamp(10 * (*ptime / 10), 10, 60);
config.frame_size_ms = SafeClamp(10 * (*ptime / 10), 10, 60);
}
}
if (absl::EqualsIgnoreCase(format.name, "L16") && config.IsOk()) {

View File

@ -46,7 +46,7 @@ std::optional<AudioEncoderG711::Config> AudioEncoderG711::SdpToConfig(
if (ptime_iter != format.parameters.end()) {
const auto ptime = StringToNumber<int>(ptime_iter->second);
if (ptime && *ptime > 0) {
config.frame_size_ms = rtc::SafeClamp(10 * (*ptime / 10), 10, 60);
config.frame_size_ms = SafeClamp(10 * (*ptime / 10), 10, 60);
}
}
if (!config.IsOk()) {

View File

@ -46,7 +46,7 @@ std::optional<AudioEncoderG722Config> AudioEncoderG722::SdpToConfig(
auto ptime = StringToNumber<int>(ptime_iter->second);
if (ptime && *ptime > 0) {
const int whole_packets = *ptime / 10;
config.frame_size_ms = rtc::SafeClamp<int>(whole_packets * 10, 10, 60);
config.frame_size_ms = SafeClamp<int>(whole_packets * 10, 10, 60);
}
}
if (!config.IsOk()) {

View File

@ -141,13 +141,16 @@ void AudioState::SetRecording(bool enabled) {
RTC_LOG(LS_INFO) << "SetRecording(" << enabled << ")";
RTC_DCHECK_RUN_ON(&thread_checker_);
if (recording_enabled_ != enabled) {
auto* adm = config_.audio_device_module.get();
recording_enabled_ = enabled;
if (enabled) {
if (!sending_streams_.empty()) {
config_.audio_device_module->StartRecording();
if (adm->InitRecording() == 0) {
adm->StartRecording();
}
}
} else {
config_.audio_device_module->StopRecording();
adm->StopRecording();
}
}
}

View File

@ -26,6 +26,7 @@ namespace test {
namespace {
using ::testing::_;
using ::testing::InSequence;
using ::testing::Matcher;
using ::testing::NiceMock;
using ::testing::StrictMock;
@ -357,6 +358,36 @@ TEST_P(AudioStateTest,
audio_buffer, n_samples_out, &elapsed_time_ms, &ntp_time_ms);
}
TEST_P(AudioStateTest, AlwaysCallInitRecordingBeforeStartRecording) {
ConfigHelper helper(GetParam());
rtc::scoped_refptr<internal::AudioState> audio_state(
rtc::make_ref_counted<internal::AudioState>(helper.config()));
auto* adm = reinterpret_cast<MockAudioDeviceModule*>(
helper.config().audio_device_module.get());
MockAudioSendStream stream;
{
InSequence s;
EXPECT_CALL(*adm, InitRecording());
EXPECT_CALL(*adm, StartRecording());
audio_state->AddSendingStream(&stream, kSampleRate, kNumberOfChannels);
}
EXPECT_CALL(*adm, StopRecording());
audio_state->SetRecording(false);
{
InSequence s;
EXPECT_CALL(*adm, InitRecording());
EXPECT_CALL(*adm, StartRecording());
audio_state->SetRecording(true);
}
EXPECT_CALL(*adm, StopRecording());
audio_state->RemoveSendingStream(&stream);
}
INSTANTIATE_TEST_SUITE_P(AudioStateTest,
AudioStateTest,
Values(ConfigHelper::Params({false, false}),

View File

@ -1058,8 +1058,8 @@ bool ChannelReceive::SetMinimumPlayoutDelay(int delay_ms) {
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
// Limit to range accepted by both VoE and ACM, so we're at least getting as
// close as possible, instead of failing.
delay_ms = rtc::SafeClamp(delay_ms, kVoiceEngineMinMinPlayoutDelayMs,
kVoiceEngineMaxMinPlayoutDelayMs);
delay_ms = SafeClamp(delay_ms, kVoiceEngineMinMinPlayoutDelayMs,
kVoiceEngineMaxMinPlayoutDelayMs);
if (!neteq_->SetMinimumDelay(delay_ms)) {
RTC_DLOG(LS_ERROR)
<< "SetMinimumPlayoutDelay() failed to set min playout delay "

View File

@ -494,7 +494,7 @@ void BitrateAllocator::OnNetworkEstimateChanged(TargetTransferRate msg) {
int loss_ratio_255 = msg.network_estimate.loss_rate_ratio * 255;
last_fraction_loss_ =
rtc::dchecked_cast<uint8_t>(rtc::SafeClamp(loss_ratio_255, 0, 255));
rtc::dchecked_cast<uint8_t>(SafeClamp(loss_ratio_255, 0, 255));
last_rtt_ = msg.network_estimate.round_trip_time.ms();
last_bwe_period_ms_ = msg.network_estimate.bwe_period.ms();

View File

@ -57,7 +57,7 @@ int64_t ReceiveTimeCalculator::ReconcileReceiveTimes(int64_t packet_time_us,
int64_t safe_time_us) {
int64_t stall_time_us = system_time_us - packet_time_us;
if (total_system_time_passed_us_ < config_.stall_threshold->us()) {
stall_time_us = rtc::SafeMin(stall_time_us, config_.max_stall->us());
stall_time_us = SafeMin(stall_time_us, config_.max_stall->us());
}
int64_t corrected_time_us = safe_time_us - stall_time_us;
@ -107,8 +107,8 @@ int64_t ReceiveTimeCalculator::ReconcileReceiveTimes(int64_t packet_time_us,
if (forward_clock_reset || obvious_backward_clock_reset ||
small_reset_during_stall_) {
corrected_time_us = last_corrected_time_us_ +
rtc::SafeClamp(packet_time_delta_us, 0,
config_.max_packet_time_repair->us());
SafeClamp(packet_time_delta_us, 0,
config_.max_packet_time_repair->us());
}
}

View File

@ -13,7 +13,7 @@
namespace webrtc {
// The timestamp is always in UTC.
const char* const kSourceTimestamp = "WebRTC source stamp 2025-02-20T04:02:19";
const char* const kSourceTimestamp = "WebRTC source stamp 2025-02-21T04:05:41";
void LoadWebRTCVersionInRegister() {
// Using volatile to instruct the compiler to not optimize `p` away even

View File

@ -90,6 +90,9 @@ config_groups {
builders {
name: "webrtc/try/ios_compile_arm64_rel"
}
builders {
name: "webrtc/try/ios_dbg_simulator"
}
builders {
name: "webrtc/try/linux_asan"
}
@ -267,6 +270,9 @@ config_groups {
builders {
name: "webrtc/try/ios_compile_arm64_rel"
}
builders {
name: "webrtc/try/ios_dbg_simulator"
}
builders {
name: "webrtc/try/linux_asan"
}

View File

@ -53,7 +53,6 @@ def os_from_name(name):
# useful when a failure can be safely ignored while fixing it without
# blocking the LKGR finder on it.
skipped_lkgr_bots = [
"iOS Debug (simulator)",
]
# Use LUCI Scheduler BBv2 names and add Scheduler realms configs.
@ -761,8 +760,7 @@ ios_builder("iOS64 Release", "iOS|arm64|rel")
ios_try_job("ios_compile_arm64_rel")
ios_builder("iOS Debug (simulator)", "iOS|x64|sim")
# TODO: b/396118151 - Reenable the bot when the issue is fixed.
ios_try_job("ios_dbg_simulator", cq = None)
ios_try_job("ios_dbg_simulator")
ios_builder("iOS API Framework Builder", "iOS|fat|size", recipe = "ios_api_framework", prioritized = True)
ios_try_job("ios_api_framework", recipe = "ios_api_framework")

View File

@ -1907,6 +1907,7 @@ buckets {
' "Win64 Debug (Clang)",'
' "Win64 Release (Clang)",'
' "iOS API Framework Builder",'
' "iOS Debug (simulator)",'
' "iOS64 Debug",'
' "iOS64 Release"'
' ]'

View File

@ -943,6 +943,11 @@ notifiers {
name: "iOS Debug (simulator)"
repository: "https://webrtc.googlesource.com/src"
}
tree_closers {
tree_status_host: "webrtc-status.appspot.com"
failed_step_regexp: "bot_update|compile|gclient runhooks|runhooks|update|extract build|cleanup_temp|taskkill|compile|gn"
failed_step_regexp_exclude: ".*\\(experimental\\).*"
}
}
notifiers {
notifications {

View File

@ -28,7 +28,7 @@
}
],
"dimensions": {
"os": "iOS-17.6.1",
"os": "iOS-18",
"pool": "chrome.tests"
},
"named_caches": [
@ -67,7 +67,7 @@
}
],
"dimensions": {
"os": "iOS-17.6.1",
"os": "iOS-18",
"pool": "chrome.tests"
},
"named_caches": [
@ -107,7 +107,7 @@
}
],
"dimensions": {
"os": "iOS-17.6.1",
"os": "iOS-18",
"pool": "chrome.tests"
},
"hard_timeout": 7200,
@ -149,7 +149,7 @@
}
],
"dimensions": {
"os": "iOS-17.6.1",
"os": "iOS-18",
"pool": "chrome.tests"
},
"named_caches": [
@ -189,7 +189,7 @@
}
],
"dimensions": {
"os": "iOS-17.6.1",
"os": "iOS-18",
"pool": "chrome.tests"
},
"named_caches": [
@ -228,7 +228,7 @@
}
],
"dimensions": {
"os": "iOS-17.6.1",
"os": "iOS-18",
"pool": "chrome.tests"
},
"named_caches": [
@ -267,7 +267,7 @@
}
],
"dimensions": {
"os": "iOS-17.6.1",
"os": "iOS-18",
"pool": "chrome.tests"
},
"named_caches": [
@ -306,7 +306,7 @@
}
],
"dimensions": {
"os": "iOS-17.6.1",
"os": "iOS-18",
"pool": "chrome.tests"
},
"named_caches": [
@ -345,7 +345,7 @@
}
],
"dimensions": {
"os": "iOS-17.6.1",
"os": "iOS-18",
"pool": "chrome.tests"
},
"named_caches": [
@ -384,7 +384,7 @@
}
],
"dimensions": {
"os": "iOS-17.6.1",
"os": "iOS-18",
"pool": "chrome.tests"
},
"named_caches": [
@ -481,7 +481,7 @@
}
],
"dimensions": {
"os": "iOS-17.6.1",
"os": "iOS-18",
"pool": "chrome.tests"
},
"named_caches": [
@ -520,7 +520,7 @@
}
],
"dimensions": {
"os": "iOS-17.6.1",
"os": "iOS-18",
"pool": "chrome.tests"
},
"named_caches": [
@ -560,7 +560,7 @@
}
],
"dimensions": {
"os": "iOS-17.6.1",
"os": "iOS-18",
"pool": "chrome.tests"
},
"hard_timeout": 7200,
@ -602,7 +602,7 @@
}
],
"dimensions": {
"os": "iOS-17.6.1",
"os": "iOS-18",
"pool": "chrome.tests"
},
"named_caches": [
@ -642,7 +642,7 @@
}
],
"dimensions": {
"os": "iOS-17.6.1",
"os": "iOS-18",
"pool": "chrome.tests"
},
"named_caches": [
@ -681,7 +681,7 @@
}
],
"dimensions": {
"os": "iOS-17.6.1",
"os": "iOS-18",
"pool": "chrome.tests"
},
"named_caches": [
@ -720,7 +720,7 @@
}
],
"dimensions": {
"os": "iOS-17.6.1",
"os": "iOS-18",
"pool": "chrome.tests"
},
"named_caches": [
@ -759,7 +759,7 @@
}
],
"dimensions": {
"os": "iOS-17.6.1",
"os": "iOS-18",
"pool": "chrome.tests"
},
"named_caches": [
@ -798,7 +798,7 @@
}
],
"dimensions": {
"os": "iOS-17.6.1",
"os": "iOS-18",
"pool": "chrome.tests"
},
"named_caches": [
@ -837,7 +837,7 @@
}
],
"dimensions": {
"os": "iOS-17.6.1",
"os": "iOS-18",
"pool": "chrome.tests"
},
"named_caches": [

View File

@ -66,10 +66,10 @@
'has_native_resultdb_integration': True
}
},
'ios-device-17': {
'ios-device-18': {
'swarming': {
'dimensions': {
'os': 'iOS-17.6.1',
'os': 'iOS-18',
'pool': 'chrome.tests'
}
}

View File

@ -45,10 +45,10 @@
'--test-arg=--undefok=test_launcher_summary_output'
],
},
'ios-device-17': {
'ios-device-18': {
'swarming': {
'dimensions': {
'os': 'iOS-17.6.1',
'os': 'iOS-18',
'pool': 'chrome.tests',
}
}

View File

@ -322,7 +322,7 @@
'machines': {
'iOS64 Debug': {
'mixins': [
'ios-device-17', 'webrtc-xctest', 'chrome-tester-service-account',
'ios-device-18', 'webrtc-xctest', 'chrome-tester-service-account',
'xcode_15_main', 'mac_toolchain', 'has_native_resultdb_integration',
'out_dir_arg'
],
@ -345,7 +345,7 @@
},
'iOS64 Release': {
'mixins': [
'ios-device-17', 'webrtc-xctest', 'chrome-tester-service-account',
'ios-device-18', 'webrtc-xctest', 'chrome-tester-service-account',
'xcode_15_main', 'mac_toolchain', 'has_native_resultdb_integration',
'out_dir_arg'
],

View File

@ -235,8 +235,8 @@ void RtcEventLogImpl::ScheduleOutput() {
};
const int64_t now_ms = rtc::TimeMillis();
const int64_t time_since_output_ms = now_ms - last_output_ms_;
const int32_t delay = rtc::SafeClamp(output_period_ms_ - time_since_output_ms,
0, output_period_ms_);
const int32_t delay =
SafeClamp(output_period_ms_ - time_since_output_ms, 0, output_period_ms_);
task_queue_->PostDelayedTask(std::move(output_task),
TimeDelta::Millis(delay));
}

View File

@ -733,9 +733,9 @@ void AudioEncoderOpusImpl::SetProjectedPacketLossRate(float fraction) {
}
void AudioEncoderOpusImpl::SetTargetBitrate(int bits_per_second) {
const int new_bitrate = rtc::SafeClamp<int>(
bits_per_second, AudioEncoderOpusConfig::kMinBitrateBps,
AudioEncoderOpusConfig::kMaxBitrateBps);
const int new_bitrate =
SafeClamp<int>(bits_per_second, AudioEncoderOpusConfig::kMinBitrateBps,
AudioEncoderOpusConfig::kMaxBitrateBps);
if (config_.bitrate_bps && *config_.bitrate_bps != new_bitrate) {
config_.bitrate_bps = new_bitrate;
RTC_DCHECK(config_.IsOk());

View File

@ -100,7 +100,7 @@ void DelayConstraints::UpdateEffectiveMinimumDelay() {
// Clamp `base_minimum_delay_ms_` into the range which can be effectively
// used.
const int base_minimum_delay_ms =
rtc::SafeClamp(base_minimum_delay_ms_, 0, MinimumDelayUpperBound());
SafeClamp(base_minimum_delay_ms_, 0, MinimumDelayUpperBound());
effective_minimum_delay_ms_ =
std::max(minimum_delay_ms_, base_minimum_delay_ms);
}

View File

@ -211,8 +211,8 @@ int16_t Merge::SignalScaling(const int16_t* input,
size_t input_length,
const int16_t* expanded_signal) const {
// Adjust muting factor if new vector is more or less of the BGN energy.
const auto mod_input_length = rtc::SafeMin<size_t>(
64 * rtc::dchecked_cast<size_t>(fs_mult_), input_length);
const auto mod_input_length =
SafeMin<size_t>(64 * rtc::dchecked_cast<size_t>(fs_mult_), input_length);
const int16_t expanded_max =
WebRtcSpl_MaxAbsValueW16(expanded_signal, mod_input_length);
int32_t factor =

View File

@ -566,7 +566,7 @@ TEST_P(AdaptiveFirFilterMultiChannel, FilterAndAdapt) {
e.begin(),
[&](float a, float b) { return a - b * kScale; });
std::for_each(e.begin(), e.end(),
[](float& a) { a = rtc::SafeClamp(a, -32768.f, 32767.f); });
[](float& a) { a = SafeClamp(a, -32768.f, 32767.f); });
fft.ZeroPaddedFft(e, Aec3Fft::Window::kRectangular, &E);
for (auto& o : output) {
for (size_t k = 0; k < kBlockSize; ++k) {

View File

@ -100,7 +100,7 @@ void RunFilterUpdateTest(int num_blocks_to_process,
e_coarse.begin(),
[&](float a, float b) { return a - b * kScale; });
std::for_each(e_coarse.begin(), e_coarse.end(),
[](float& a) { a = rtc::SafeClamp(a, -32768.f, 32767.f); });
[](float& a) { a = SafeClamp(a, -32768.f, 32767.f); });
fft.ZeroPaddedFft(e_coarse, Aec3Fft::Window::kRectangular, &E_coarse);
std::array<float, kFftLengthBy2Plus1> render_power;

View File

@ -149,7 +149,7 @@ int TransformDbMetricForReporting(bool negate,
if (negate) {
new_value = -new_value;
}
return static_cast<int>(rtc::SafeClamp(new_value, min_value, max_value));
return static_cast<int>(SafeClamp(new_value, min_value, max_value));
}
} // namespace aec3

View File

@ -162,7 +162,7 @@ void RunFilterUpdateTest(const Environment& env,
e_refined.begin(),
[&](float a, float b) { return a - b * kScale; });
std::for_each(e_refined.begin(), e_refined.end(),
[](float& a) { a = rtc::SafeClamp(a, -32768.f, 32767.f); });
[](float& a) { a = SafeClamp(a, -32768.f, 32767.f); });
fft.ZeroPaddedFft(e_refined, Aec3Fft::Window::kRectangular, &E_refined);
for (size_t k = 0; k < kBlockSize; ++k) {
s[k] = kScale * s_scratch[k + kFftLengthBy2];
@ -175,7 +175,7 @@ void RunFilterUpdateTest(const Environment& env,
e_coarse.begin(),
[&](float a, float b) { return a - b * kScale; });
std::for_each(e_coarse.begin(), e_coarse.end(),
[](float& a) { a = rtc::SafeClamp(a, -32768.f, 32767.f); });
[](float& a) { a = SafeClamp(a, -32768.f, 32767.f); });
fft.ZeroPaddedFft(e_coarse, Aec3Fft::Window::kRectangular, &E_coarse);
// Compute spectra for future use.

View File

@ -205,12 +205,12 @@ void SignalDependentErleEstimator::Update(
float correction_factor =
correction_factors_[ch][n_active_sections_[ch][k]]
[band_to_subband_[k]];
erle_[ch][k] = rtc::SafeClamp(average_erle[ch][k] * correction_factor,
min_erle_, max_erle_[band_to_subband_[k]]);
erle_[ch][k] = SafeClamp(average_erle[ch][k] * correction_factor,
min_erle_, max_erle_[band_to_subband_[k]]);
if (use_onset_detection_) {
erle_onset_compensated_[ch][k] = rtc::SafeClamp(
average_erle_onset_compensated[ch][k] * correction_factor,
min_erle_, max_erle_[band_to_subband_[k]]);
erle_onset_compensated_[ch][k] =
SafeClamp(average_erle_onset_compensated[ch][k] * correction_factor,
min_erle_, max_erle_[band_to_subband_[k]]);
}
}
}
@ -306,7 +306,7 @@ void SignalDependentErleEstimator::UpdateCorrectionFactors(
alpha = static_cast<float>(is_erle_updated[subband]) * alpha;
erle_estimators_[ch][idx][subband] +=
alpha * (new_erle[subband] - erle_estimators_[ch][idx][subband]);
erle_estimators_[ch][idx][subband] = rtc::SafeClamp(
erle_estimators_[ch][idx][subband] = SafeClamp(
erle_estimators_[ch][idx][subband], min_erle_, max_erle_[subband]);
}
@ -317,8 +317,8 @@ void SignalDependentErleEstimator::UpdateCorrectionFactors(
alpha = static_cast<float>(is_erle_updated[subband]) * alpha;
erle_ref_[ch][subband] +=
alpha * (new_erle[subband] - erle_ref_[ch][subband]);
erle_ref_[ch][subband] = rtc::SafeClamp(erle_ref_[ch][subband],
min_erle_, max_erle_[subband]);
erle_ref_[ch][subband] =
SafeClamp(erle_ref_[ch][subband], min_erle_, max_erle_[subband]);
}
for (size_t subband = 0; subband < kSubbands; ++subband) {

View File

@ -141,7 +141,7 @@ void SubbandErleEstimator::UpdateBands(
if (!use_min_erle_during_onsets_) {
float alpha =
new_erle[k] < erle_during_onsets_[ch][k] ? 0.3f : 0.15f;
erle_during_onsets_[ch][k] = rtc::SafeClamp(
erle_during_onsets_[ch][k] = SafeClamp(
erle_during_onsets_[ch][k] +
alpha * (new_erle[k] - erle_during_onsets_[ch][k]),
min_erle_, max_erle_[k]);
@ -159,8 +159,7 @@ void SubbandErleEstimator::UpdateBands(
if (new_erle < erle) {
alpha = low_render_energy ? 0.f : 0.1f;
}
erle =
rtc::SafeClamp(erle + alpha * (new_erle - erle), min_erle, max_erle);
erle = SafeClamp(erle + alpha * (new_erle - erle), min_erle, max_erle);
};
for (size_t k = 1; k < kFftLengthBy2; ++k) {

View File

@ -171,7 +171,7 @@ void SuppressionFilter::ApplyGain(
for (int b = 0; b < e->NumBands(); ++b) {
auto e_band = e->View(b, ch);
for (size_t i = 0; i < kFftLengthBy2; ++i) {
e_band[i] = rtc::SafeClamp(e_band[i], -32768.f, 32767.f);
e_band[i] = SafeClamp(e_band[i], -32768.f, 32767.f);
}
}
}

View File

@ -152,7 +152,7 @@ int GetSpeechLevelErrorDb(float speech_level_dbfs, float speech_probability) {
return 0;
}
const float speech_level = rtc::SafeClamp<float>(
const float speech_level = SafeClamp<float>(
speech_level_dbfs, kMinSpeechLevelDbfs, kMaxSpeechLevelDbfs);
return std::round(kOverrideTargetSpeechLevelDbfs - speech_level);
@ -376,7 +376,7 @@ void MonoAgc::UpdateGain(int rms_error_db) {
// Handle as much error as possible with the compressor first.
int raw_compression =
rtc::SafeClamp(rms_error, kMinCompressionGain, max_compression_gain_);
SafeClamp(rms_error, kMinCompressionGain, max_compression_gain_);
// Deemphasize the compression gain error. Move halfway between the current
// target and the newly received target. This serves to soften perceptible
@ -397,8 +397,8 @@ void MonoAgc::UpdateGain(int rms_error_db) {
// raw rather than deemphasized compression here as we would otherwise
// shrink the amount of slack the compressor provides.
const int residual_gain =
rtc::SafeClamp(rms_error - raw_compression, -kMaxResidualGainChange,
kMaxResidualGainChange);
SafeClamp(rms_error - raw_compression, -kMaxResidualGainChange,
kMaxResidualGainChange);
RTC_DLOG(LS_INFO) << "[agc] rms_error=" << rms_error
<< ", target_compression=" << target_compression_
<< ", residual_gain=" << residual_gain;

View File

@ -258,8 +258,8 @@ class SpeechSamplesReader {
// Apply gain and copy samples into `audio_buffer_`.
std::transform(buffer_.begin(), buffer_.end(),
audio_buffer_.channels()[0], [gain](int16_t v) -> float {
return rtc::SafeClamp(static_cast<float>(v) * gain,
kMinSample, kMaxSample);
return SafeClamp(static_cast<float>(v) * gain,
kMinSample, kMaxSample);
});
agc.AnalyzePreProcess(audio_buffer_);
@ -292,8 +292,8 @@ class SpeechSamplesReader {
// Apply gain and copy samples into `audio_buffer_`.
std::transform(buffer_.begin(), buffer_.end(),
audio_buffer_.channels()[0], [gain](int16_t v) -> float {
return rtc::SafeClamp(static_cast<float>(v) * gain,
kMinSample, kMaxSample);
return SafeClamp(static_cast<float>(v) * gain,
kMinSample, kMaxSample);
});
agc.AnalyzePreProcess(audio_buffer_);

View File

@ -96,8 +96,8 @@ float ComputeGainChangeThisFrameDb(float target_gain_db,
if (!gain_increase_allowed) {
target_gain_difference_db = std::min(target_gain_difference_db, 0.0f);
}
return rtc::SafeClamp(target_gain_difference_db, -max_gain_decrease_db,
max_gain_increase_db);
return SafeClamp(target_gain_difference_db, -max_gain_decrease_db,
max_gain_increase_db);
}
} // namespace

View File

@ -151,7 +151,7 @@ class ClippingEventPredictor : public ClippingPredictor {
}
if (PredictClippingEvent(channel)) {
const int new_level =
rtc::SafeClamp(level - default_step, min_mic_level, max_mic_level);
SafeClamp(level - default_step, min_mic_level, max_mic_level);
const int step = level - new_level;
if (step > 0) {
return step;
@ -296,15 +296,15 @@ class ClippingPeakPredictor : public ClippingPredictor {
step = default_step;
} else {
const int estimated_gain_change =
rtc::SafeClamp(-static_cast<int>(std::ceil(estimate_db.value())),
-kClippingPredictorMaxGainChange, 0);
SafeClamp(-static_cast<int>(std::ceil(estimate_db.value())),
-kClippingPredictorMaxGainChange, 0);
step =
std::max(level - ComputeVolumeUpdate(estimated_gain_change, level,
min_mic_level, max_mic_level),
default_step);
}
const int new_level =
rtc::SafeClamp(level - step, min_mic_level, max_mic_level);
SafeClamp(level - step, min_mic_level, max_mic_level);
if (level > new_level) {
return level - new_level;
}

View File

@ -28,7 +28,7 @@ void ClipSignal(DeinterleavedView<float> signal) {
for (size_t k = 0; k < signal.num_channels(); ++k) {
MonoView<float> channel_view = signal[k];
for (auto& sample : channel_view) {
sample = rtc::SafeClamp(sample, kMinFloatS16Value, kMaxFloatS16Value);
sample = SafeClamp(sample, kMinFloatS16Value, kMaxFloatS16Value);
}
}
}

View File

@ -116,8 +116,8 @@ int GetSpeechLevelRmsErrorDb(float speech_level_dbfs,
constexpr float kMaxSpeechLevelDbfs = 30.0f;
RTC_DCHECK_GE(speech_level_dbfs, kMinSpeechLevelDbfs);
RTC_DCHECK_LE(speech_level_dbfs, kMaxSpeechLevelDbfs);
speech_level_dbfs = rtc::SafeClamp<float>(
speech_level_dbfs, kMinSpeechLevelDbfs, kMaxSpeechLevelDbfs);
speech_level_dbfs = SafeClamp<float>(speech_level_dbfs, kMinSpeechLevelDbfs,
kMaxSpeechLevelDbfs);
int rms_error_db = 0;
if (speech_level_dbfs > target_range_max_dbfs) {
@ -343,7 +343,7 @@ void MonoInputVolumeController::UpdateInputVolume(int rms_error_db) {
// Prevent too large microphone input volume changes by clamping the RMS
// error.
rms_error_db =
rtc::SafeClamp(rms_error_db, -KMaxAbsRmsErrorDbfs, KMaxAbsRmsErrorDbfs);
SafeClamp(rms_error_db, -KMaxAbsRmsErrorDbfs, KMaxAbsRmsErrorDbfs);
if (rms_error_db == 0) {
return;
}

View File

@ -173,8 +173,8 @@ class SpeechSamplesReader {
// Apply gain and copy samples into `audio_buffer_`.
std::transform(buffer_.begin(), buffer_.end(),
audio_buffer_.channels()[0], [gain](int16_t v) -> float {
return rtc::SafeClamp(static_cast<float>(v) * gain,
kMinSample, kMaxSample);
return SafeClamp(static_cast<float>(v) * gain,
kMinSample, kMaxSample);
});
controller.AnalyzeInputAudio(applied_input_volume, audio_buffer_);
const auto recommended_input_volume = controller.RecommendInputVolume(

View File

@ -79,8 +79,8 @@ void ScaleSamples(MonoView<const float> per_sample_scaling_factors,
for (size_t i = 0; i < signal.num_channels(); ++i) {
MonoView<float> channel = signal[i];
for (int j = 0; j < samples_per_channel; ++j) {
channel[j] = rtc::SafeClamp(channel[j] * per_sample_scaling_factors[j],
kMinFloatS16Value, kMaxFloatS16Value);
channel[j] = SafeClamp(channel[j] * per_sample_scaling_factors[j],
kMinFloatS16Value, kMaxFloatS16Value);
}
}
}

View File

@ -88,7 +88,7 @@ void UpdateSaturationProtectorState(float peak_dbfs,
}
state.headroom_db =
rtc::SafeClamp<float>(state.headroom_db, kMinMarginDb, kMaxMarginDb);
SafeClamp<float>(state.headroom_db, kMinMarginDb, kMaxMarginDb);
}
// Saturation protector which recommends a headroom based on the recent peaks.

View File

@ -20,7 +20,7 @@ namespace webrtc {
namespace {
float ClampLevelEstimateDbfs(float level_estimate_dbfs) {
return rtc::SafeClamp<float>(level_estimate_dbfs, -90.0f, 30.0f);
return SafeClamp<float>(level_estimate_dbfs, -90.0f, 30.0f);
}
// Returns the initial speech level estimate needed to apply the initial gain.

View File

@ -670,13 +670,13 @@ void ApmTest::ProcessDelayVerificationTest(int delay_ms,
// Calculate expected delay estimate and acceptable regions. Further,
// limit them w.r.t. AEC delay estimation support.
const size_t samples_per_ms =
rtc::SafeMin<size_t>(16u, frame_.samples_per_channel() / 10);
SafeMin<size_t>(16u, frame_.samples_per_channel() / 10);
const int expected_median =
rtc::SafeClamp<int>(delay_ms - system_delay_ms, delay_min, delay_max);
const int expected_median_high = rtc::SafeClamp<int>(
SafeClamp<int>(delay_ms - system_delay_ms, delay_min, delay_max);
const int expected_median_high = SafeClamp<int>(
expected_median + rtc::dchecked_cast<int>(96 / samples_per_ms), delay_min,
delay_max);
const int expected_median_low = rtc::SafeClamp<int>(
const int expected_median_low = SafeClamp<int>(
expected_median - rtc::dchecked_cast<int>(96 / samples_per_ms), delay_min,
delay_max);
// Verify delay metrics.

View File

@ -84,7 +84,7 @@ void AudioSamplesScaler::Process(AudioBuffer& audio_buffer) {
for (float& sample : channel_view) {
constexpr float kMinFloatS16Value = -32768.f;
constexpr float kMaxFloatS16Value = 32767.f;
sample = rtc::SafeClamp(sample, kMinFloatS16Value, kMaxFloatS16Value);
sample = SafeClamp(sample, kMinFloatS16Value, kMaxFloatS16Value);
}
}
}

View File

@ -80,7 +80,7 @@ void CaptureLevelsAdjuster::SetAnalogMicGainLevel(int level) {
RTC_DCHECK_GE(level, kMinAnalogMicGainLevel);
RTC_DCHECK_LE(level, kMaxAnalogMicGainLevel);
int clamped_level =
rtc::SafeClamp(level, kMinAnalogMicGainLevel, kMaxAnalogMicGainLevel);
SafeClamp(level, kMinAnalogMicGainLevel, kMaxAnalogMicGainLevel);
emulated_analog_mic_gain_level_ = clamped_level;
UpdatePreAdjustmentGain();

View File

@ -87,8 +87,8 @@ class FakeRecordingDeviceLinear final : public FakeRecordingDeviceWorker {
for (size_t c = 0; c < buffer->num_channels(); ++c) {
for (size_t i = 0; i < buffer->num_frames(); ++i) {
buffer->channels()[c][i] =
rtc::SafeClamp(buffer->channels()[c][i] * mic_level_ / divisor,
kFloatSampleMin, kFloatSampleMax);
SafeClamp(buffer->channels()[c][i] * mic_level_ / divisor,
kFloatSampleMin, kFloatSampleMax);
}
}
}
@ -125,8 +125,8 @@ class FakeRecordingDeviceAgc final : public FakeRecordingDeviceWorker {
for (size_t c = 0; c < buffer->num_channels(); ++c) {
for (size_t i = 0; i < buffer->num_frames(); ++i) {
buffer->channels()[c][i] =
rtc::SafeClamp(buffer->channels()[c][i] * scaling_factor,
kFloatSampleMin, kFloatSampleMax);
SafeClamp(buffer->channels()[c][i] * scaling_factor,
kFloatSampleMin, kFloatSampleMax);
}
}
}

View File

@ -325,7 +325,7 @@ void TrendlineEstimator::UpdateThreshold(double modified_trend,
const int64_t kMaxTimeDeltaMs = 100;
int64_t time_delta_ms = std::min(now_ms - last_update_ms_, kMaxTimeDeltaMs);
threshold_ += k * (fabs(modified_trend) - threshold_) * time_delta_ms;
threshold_ = rtc::SafeClamp(threshold_, 6.f, 600.f);
threshold_ = SafeClamp(threshold_, 6.f, 600.f);
last_update_ms_ = now_ms;
}

View File

@ -93,7 +93,7 @@ void OveruseDetector::UpdateThreshold(double modified_offset, int64_t now_ms) {
const int64_t kMaxTimeDeltaMs = 100;
int64_t time_delta_ms = std::min(now_ms - last_update_ms_, kMaxTimeDeltaMs);
threshold_ += k * (fabs(modified_offset) - threshold_) * time_delta_ms;
threshold_ = rtc::SafeClamp(threshold_, 6.f, 600.f);
threshold_ = SafeClamp(threshold_, 6.f, 600.f);
last_update_ms_ = now_ms;
}

View File

@ -420,15 +420,15 @@ std::vector<std::unique_ptr<RtpPacketToSend>> RTPSender::GeneratePadding(
max_packet_size_ - max_padding_fec_packet_header_;
if (audio_configured_) {
// Allow smaller padding packets for audio.
padding_bytes_in_packet = rtc::SafeClamp<size_t>(
bytes_left, kMinAudioPaddingLength,
rtc::SafeMin(max_payload_size, kMaxPaddingLength));
padding_bytes_in_packet =
SafeClamp<size_t>(bytes_left, kMinAudioPaddingLength,
SafeMin(max_payload_size, kMaxPaddingLength));
} else {
// Always send full padding packets. This is accounted for by the
// RtpPacketSender, which will make sure we don't send too much padding even
// if a single packet is larger than requested.
// We do this to avoid frequently sending small packets on higher bitrates.
padding_bytes_in_packet = rtc::SafeMin(max_payload_size, kMaxPaddingLength);
padding_bytes_in_packet = SafeMin(max_payload_size, kMaxPaddingLength);
}
while (bytes_left > 0) {

View File

@ -145,6 +145,7 @@ rtc_library("basic_port_allocator") {
rtc_source_set("candidate_pair_interface") {
sources = [ "base/candidate_pair_interface.h" ]
deps = [ "../api:candidate" ]
}
rtc_library("connection") {

View File

@ -11,9 +11,9 @@
#ifndef P2P_BASE_CANDIDATE_PAIR_INTERFACE_H_
#define P2P_BASE_CANDIDATE_PAIR_INTERFACE_H_
namespace cricket {
#include "api/candidate.h"
class Candidate;
namespace cricket {
class CandidatePairInterface {
public:

View File

@ -983,7 +983,7 @@ void Connection::UpdateState(int64_t now) {
return;
// Computes our estimate of the RTT given the current estimate.
int rtt = rtc::SafeClamp(2 * rtt_, MINIMUM_RTT, MAXIMUM_RTT);
int rtt = webrtc::SafeClamp(2 * rtt_, MINIMUM_RTT, MAXIMUM_RTT);
if (RTC_LOG_CHECK_LEVEL(LS_VERBOSE)) {
std::string pings;

View File

@ -713,8 +713,8 @@ bool PseudoTcp::process(Segment& seg) {
m_rx_rttvar = (3 * m_rx_rttvar + abs_err) / 4;
m_rx_srtt = (7 * m_rx_srtt + rtt) / 8;
}
m_rx_rto = rtc::SafeClamp(m_rx_srtt + rtc::SafeMax(1, 4 * m_rx_rttvar),
MIN_RTO, MAX_RTO);
m_rx_rto = webrtc::SafeClamp(
m_rx_srtt + webrtc::SafeMax(1, 4 * m_rx_rttvar), MIN_RTO, MAX_RTO);
#if _DEBUGMSG >= _DBG_VERBOSE
RTC_LOG(LS_INFO) << "rtt: " << rtt << " srtt: " << m_rx_srtt
<< " rto: " << m_rx_rto;

View File

@ -29,10 +29,9 @@ void JitterBufferDelay::Set(std::optional<double> delay_seconds) {
int JitterBufferDelay::GetMs() const {
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
return rtc::SafeClamp(
rtc::saturated_cast<int>(cached_delay_seconds_.value_or(kDefaultDelay) *
1000),
0, kMaximumDelayMs);
return SafeClamp(rtc::saturated_cast<int>(
cached_delay_seconds_.value_or(kDefaultDelay) * 1000),
0, kMaximumDelayMs);
}
} // namespace webrtc

View File

@ -84,7 +84,7 @@
#include "rtc_base/numerics/safe_compare.h"
#include "rtc_base/type_traits.h"
namespace rtc {
namespace webrtc {
namespace safe_minmax_impl {
@ -331,6 +331,14 @@ R2 SafeClamp(T x, L min, H max) {
: static_cast<R2>(x);
}
} // namespace webrtc
// Re-export symbols from the webrtc namespace for backwards compatibility.
// TODO(bugs.webrtc.org/4222596): Remove once all references are updated.
namespace rtc {
using ::webrtc::SafeClamp;
using ::webrtc::SafeMax;
using ::webrtc::SafeMin;
} // namespace rtc
#endif // RTC_BASE_NUMERICS_SAFE_MINMAX_H_

View File

@ -17,7 +17,7 @@
#include "test/gtest.h"
namespace rtc {
namespace webrtc {
namespace {
@ -344,4 +344,4 @@ uint32_t TestClampSafe(uint32_t x, uint32_t a, uint32_t b) {
return SafeClamp(x, a, b);
}
} // namespace rtc
} // namespace webrtc

View File

@ -34,8 +34,7 @@ SimpleStringBuilder& SimpleStringBuilder::operator<<(char ch) {
SimpleStringBuilder& SimpleStringBuilder::operator<<(absl::string_view str) {
RTC_DCHECK_LT(size_ + str.length(), buffer_.size())
<< "Buffer size was insufficient";
const size_t chars_added =
rtc::SafeMin(str.length(), buffer_.size() - size_ - 1);
const size_t chars_added = SafeMin(str.length(), buffer_.size() - size_ - 1);
memcpy(&buffer_[size_], str.data(), chars_added);
size_ += chars_added;
buffer_[size_] = '\0';
@ -97,7 +96,7 @@ SimpleStringBuilder& SimpleStringBuilder::AppendFormat(const char* fmt, ...) {
const int len =
std::vsnprintf(&buffer_[size_], buffer_.size() - size_, fmt, args);
if (len >= 0) {
const size_t chars_added = rtc::SafeMin(len, buffer_.size() - 1 - size_);
const size_t chars_added = SafeMin(len, buffer_.size() - 1 - size_);
size_ += chars_added;
RTC_DCHECK_EQ(len, chars_added) << "Buffer size was insufficient";
} else {

View File

@ -298,8 +298,6 @@ class AndroidAudioDeviceModule : public AudioDeviceModule {
RTC_DLOG(LS_INFO) << __FUNCTION__;
if (!initialized_)
return -1;
if (!Recording())
return 0;
audio_device_buffer_->StopRecording();
int32_t result = input_->StopRecording();
RTC_DLOG(LS_INFO) << "output: " << result;

View File

@ -56,7 +56,7 @@ void RandomWalkCrossTraffic::Process(Timestamp at_time) {
if (at_time - last_update_time_ >= config_.update_interval) {
intensity_ += random_.Gaussian(config_.bias, config_.variance) *
sqrt((at_time - last_update_time_).seconds<double>());
intensity_ = rtc::SafeClamp(intensity_, 0.0, 1.0);
intensity_ = SafeClamp(intensity_, 0.0, 1.0);
last_update_time_ = at_time;
}
pending_size_ += TrafficRate() * delta;

View File

@ -137,7 +137,7 @@ double GetFilteredElement(int width,
}
// Take the rounding errors into consideration.
return rtc::SafeClamp(element_sum / total_weight, 0.0, 255.0);
return SafeClamp(element_sum / total_weight, 0.0, 255.0);
}
std::vector<FilteredSample> GetSampleValuesForFrame(

View File

@ -170,18 +170,24 @@ declare_args() {
rtc_build_with_neon =
(current_cpu == "arm" && arm_use_neon) || current_cpu == "arm64"
# Enable this to build OpenH264 encoder/FFmpeg decoder. This is supported on
# all platforms except Android and iOS. Because FFmpeg can be built
# with/without H.264 support, `ffmpeg_branding` has to separately be set to a
# value that includes H.264, for example "Chrome". If FFmpeg is built without
# H.264, compilation succeeds but `H264DecoderImpl` fails to initialize.
# Enable this to build OpenH264 encoder/FFmpeg decoder. When building WebRTC
# as part of Chromium, this is delegated to `media_use_openh264`. When
# building WebRTC as a standalone library, this is supported on all platforms
# except Android and iOS. Because FFmpeg can be built with/without H.264
# support, `ffmpeg_branding` has to separately be set to a value that
# includes H.264, for example "Chrome". If FFmpeg is built without H.264,
# compilation succeeds but `H264DecoderImpl` fails to initialize.
# CHECK THE OPENH264, FFMPEG AND H.264 LICENSES/PATENTS BEFORE BUILDING.
# http://www.openh264.org, https://www.ffmpeg.org/
#
# Enabling H264 when building with MSVC is currently not supported, see
# bugs.webrtc.org/9213#c13 for more info.
rtc_use_h264 =
proprietary_codecs && !is_android && !is_ios && !(is_win && !is_clang)
if (build_with_chromium) {
rtc_use_h264 = media_use_openh264
} else {
rtc_use_h264 =
proprietary_codecs && !is_android && !is_ios && !(is_win && !is_clang)
}
# Use system OpenH264
rtc_system_openh264 = false