Compare commits
10 Commits
3a3ebb512e
...
8f573d6960
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8f573d6960 | ||
|
|
a756a7ad15 | ||
|
|
e90ab59b7c | ||
|
|
358c94f5dd | ||
|
|
21b5db48da | ||
|
|
7dea26d8bb | ||
|
|
cea5e723b5 | ||
|
|
d9dd939d66 | ||
|
|
ad82b6e45b | ||
|
|
b300a9cc05 |
34
DEPS
34
DEPS
@ -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',
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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()) {
|
||||
|
||||
@ -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()) {
|
||||
|
||||
@ -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()) {
|
||||
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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}),
|
||||
|
||||
@ -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 "
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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"
|
||||
}
|
||||
|
||||
@ -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")
|
||||
|
||||
|
||||
@ -1907,6 +1907,7 @@ buckets {
|
||||
' "Win64 Debug (Clang)",'
|
||||
' "Win64 Release (Clang)",'
|
||||
' "iOS API Framework Builder",'
|
||||
' "iOS Debug (simulator)",'
|
||||
' "iOS64 Debug",'
|
||||
' "iOS64 Release"'
|
||||
' ]'
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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": [
|
||||
|
||||
@ -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'
|
||||
}
|
||||
}
|
||||
|
||||
@ -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',
|
||||
}
|
||||
}
|
||||
|
||||
@ -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'
|
||||
],
|
||||
|
||||
@ -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));
|
||||
}
|
||||
|
||||
@ -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());
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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 =
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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_);
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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") {
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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_
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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(
|
||||
|
||||
20
webrtc.gni
20
webrtc.gni
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user