Merge branch 'mutexlox/webrtc-148'

This commit is contained in:
Miriam Zimmerman 2026-05-08 13:50:56 -04:00
commit 376f0ae698
1905 changed files with 28937 additions and 23050 deletions

0
.agents/.style.mdformat Normal file
View File

View File

@ -0,0 +1,72 @@
---
name: gn-check-autofix
description: Automatically fix GN check errors in WebRTC BUILD.gn files. Use when encountering "Include not allowed", "rtc_source_set shall not contain cc files", or when needing to clean up non-absolute dependencies.
---
# GN Check Autofix
This skill provides instructions for using `tools_webrtc/gn_check_autofix.py` to
automatically resolve common GN build configuration errors in WebRTC.
## Core Workflows
### Fix Missing Dependencies
When you see "Include not allowed" errors from `gn gen --check`, use this
workflow:
1. Run the autofix tool on your output directory:
```bash
tools_webrtc/gn_check_autofix.py -C <dir>
```
2. The tool will:
- Identify targets missing dependencies.
- Add the missing `deps` to the appropriate `BUILD.gn` files.
- Automatically run `gn format` on modified files.
### Fix rtc_source_set Violations
If you see "rtc_source_set shall not contain cc files", the tool will
automatically convert them to `rtc_library`:
1. Run the tool:
```bash
tools_webrtc/gn_check_autofix.py -C <dir>
```
### Clean Up Dependencies
To remove all non-absolute dependencies (those not starting with `//`) from
specific `BUILD.gn` files:
```bash
tools_webrtc/gn_check_autofix.py -r path/to/BUILD.gn
```
*Note: This preserves absolute dependencies (starting with `//`) and targets
ending in `_test`, `_tests`, `_unittest`, or `_unittests`.*
## Integration with Include Cleaner
This tool is the recommended second step after running `webrtc-include-cleaner`.
While the include cleaner updates your C++ source files, `gn-check-autofix`
synchronizes your `BUILD.gn` files to match.
## Parameters
- `-C <dir>`: Path to a local build directory (e.g., `out/Default`). The tool
internally runs `gn gen --check --error-limit=20000`.
- `-r <files>`: Remove all non-absolute dependencies from the specified files.
- `--error-limit`: Can be used to override the default error cap.
## Post-Fix Steps
After the tool runs, always verify the changes:
1. **Deduplicate**: The tool may occasionally add a dependency that is already
present. Check the `deps` list for duplicates.
2. **Regenerate GN**: Run `gn gen <dir>` to confirm errors are resolved.
3. **Format**: The tool runs `gn format`, but a final `git cl format` is
recommended for consistency.
4. **Review**: Check the diff to ensure dependencies were added to the correct
targets.

View File

@ -0,0 +1,60 @@
---
name: gtest-parallel
description: Run Google Test binaries in parallel using the gtest-parallel script. Use when needing to speed up test execution, run flaky tests with repeat, or filter specific tests.
---
# gtest-parallel
`gtest-parallel` is a script that executes Google Test binaries in parallel,
providing speedup for single-threaded tests and tests that do not run at 100%
CPU.
## Location
The script is located at `third_party/gtest-parallel/gtest-parallel`.
## Core Flags
### Filtering Tests
Use `--gtest_filter` to run a select set of tests. It supports the same syntax
as Google Test (including exclusion with `-`).
```bash
third_party/gtest-parallel/gtest-parallel path/to/binary --gtest_filter=Foo.*:Bar.*
```
### Timeouts
- `--timeout=TIMEOUT`: Interrupt all remaining processes after the given time
(in seconds).
- `--timeout_per_test=TIMEOUT_PER_TEST`: Interrupt single processes after the
given time (in seconds).
### Output and Logging
- `-d OUTPUT_DIR`, `--output_dir=OUTPUT_DIR`: Output directory for test logs.
Logs will be available under `gtest-parallel-logs/` inside the specified
directory.
- `--dump_json_test_results=DUMP_JSON_TEST_RESULTS`: Saves the results of the
tests as a JSON machine-readable file.
## Advanced Usage
### Repeating Tests (Flakiness Testing)
Use `--repeat=N` to run tests multiple times.
```bash
third_party/gtest-parallel/gtest-parallel path/to/binary --repeat=1000
```
### Workers
Use `-w WORKERS` or `--workers=WORKERS` to specify the number of parallel
workers (defaults to the number of cores).
### Serializing Test Cases
Use `--serialize_test_cases` to run tests within the same test case sequentially
(useful if they share resources).

View File

@ -0,0 +1,67 @@
---
name: webrtc-include-cleaner
description: Runs the WebRTC include-cleaner tool (IWYU replacement) to fix headers in C++ files. Use when preparing a CL for upload, after modifying .cc or .h files, or when instructed to fix include regressions.
---
# WebRTC Include Cleaner
This skill provides instructions for using
`tools_webrtc/iwyu/apply-include-cleaner`, a tool that automatically manages C++
`#include` directives in the WebRTC codebase. It ensures that every header used
is explicitly included and that unused headers are removed.
## When to Use
- **Pre-upload**: Run this tool before uploading a CL to ensure clean includes.
- **After refactoring**: When moving code or changing dependencies, use this to
update `#include` blocks.
- **Fixing regressions**: Use this if a presubmit or bot identifies
include-related issues.
## Basic Usage
To run the include cleaner on specific files:
```bash
tools_webrtc/iwyu/apply-include-cleaner path/to/file.cc path/to/file.h
```
To run it on all modified files relative to the upstream branch (ideal for CL
preparation):
```bash
tools_webrtc/iwyu/apply-include-cleaner
```
Note: This is as expensive as a build for each file, so use it sparingly.
## Options
- `-p`, `--print`: Don't modify the files, just print the proposed changes.
- `-w WORK_DIR`, `--work-dir WORK_DIR`: Specify the GN work directory (default:
`out/Default`).
## Post-Execution Steps
After running the include cleaner, it is recommended to perform the following
steps to ensure build and style consistency:
1. **Check for build errors**: The tool might occasionally make mistakes. Run a
build to verify.
1. **Fix GN dependencies**: Use `tools_webrtc/gn_check_autofix.py` to fix any
`deps` issues caused by include changes.
```bash
tools_webrtc/gn_check_autofix.py -C out/Default
```
1. **Format code**: Run `git cl format` to fix any formatting issues in the
`#include` blocks.
```bash
git cl format
```
## Prerequisites
- The tool automatically generates `compile_commands.json` in the output
directory if `out/Default` exists.
- `clangd` must be checked out in your `.gclient` file
(`"checkout_clangd": True`).

1
.gitignore vendored
View File

@ -34,6 +34,7 @@
.cproject
.gdb_history
.gdbinit
.gemini
.landmines
.metadata
.project

4
.gn
View File

@ -12,8 +12,8 @@ import("//build/dotfile_settings.gni")
buildconfig = "//build/config/BUILDCONFIG.gn"
# The python interpreter to use by default. On Windows, this will look
# for vpython3.exe and vpython3.bat.
script_executable = "vpython3"
# for python3.exe and python3.bat.
script_executable = "python3"
# The secondary source root is a parallel directory tree where
# GN build files are placed when they can not be placed directly

View File

@ -189,6 +189,7 @@ Hopin Ltd. <*@hopin.to>
HyperConnect Inc. <*@hpcnt.com>
Igalia S.L. <*@igalia.com>
Intel Corporation <*@intel.com>
Island Technology, Inc. <*@island.io>
LG Electronics, Inc. <*@lge.com>
Life On Air Inc. <*@lifeonair.com>
LiveKit <*@livekit.io>

View File

@ -132,14 +132,6 @@ config("absl_flags_configs") {
defines = [ "ABSL_FLAGS_STRIP_NAMES=0" ]
}
config("suppress_plan_b_deprecation") {
if (is_clang) {
cflags = [ "-Wno-deprecated-declarations" ]
} else if (is_win && !is_clang) {
cflags = [ "/wd4996" ]
}
}
config("library_impl_config") {
# Build targets that contain WebRTC implementation need this macro to
# be defined in order to correctly export symbols when is_component_build
@ -346,10 +338,6 @@ config("common_config") {
defines += [ "WEBRTC_HAVE_SCTP" ]
}
if (rtc_enable_external_auth) {
defines += [ "ENABLE_EXTERNAL_AUTH" ]
}
if (rtc_use_h264) {
defines += [ "WEBRTC_USE_H264" ]
}
@ -731,7 +719,7 @@ if (rtc_include_tests && !build_with_chromium) {
rtc_executable("benchmarks") {
testonly = true
deps = [
"rtc_base:base64_benchmark_temp",
"rtc_base:base64_benchmark",
"rtc_base/synchronization:mutex_benchmark",
"test:benchmark_main",
]

339
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': 'dbeec2f05bf41e3ef61dbfeb1486aa2fbc4fd7f6',
'chromium_revision': 'a3f5fcb392f2902650ca2b71820e7e418787e18b',
# Fetch the prebuilt binaries for llvm-cov and llvm-profdata. Needed to
# process the raw profiles produced by instrumented targets (built with
@ -50,7 +50,7 @@ vars = {
# reclient CIPD package version
'reclient_version': 're_client_version:0.185.0.db415f21-gomaip',
# siso CIPD package version.
'siso_version': 'git_revision:73b1681189a8d8a4d922cd84246dcec2494142a5',
'siso_version': 'git_revision:87bad442ede1c60700dfabef5862c4a584621734',
# ninja CIPD package.
'ninja_package': 'infra/3pp/tools/ninja/',
@ -79,28 +79,30 @@ deps = {
},
'src/build':
'https://chromium.googlesource.com/chromium/src/build@a37e61dc22fd633ab32146e7000068a57a2864ff',
'https://chromium.googlesource.com/chromium/src/build@dd54dd5186566a13bda647123c22540666b12ace',
'src/buildtools':
'https://chromium.googlesource.com/chromium/src/buildtools@6a18683f555b4ac8b05ac8395c29c84483ac9588',
'https://chromium.googlesource.com/chromium/src/buildtools@95ed44cf5f06dbb5861030b91c9db9ccb4316762',
# 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@6ce374626d5f5e43356fa2cc337a88ced639ef34',
'url': 'https://chromium.googlesource.com/chromium/src/ios@b3b1914b7bd50a64ec13fabaf5e42edcf22e99b8',
'condition': 'checkout_ios',
},
'src/testing':
'https://chromium.googlesource.com/chromium/src/testing@b887106bc278bb2a49e21f3a0ab2019574e7e47a',
'https://chromium.googlesource.com/chromium/src/testing@629b7bb6055714e23d8125bf790cfc8d94a94159',
# RingRTC change for 148 only to pick up crash fix on android
'src/third_party':
'https://chromium.googlesource.com/chromium/src/third_party@e43b96b7a65dd3f45f066983061e6f8b2f3a112d',
'https://chromium.googlesource.com/chromium/src/third_party@4923971b35e39f6bd9be8bc19c4680785a15c80d',
# End RingRTC change
'src/buildtools/linux64': {
'packages': [
{
'package': 'gn/gn/linux-${{arch}}',
'version': 'git_revision:304bbef6c7e9a86630c12986b99c8654eb7fe648',
'version': 'git_revision:b2ac0e7a9089039e62b84d246eca83f84c540f76',
}
],
'dep_type': 'cipd',
@ -110,7 +112,7 @@ deps = {
'packages': [
{
'package': 'gn/gn/mac-${{arch}}',
'version': 'git_revision:304bbef6c7e9a86630c12986b99c8654eb7fe648',
'version': 'git_revision:b2ac0e7a9089039e62b84d246eca83f84c540f76',
}
],
'dep_type': 'cipd',
@ -120,7 +122,7 @@ deps = {
'packages': [
{
'package': 'gn/gn/windows-amd64',
'version': 'git_revision:304bbef6c7e9a86630c12986b99c8654eb7fe648',
'version': 'git_revision:b2ac0e7a9089039e62b84d246eca83f84c540f76',
}
],
'dep_type': 'cipd',
@ -146,157 +148,157 @@ deps = {
'objects': [
{
# The Android libclang_rt.builtins libraries are currently only included in the Linux clang package.
'object_name': 'Linux_x64/clang-llvmorg-23-init-2224-g5bd8dadb-1.tar.xz',
'sha256sum': 'd373cde5b6f1c0da245ebcad93e4883252323c1ff283df96f0eb2e9180f1a537',
'size_bytes': 57692132,
'generation': 1769798229467453,
'object_name': 'Linux_x64/clang-llvmorg-23-init-5669-g8a0be0bc-1.tar.xz',
'sha256sum': '750b331006635281d7d90696629f67db748ba62004c46675eccb8af144141847',
'size_bytes': 58029996,
'generation': 1772218390302503,
'condition': '(host_os == "linux" or checkout_android) and non_git_source',
},
{
'object_name': 'Linux_x64/clang-tidy-llvmorg-23-init-2224-g5bd8dadb-1.tar.xz',
'sha256sum': '334d3f2eaf1abf19a34539faff8d20674ca0654994b330be1e240df3d6f925e8',
'size_bytes': 14414652,
'generation': 1769798229616278,
'object_name': 'Linux_x64/clang-tidy-llvmorg-23-init-5669-g8a0be0bc-1.tar.xz',
'sha256sum': 'd53439bb6ac13c8d2c30c20555ded434039802f70d4119c0138bd77d03552223',
'size_bytes': 14392856,
'generation': 1772218390323510,
'condition': 'host_os == "linux" and checkout_clang_tidy and non_git_source',
},
{
'object_name': 'Linux_x64/clangd-llvmorg-23-init-2224-g5bd8dadb-1.tar.xz',
'sha256sum': '2b439769a7072f488c9c792bbbd7527215d8c0f3791bcedb2233c604e2ac736f',
'size_bytes': 14647728,
'generation': 1769798229728240,
'object_name': 'Linux_x64/clangd-llvmorg-23-init-5669-g8a0be0bc-1.tar.xz',
'sha256sum': 'a24613fb7afce42c076bb95d1b671ac028746b379e88070c126f0aab17a4c34e',
'size_bytes': 14635272,
'generation': 1772218390330947,
'condition': 'host_os == "linux" and checkout_clangd and non_git_source',
},
{
'object_name': 'Linux_x64/llvm-code-coverage-llvmorg-23-init-2224-g5bd8dadb-1.tar.xz',
'sha256sum': '62ecd25bd5d8820fa694c68687b262bd85cce5512e640341eac80648a182a8bf',
'size_bytes': 2325696,
'generation': 1769798229958559,
'object_name': 'Linux_x64/llvm-code-coverage-llvmorg-23-init-5669-g8a0be0bc-1.tar.xz',
'sha256sum': '8dcd816a83361b7924093ccba92dfe6bd29af2cf8af58bf7ce785b38c5027a8b',
'size_bytes': 2328908,
'generation': 1772218390452408,
'condition': 'host_os == "linux" and checkout_clang_coverage_tools and non_git_source',
},
{
'object_name': 'Linux_x64/llvmobjdump-llvmorg-23-init-2224-g5bd8dadb-1.tar.xz',
'sha256sum': '28df84ef25bae64ab82a48295bd09aa6689e436449bd78cdc83f58ef05bfdd6a',
'size_bytes': 5818392,
'generation': 1769798229787736,
'object_name': 'Linux_x64/llvmobjdump-llvmorg-23-init-5669-g8a0be0bc-1.tar.xz',
'sha256sum': '0a15d6b8c2b774b0706618d2afa123b9c87af2ec12e74dc44346df4c4690b670',
'size_bytes': 5780116,
'generation': 1772218390340688,
'condition': '((checkout_linux or checkout_mac or checkout_android) and host_os == "linux") and non_git_source',
},
{
'object_name': 'Mac/clang-llvmorg-23-init-2224-g5bd8dadb-1.tar.xz',
'sha256sum': '0d785b952cdbba91e5ca4c72c8e12d3f9a5cc44fb37d58be87a62bdb3a0b191e',
'size_bytes': 54770836,
'generation': 1769798231469873,
'object_name': 'Mac/clang-llvmorg-23-init-5669-g8a0be0bc-1.tar.xz',
'sha256sum': '2661847eb275079358ab186eaf7f85d6139d44c7413a731dfac7f5ed1ec34a01',
'size_bytes': 54827776,
'generation': 1772218392155773,
'condition': 'host_os == "mac" and host_cpu == "x64"',
},
{
'object_name': 'Mac/clang-mac-runtime-library-llvmorg-23-init-2224-g5bd8dadb-1.tar.xz',
'sha256sum': 'd6f35ab337540994ee942f0300469bc627041b54cd0e8f1942db94da795ab8de',
'size_bytes': 1010540,
'generation': 1769798240394528,
'object_name': 'Mac/clang-mac-runtime-library-llvmorg-23-init-5669-g8a0be0bc-1.tar.xz',
'sha256sum': '69918295c163ec5a20aede81d4100bbd41e01142d32e0555366bba05141f7bf2',
'size_bytes': 1010608,
'generation': 1772218399449599,
'condition': 'checkout_mac and not host_os == "mac"',
},
{
'object_name': 'Mac/clang-tidy-llvmorg-23-init-2224-g5bd8dadb-1.tar.xz',
'sha256sum': '0a89c1cc843537ab4a81b69f03923b8e29778b89c156341a5d589b8742f0c44f',
'size_bytes': 14492308,
'generation': 1769798231635674,
'object_name': 'Mac/clang-tidy-llvmorg-23-init-5669-g8a0be0bc-1.tar.xz',
'sha256sum': 'b8013fe5d2410db4f365ec8779972415d1d0a08042a3a43f823a0da712108cff',
'size_bytes': 14280488,
'generation': 1772218392176137,
'condition': 'host_os == "mac" and host_cpu == "x64" and checkout_clang_tidy',
},
{
'object_name': 'Mac/clangd-llvmorg-23-init-2224-g5bd8dadb-1.tar.xz',
'sha256sum': '768e49e08e0e07d536fea63bcfb7e138409972d8da1493419f438ea39947b50c',
'size_bytes': 16432880,
'generation': 1769798231738122,
'object_name': 'Mac/clangd-llvmorg-23-init-5669-g8a0be0bc-1.tar.xz',
'sha256sum': '508098b26e74bd7f5cdcc40a2ed2db24e2bdde15e0f1c14ce94f685f991b3dd6',
'size_bytes': 15455912,
'generation': 1772218392186146,
'condition': 'host_os == "mac" and host_cpu == "x64" and checkout_clangd',
},
{
'object_name': 'Mac/llvm-code-coverage-llvmorg-23-init-2224-g5bd8dadb-1.tar.xz',
'sha256sum': 'ec463ac915dd97d60715622799bf67b99ad56675917d1d12940c90da0846079a',
'size_bytes': 2358616,
'generation': 1769798231966010,
'object_name': 'Mac/llvm-code-coverage-llvmorg-23-init-5669-g8a0be0bc-1.tar.xz',
'sha256sum': '46c33f13a68fc14005560c01a91215b5cab54c07e920a714264352e46af1350c',
'size_bytes': 2376304,
'generation': 1772218392292978,
'condition': 'host_os == "mac" and host_cpu == "x64" and checkout_clang_coverage_tools',
},
{
'object_name': 'Mac/llvmobjdump-llvmorg-23-init-2224-g5bd8dadb-1.tar.xz',
'sha256sum': '163ff23c49a6980d96bc540bd68fcfe6f2574ff7488446290dea8e378d659392',
'size_bytes': 5693264,
'generation': 1769798231791100,
'object_name': 'Mac/llvmobjdump-llvmorg-23-init-5669-g8a0be0bc-1.tar.xz',
'sha256sum': '6a92e3f21b3a035f406313d24688bb1b312a9a0ec423ff808752b6638104aff3',
'size_bytes': 5699700,
'generation': 1772218392189830,
'condition': 'host_os == "mac" and host_cpu == "x64"',
},
{
'object_name': 'Mac_arm64/clang-llvmorg-23-init-2224-g5bd8dadb-1.tar.xz',
'sha256sum': '45c4c6fa65d92ca1b7dc7e6221589cf7e7f3ae2b22300277150761f670e1b1b0',
'size_bytes': 45722620,
'generation': 1769798241897042,
'object_name': 'Mac_arm64/clang-llvmorg-23-init-5669-g8a0be0bc-1.tar.xz',
'sha256sum': '909be0f896bcf140c710548ccda4673c0aea2480e28d10803c19b1689b36acd5',
'size_bytes': 45847044,
'generation': 1772218401088162,
'condition': 'host_os == "mac" and host_cpu == "arm64"',
},
{
'object_name': 'Mac_arm64/clang-tidy-llvmorg-23-init-2224-g5bd8dadb-1.tar.xz',
'sha256sum': '32439ff7d3f5c6f431f3d543c1a59d0ea3c5f2639c4e77203f51b4e5e5aa6200',
'size_bytes': 12463612,
'generation': 1769798242077766,
'object_name': 'Mac_arm64/clang-tidy-llvmorg-23-init-5669-g8a0be0bc-1.tar.xz',
'sha256sum': '83dc8d90529730ae503e684ea0047a0baec2b0c4a81941d1bb4196feea6ba264',
'size_bytes': 12444972,
'generation': 1772218401143017,
'condition': 'host_os == "mac" and host_cpu == "arm64" and checkout_clang_tidy',
},
{
'object_name': 'Mac_arm64/clangd-llvmorg-23-init-2224-g5bd8dadb-1.tar.xz',
'sha256sum': '4692dabe1495a5055db075b42b1b81511fef14a3d85fd7c374e83d4376d5a31f',
'size_bytes': 12850940,
'generation': 1769798242197514,
'object_name': 'Mac_arm64/clangd-llvmorg-23-init-5669-g8a0be0bc-1.tar.xz',
'sha256sum': '3b7ff06ccd41b0a1fb165e182a35bcd74ae49172f1720cd276eb5feac0e3dd9f',
'size_bytes': 12816980,
'generation': 1772218401144631,
'condition': 'host_os == "mac" and host_cpu == "arm64" and checkout_clangd',
},
{
'object_name': 'Mac_arm64/llvm-code-coverage-llvmorg-23-init-2224-g5bd8dadb-1.tar.xz',
'sha256sum': 'c52db431571b4d55cb7b6452b3c8524f890632d6909a09af93dbd488e0594918',
'size_bytes': 1981792,
'generation': 1769798242410391,
'object_name': 'Mac_arm64/llvm-code-coverage-llvmorg-23-init-5669-g8a0be0bc-1.tar.xz',
'sha256sum': '67148555d00427a3eaa8aeefb8c4c4e1271d585315bdbf0d28d20fd78957e309',
'size_bytes': 1988008,
'generation': 1772218401224240,
'condition': 'host_os == "mac" and host_cpu == "arm64" and checkout_clang_coverage_tools',
},
{
'object_name': 'Mac_arm64/llvmobjdump-llvmorg-23-init-2224-g5bd8dadb-1.tar.xz',
'sha256sum': '0295ceffc9d4208b998ff51b4a7a0a89827a87f83b8ccbcbf6db4f904f8caff0',
'size_bytes': 5432532,
'generation': 1769798242264216,
'object_name': 'Mac_arm64/llvmobjdump-llvmorg-23-init-5669-g8a0be0bc-1.tar.xz',
'sha256sum': 'a31075e7f46ed77c62ecec424722bec8335ef306a4701660f19b713229c49afa',
'size_bytes': 5421552,
'generation': 1772218401116635,
'condition': 'host_os == "mac" and host_cpu == "arm64"',
},
{
'object_name': 'Win/clang-llvmorg-23-init-2224-g5bd8dadb-1.tar.xz',
'sha256sum': '2751f2de8cf1da96916fe124e1d5f6823b3c7810cb0e1436d58f82565a9676d5',
'size_bytes': 48990064,
'generation': 1769798253319534,
'object_name': 'Win/clang-llvmorg-23-init-5669-g8a0be0bc-1.tar.xz',
'sha256sum': 'f2c9d2a8accf7ed2e3c19b3f67fb94e60365411a536fb9d71391dd2d4e7e14bb',
'size_bytes': 49546756,
'generation': 1772218410442709,
'condition': 'host_os == "win"',
},
{
'object_name': 'Win/clang-tidy-llvmorg-23-init-2224-g5bd8dadb-1.tar.xz',
'sha256sum': '2e55b255c435e666804f6d1967f24b6be85f29515f4a8a890631df0139e6d442',
'size_bytes': 14394780,
'generation': 1769798253490087,
'object_name': 'Win/clang-tidy-llvmorg-23-init-5669-g8a0be0bc-1.tar.xz',
'sha256sum': '99e00bbb404557db32df4e7a183ac520c526fe0e143ca380dfb2d0c33a2025b5',
'size_bytes': 14462056,
'generation': 1772218410470169,
'condition': 'host_os == "win" and checkout_clang_tidy',
},
{
'object_name': 'Win/clang-win-runtime-library-llvmorg-23-init-2224-g5bd8dadb-1.tar.xz',
'sha256sum': 'f1d21f63b5839dce9e53d965cca7b7252b39b2a0f13c447f151df01cdc33f1f7',
'size_bytes': 2545304,
'generation': 1769798262175764,
'object_name': 'Win/clang-win-runtime-library-llvmorg-23-init-5669-g8a0be0bc-1.tar.xz',
'sha256sum': '62e9c022223e0fa6ff855c25dcee524818f04c570127ed7e74895b320a10100a',
'size_bytes': 2597584,
'generation': 1772218417651221,
'condition': 'checkout_win and not host_os == "win"',
},
{
'object_name': 'Win/clangd-llvmorg-23-init-2224-g5bd8dadb-1.tar.xz',
'sha256sum': '6568f82ef6d3b8f19fae1e00f8534135edf86f195b0296f150784cc70d2dac93',
'size_bytes': 14793848,
'generation': 1769798253604910,
'object_name': 'Win/clangd-llvmorg-23-init-5669-g8a0be0bc-1.tar.xz',
'sha256sum': '6a3ab3afb8d2e7f4a04eecd8073993586665ede3929308a0fa0119d9382b1e2d',
'size_bytes': 14887416,
'generation': 1772218410483998,
'condition': 'host_os == "win" and checkout_clangd',
},
{
'object_name': 'Win/llvm-code-coverage-llvmorg-23-init-2224-g5bd8dadb-1.tar.xz',
'sha256sum': 'c96bb29efd1b4efae7a33cdc81f1d2d6104f9ad0d971a4c1b340cec6a5821fde',
'size_bytes': 2421196,
'generation': 1769798253771930,
'object_name': 'Win/llvm-code-coverage-llvmorg-23-init-5669-g8a0be0bc-1.tar.xz',
'sha256sum': '4bd610d2fbcc6e2bd8fd2df8d8c23a915373f8c987701d295314e8b33d457075',
'size_bytes': 2479300,
'generation': 1772218410570017,
'condition': 'host_os == "win" and checkout_clang_coverage_tools',
},
{
'object_name': 'Win/llvmobjdump-llvmorg-23-init-2224-g5bd8dadb-1.tar.xz',
'sha256sum': '54d94b4e1560870f94dee78c16c7828f95c185f363321fe605aa286d88104bfd',
'size_bytes': 5798400,
'generation': 1769798253622689,
'object_name': 'Win/llvmobjdump-llvmorg-23-init-5669-g8a0be0bc-1.tar.xz',
'sha256sum': '2ee77b6240b76353840439b38e7009d9f1fb8e97930dbbef3b1ff805ee981c5f',
'size_bytes': 5846184,
'generation': 1772218410487302,
'condition': '(checkout_linux or checkout_mac or checkout_android) and host_os == "win"',
},
]
@ -308,31 +310,31 @@ deps = {
'bucket': 'chromium-browser-clang',
'objects': [
{
'object_name': 'Linux_x64/rust-toolchain-7d8ebe3128fc87f3da1ad64240e63ccf07b8f0bd-3-llvmorg-23-init-2224-g5bd8dadb.tar.xz',
'sha256sum': 'dc8b9057f54cceea940301d0bc8db14565953e9f63b59c4ef0b5e45c14c26a13',
'size_bytes': 266591660,
'generation': 1770147297953244,
'object_name': 'Linux_x64/rust-toolchain-6f54d591c3116ee7f8ce9321ddeca286810cc142-7-llvmorg-23-init-5669-g8a0be0bc.tar.xz',
'sha256sum': 'afbb00d27b8f9f65e6a754fb21e80dff084993285cf7f3c0020dece59c5bd67a',
'size_bytes': 271641712,
'generation': 1773769777991797,
'condition': 'host_os == "linux" and non_git_source',
},
{
'object_name': 'Mac/rust-toolchain-7d8ebe3128fc87f3da1ad64240e63ccf07b8f0bd-3-llvmorg-23-init-2224-g5bd8dadb.tar.xz',
'sha256sum': '89c9d0f5655228059c7b97ca52dc91809b40b664bf5f778ccda1851602da2c36',
'size_bytes': 254144048,
'generation': 1770147299703374,
'object_name': 'Mac/rust-toolchain-6f54d591c3116ee7f8ce9321ddeca286810cc142-7-llvmorg-23-init-5669-g8a0be0bc.tar.xz',
'sha256sum': '70b86e82f1cb55777d40b5828ddcb80afea49510085290424b61251d22e9f959',
'size_bytes': 259443552,
'generation': 1773769780408342,
'condition': 'host_os == "mac" and host_cpu == "x64"',
},
{
'object_name': 'Mac_arm64/rust-toolchain-7d8ebe3128fc87f3da1ad64240e63ccf07b8f0bd-3-llvmorg-23-init-2224-g5bd8dadb.tar.xz',
'sha256sum': '86945a58fd938e54eb21528b37502eaa0d6c9877c76d594d123341df8dc7d018',
'size_bytes': 237685480,
'generation': 1770147301452825,
'object_name': 'Mac_arm64/rust-toolchain-6f54d591c3116ee7f8ce9321ddeca286810cc142-7-llvmorg-23-init-5669-g8a0be0bc.tar.xz',
'sha256sum': 'e2e19684f31b653ce9238f6303aec22576085528c294757a7157d4ab5e1926dc',
'size_bytes': 242768940,
'generation': 1773769782590875,
'condition': 'host_os == "mac" and host_cpu == "arm64"',
},
{
'object_name': 'Win/rust-toolchain-7d8ebe3128fc87f3da1ad64240e63ccf07b8f0bd-3-llvmorg-23-init-2224-g5bd8dadb.tar.xz',
'sha256sum': 'c65ee3f45c289decb58d2ae1863c9db72921518e5b9063c3271b5edbd131d76b',
'size_bytes': 402682036,
'generation': 1770152314303019,
'object_name': 'Win/rust-toolchain-6f54d591c3116ee7f8ce9321ddeca286810cc142-7-llvmorg-23-init-5669-g8a0be0bc.tar.xz',
'sha256sum': '37dd250549fed5a9765c3a88e3487409189e0c9c63b691fc77daa0b5f214bced',
'size_bytes': 409536908,
'generation': 1773769784773096,
'condition': 'host_os == "win"',
},
],
@ -341,15 +343,15 @@ deps = {
'src/third_party/clang-format/script':
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/clang/tools/clang-format.git@c2725e0622e1a86d55f14514f2177a39efea4a0e',
'src/third_party/compiler-rt/src':
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/compiler-rt.git@d606e955eec3d4fb0bf831dea336c3b24cba2f27',
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/compiler-rt.git@bb7645f5e11c9c1d719a890fcb09ccfaaa14580f',
'src/third_party/libc++/src':
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxx.git@7ab65651aed6802d2599dcb7a73b1f82d5179d05',
'src/third_party/libc++abi/src':
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxxabi.git@8f11bb1d4438d0239d0dfc1bd9456a9f31629dda',
'src/third_party/llvm-libc/src':
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libc.git@d99c56d4b9f6663bff528c4fac5313bceb32e762',
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libc.git@adccc443070c58badd6414fd9a4380ca8c78e7c4',
'src/third_party/libunwind/src':
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libunwind.git@ba19d93d6d4f467fba11ff20fe2fc7c056f79345',
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libunwind.git@db838d918570d4e381ecf9f5cc70a0098c9c2cd6',
'src/third_party/test_fonts/test_fonts': {
'dep_type': 'gcs',
@ -412,7 +414,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_build_tools/aapt2',
'version': 's6POXpUalcnuPehDsORiojCpgbNXT4LYq7DVUYgsfxEC',
'version': 'gsaUgZUqoyD0XG1E9-xesSWknHZINEuS00iSEncvlE0C',
},
],
'condition': 'checkout_android',
@ -445,7 +447,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_build_tools/error_prone',
'version': 'zUmV9Nh4JfIOMh9QU7LhIhPvodo_Aka-0IAIPIcLKVcC',
'version': 'ax2FOQ16-lz2R1o1P-xDhd2KOAFoY1wjZ-lQgZkygUYC',
},
],
'condition': 'checkout_android',
@ -467,7 +469,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_build_tools/lint',
'version': 'Ow8jpaRkHsJyhElyBOWWKBWl0KKNNuqbAE-cYWSPwQAC',
'version': 'lBgjWB8NdI2Mhnsy0SHkCyCZ3pbO1Qe4Zk0JZHs3yAIC',
},
],
'condition': 'checkout_android and non_git_source',
@ -498,11 +500,11 @@ deps = {
},
'src/third_party/boringssl/src':
'https://boringssl.googlesource.com/boringssl.git@305bcfce00b189f2297f53365b0454f96009927d',
'https://boringssl.googlesource.com/boringssl.git@8dce4fd20ab7e768c0a5103edc1d8cb7e54366ba',
'src/third_party/breakpad/breakpad':
'https://chromium.googlesource.com/breakpad/breakpad.git@79099fdf668ae097c9eca7052fd5c4c5de6c9098',
'https://chromium.googlesource.com/breakpad/breakpad.git@8be0e3114685fcc1589561067282edf75ea1259a',
'src/third_party/catapult':
'https://chromium.googlesource.com/catapult.git@39805a224bb6c6e80e403a4ebe9a150c7ca0b4d1',
'https://chromium.googlesource.com/catapult.git@5a34891efa6e41c8aca8842386b8ee528963ffdf',
'src/third_party/ced/src': {
'url': 'https://chromium.googlesource.com/external/github.com/google/compact_enc_det.git@ba412eaaacd3186085babcd901679a48863c7dd5',
},
@ -515,13 +517,13 @@ 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@9fd48a305e18b9bbaf61734557ce2c46497192b3',
'https://chromium.googlesource.com/chromium/tools/depot_tools.git@ce1ebad2c35c9387186f01d77edeea28a254c955',
'src/third_party/ffmpeg':
'https://chromium.googlesource.com/chromium/third_party/ffmpeg.git@9e588ab02e16326026aa61cc3b6515da20520cec',
'https://chromium.googlesource.com/chromium/third_party/ffmpeg.git@b5e18fb9da84e26ceef30d4e4886696bf59337c0',
'src/third_party/flatbuffers/src':
'https://chromium.googlesource.com/external/github.com/google/flatbuffers.git@a86afae9399bbe631d1ea0783f8816e780e236cc',
'src/third_party/grpc/src': {
'url': 'https://chromium.googlesource.com/external/github.com/grpc/grpc.git@f394c3f07b4c685b9f6948b36d65ca10a629f4fa',
'url': 'https://chromium.googlesource.com/external/github.com/grpc/grpc.git@5e9fb9cbfb12a10ff9c16fbc360328d224b838d6',
},
# Used for embedded builds. CrOS & Linux use the system version.
'src/third_party/fontconfig/src': {
@ -529,14 +531,14 @@ deps = {
'condition': 'checkout_linux',
},
'src/third_party/freetype/src':
'https://chromium.googlesource.com/chromium/src/third_party/freetype2.git@e3a0652b6d706ee1ce77d4dda606b6597dd8b5c4',
'https://chromium.googlesource.com/chromium/src/third_party/freetype2.git@99b479dc34728936b006679a31e12b8cf432fc55',
'src/third_party/harfbuzz-ng/src':
'https://chromium.googlesource.com/external/github.com/harfbuzz/harfbuzz.git@fa2908bf16d2ccd6623f4d575455fea72a1a722b',
'https://chromium.googlesource.com/external/github.com/harfbuzz/harfbuzz.git@6f4c5cec306d31e6822303f5ba248a14293d588e',
'src/third_party/google_benchmark/src': {
'url': 'https://chromium.googlesource.com/external/github.com/google/benchmark.git@188e8278990a9069ffc84441cb5a024fd0bede37',
},
'src/third_party/libpfm4/src':
Var('chromium_git') + '/external/git.code.sf.net/p/perfmon2/libpfm4.git' + '@' + '964baf9d35d5f88d8422f96d8a82c672042e7064',
Var('chromium_git') + '/external/git.code.sf.net/p/perfmon2/libpfm4.git' + '@' + '41878eab48c50bb9ec5f741a013e971bb5a9dff2',
# WebRTC-only dependency (not present in Chromium).
'src/third_party/gtest-parallel':
'https://chromium.googlesource.com/external/github.com/google/gtest-parallel@cd488bdedc1d2cffb98201a17afc1b298b0b90f1',
@ -547,7 +549,7 @@ deps = {
'src/third_party/googletest/src':
'https://chromium.googlesource.com/external/github.com/google/googletest.git@4fe3307fb2d9f86d19777c7eb0e4809e9694dde7',
'src/third_party/icu': {
'url': 'https://chromium.googlesource.com/chromium/deps/icu.git@a86a32e67b8d1384b33f8fa48c83a6079b86f8cd',
'url': 'https://chromium.googlesource.com/chromium/deps/icu.git@b4aae6832c06df9d538d41b249403cf0678f16b4',
},
'src/third_party/jdk/current': {
'packages': [
@ -583,7 +585,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/kotlin_stdlib',
'version': 'eZzGGvckJ-abo5lKKVxignwQeuPMQcgDp6p5ITnnI-kC',
'version': 'uq9bdsIxS9Is_mAZr9OWBymcLtxheKkgzeUSLuZKhJUC',
},
],
'condition': 'checkout_android',
@ -594,7 +596,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/kotlinc',
'version': 'f-d0mg_APXr9lbudXU46Wlvt0hnZpuViqvhw3MGhTHwC',
'version': 'RcyJsRii1TkItQ8HjsvzQnXGvIZ0FJvpF4bxYeFr7qAC',
},
],
'condition': 'checkout_android',
@ -603,29 +605,29 @@ deps = {
'src/third_party/libFuzzer/src':
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/compiler-rt/lib/fuzzer.git@bea408a6e01f0f7e6c82a43121fe3af4506c932e',
'src/third_party/fuzztest/src':
'https://chromium.googlesource.com/external/github.com/google/fuzztest.git@54dfec04d5c9ad1f22b08002ab6a5e2d0de77671',
'https://chromium.googlesource.com/external/github.com/google/fuzztest.git@dc327134097700121e4ecd6e1d54d1d0a832a18d',
'src/third_party/libjpeg_turbo':
'https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git@6bb85251a8382b5e07f635a981ac685cc5ab5053',
'https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git@d1f5f2393e0d51f840207342ae86e55a86443288',
'src/third_party/libsrtp':
'https://chromium.googlesource.com/chromium/deps/libsrtp.git@a52756acb1c5e133089c798736dd171567df11f5',
'https://chromium.googlesource.com/chromium/deps/libsrtp.git@e8383771af8aa4096f5bcfe3743a5ea128f88a9a',
'src/third_party/dav1d/libdav1d':
'https://chromium.googlesource.com/external/github.com/videolan/dav1d.git@b546257f770768b2c88258c533da38b91a06f737',
'https://chromium.googlesource.com/external/github.com/videolan/dav1d.git@d69235dd804b24c04ed05639cffcc912cd6cfd75',
'src/third_party/libaom/source/libaom':
'https://aomedia.googlesource.com/aom.git@557586fde2fdc09dff9c3edf6943d6d54aa8914c',
'https://aomedia.googlesource.com/aom.git@f3dddebddd0dba76fbfb97b96b6336bcf1d3a30c',
'src/third_party/libgav1/src':
Var('chromium_git') + '/codecs/libgav1.git' + '@' + '40f58ed32ff39071c3f2a51056dbc49a070af0dc',
'src/third_party/libunwindstack': {
'url': 'https://chromium.googlesource.com/chromium/src/third_party/libunwindstack.git@0928ad0d25e4af07c8be5ab06d0ca584f9f4ceb5',
'url': 'https://chromium.googlesource.com/chromium/src/third_party/libunwindstack.git@333fcafb91bd3830c5ef814c071ff73df9cdc976',
'condition': 'checkout_android',
},
'src/third_party/perfetto':
Var('chromium_git') + '/external/github.com/google/perfetto.git' + '@' + '2074b65d22dd04b65c2688647b9386a63338f0b9',
Var('chromium_git') + '/external/github.com/google/perfetto.git' + '@' + '40b1342aa7bd47d9c963c3617fd98ec1551528f9',
'src/third_party/protobuf-javascript/src':
Var('chromium_git') + '/external/github.com/protocolbuffers/protobuf-javascript' + '@' + 'e6d763860001ba1a76a63adcff5efb12b1c96024',
'src/third_party/libvpx/source/libvpx':
'https://chromium.googlesource.com/webm/libvpx.git@e83e25f791932202256479052f18bdd03a091147',
'https://chromium.googlesource.com/webm/libvpx.git@3fce57ecc905d95a4619f33d09851d68c5a88663',
'src/third_party/libyuv':
'https://chromium.googlesource.com/libyuv/libyuv.git@917276084a49be726c90292ff0a6b0a3d571a6af',
'https://chromium.googlesource.com/libyuv/libyuv.git@30809ff64a9ca5e45f86439c0d474c2d3eef3d05',
'src/third_party/lss': {
'url': 'https://chromium.googlesource.com/linux-syscall-support.git@29164a80da4d41134950d76d55199ea33fbb9613',
'condition': 'checkout_android or checkout_linux',
@ -641,7 +643,7 @@ deps = {
# Used by boringssl.
'src/third_party/nasm': {
'url': 'https://chromium.googlesource.com/chromium/deps/nasm.git@af5eeeb054bebadfbb79c7bcd100a95e2ad4525f'
'url': 'https://chromium.googlesource.com/chromium/deps/nasm.git@45252858722aad12e545819b2d0f370eb865431b'
},
'src/third_party/openh264/src':
@ -654,7 +656,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/r8',
'version': 'kCLXGwoL10sgeyycuTLyDhesWICC0DSVfVf-a6U6_yUC',
'version': '8ZRb6CCpZTU5dSpQyDlbusalGCjWV0sVSGTq_0Js3mcC',
},
],
'condition': 'checkout_android',
@ -667,7 +669,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/r8',
'version': 'a4fVqbIycCDqs1714SLRqxEdz6P-sH-z1QT_eeeF0PcC',
'version': '8ZRb6CCpZTU5dSpQyDlbusalGCjWV0sVSGTq_0Js3mcC',
},
],
'condition': 'checkout_android',
@ -678,7 +680,7 @@ deps = {
'condition': 'checkout_android',
},
'src/tools':
'https://chromium.googlesource.com/chromium/src/tools@f8f65faf07b1132c9d01932ef95846e9a82b8d54',
'https://chromium.googlesource.com/chromium/src/tools@f363a79871a91f36322e845e3134e2f04e1fc18a',
'src/third_party/espresso': {
'packages': [
@ -717,7 +719,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/androidx',
'version': 'dJ3xGQgP3gjT2n9aXf2sj4QdckdRZXrVhhrlsHQg8QQC',
'version': 'xbJffE4gDOA4g5njwbpWZtgk4ouGMWOHiqq2ymCZ2ggC',
},
],
'condition': 'checkout_android and non_git_source',
@ -728,7 +730,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_build_tools/manifest_merger',
'version': 'YgbGvXYO4RiQ7zH0QiMCxe_f9hE2k9JW8lUOKTkYC70C',
'version': '5JSVccMXNkpeH9lpydgxJ3QCoNpBC5yvil7NvdsqUasC',
},
],
'condition': 'checkout_android',
@ -796,13 +798,13 @@ deps = {
},
'src/third_party/tflite/src':
Var('chromium_git') + '/external/github.com/tensorflow/tensorflow.git' + '@' + '01e030d23d3b904d98cbf908da74d63b3c186949',
Var('chromium_git') + '/external/github.com/tensorflow/tensorflow.git' + '@' + '8fd527849069a358ad6c2980b9a9b34a53c53717',
'src/third_party/turbine/cipd': {
'packages': [
{
'package': 'chromium/third_party/turbine',
'version': 'j49Y1F_PAMGZdDf53rGaEzVXdT6jXWDhEm7UMfGhjswC',
'version': '0A4lFRLjqycR4-EvoBz1w2FxPEzzG94cFvwu8v39DRYC',
},
],
'condition': 'checkout_android',
@ -810,7 +812,7 @@ deps = {
},
'src/third_party/zstd/src': {
'url': Var('chromium_git') + '/external/github.com/facebook/zstd.git' + '@' + '1168da0e567960d50cba1b58c9b0ba047ece4733',
'url': Var('chromium_git') + '/external/github.com/facebook/zstd.git' + '@' + '3ae099b48dfcfe02b1b3ba81ab85457f8a922e9f',
'condition': 'checkout_android',
},
@ -818,15 +820,15 @@ deps = {
'packages': [
{
'package': 'infra/tools/luci/cas/${{platform}}',
'version': 'git_revision:072101cbfec3372b812ff510df8547d7b4187bea',
'version': 'git_revision:8cb5bd940d5f726f8a538212b2287987fcadf837',
},
{
'package': 'infra/tools/luci/isolate/${{platform}}',
'version': 'git_revision:072101cbfec3372b812ff510df8547d7b4187bea',
'version': 'git_revision:8cb5bd940d5f726f8a538212b2287987fcadf837',
},
{
'package': 'infra/tools/luci/swarming/${{platform}}',
'version': 'git_revision:072101cbfec3372b812ff510df8547d7b4187bea',
'version': 'git_revision:8cb5bd940d5f726f8a538212b2287987fcadf837',
}
],
'dep_type': 'cipd',
@ -852,7 +854,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/autorolled',
'version': 'LStkoCV2NKgZ1hqhnILaH4soxZtZa2-8RG67-JxAVUsC',
'version': 'ioujkn6x8xwFvfYkiQGrRb9lX4Khn3Thhv3nsoN6lrQC',
},
],
'condition': 'checkout_android and non_git_source',
@ -862,19 +864,19 @@ deps = {
Var('chromium_git') + '/external/github.com/google/pthreadpool.git' + '@' + '9003ee6c137cea3b94161bd5c614fb43be523ee1',
'src/third_party/xnnpack/src':
Var('chromium_git') + '/external/github.com/google/XNNPACK.git' + '@' + '4574c4d9b00703c15f2218634ddf101597b22b18',
Var('chromium_git') + '/external/github.com/google/XNNPACK.git' + '@' + '97f3177fd836fff03b48a886bb130591866ad7ca',
'src/third_party/farmhash/src':
Var('chromium_git') + '/external/github.com/google/farmhash.git' + '@' + '816a4ae622e964763ca0862d9dbd19324a1eaf45',
'src/third_party/ruy/src':
Var('chromium_git') + '/external/github.com/google/ruy.git' + '@' + '576e020f06334118994496b45f9796ed7fda3280',
Var('chromium_git') + '/external/github.com/google/ruy.git' + '@' + '2af88863614a8298689cc52b1a47b3fcad7be835',
'src/third_party/cpuinfo/src':
Var('chromium_git') + '/external/github.com/pytorch/cpuinfo.git' + '@' + '84818a41e074779dbb00521a4731d3e14160ff15',
Var('chromium_git') + '/external/github.com/pytorch/cpuinfo.git' + '@' + '7607ca500436b37ad23fb8d18614bec7796b68a7',
'src/third_party/eigen3/src':
Var('chromium_git') + '/external/gitlab.com/libeigen/eigen.git' + '@' + 'afb43805349cf1cbec0083d94256bb8f72cbc53b',
Var('chromium_git') + '/external/gitlab.com/libeigen/eigen.git' + '@' + '002229ce470065878afb7c2f6f96d22c9a9b7ba0',
'src/third_party/fp16/src':
Var('chromium_git') + '/external/github.com/Maratyszcza/FP16.git' + '@' + '3d2de1816307bac63c16a297e8c4dc501b4076df',
@ -1024,17 +1026,6 @@ deps = {
'dep_type': 'cipd',
},
'src/third_party/android_deps/cipd/libs/org_jetbrains_kotlinx_kotlinx_coroutines_guava': {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/org_jetbrains_kotlinx_kotlinx_coroutines_guava',
'version': 'version:2@1.8.1.cr2',
},
],
'condition': 'checkout_android and non_git_source',
'dep_type': 'cipd',
},
'src/third_party/android_deps/cipd/libs/org_jsoup_jsoup': {
'packages': [
{
@ -1166,7 +1157,6 @@ hooks = [
'action': [ 'python3',
'src/third_party/depot_tools/download_from_google_storage.py',
'--no_resume',
'--no_auth',
'--bucket', 'chromium-browser-clang/ciopfs',
'-s', 'src/build/ciopfs.sha1',
]
@ -1222,7 +1212,6 @@ hooks = [
'action': [ 'python3',
'src/third_party/depot_tools/download_from_google_storage.py',
'--no_resume',
'--no_auth',
'--bucket', 'chromium-browser-clang',
'-s', 'src/tools/clang/dsymutil/bin/dsymutil.arm64.sha1',
'-o', 'src/tools/clang/dsymutil/bin/dsymutil',
@ -1235,7 +1224,6 @@ hooks = [
'action': [ 'python3',
'src/third_party/depot_tools/download_from_google_storage.py',
'--no_resume',
'--no_auth',
'--bucket', 'chromium-browser-clang',
'-s', 'src/tools/clang/dsymutil/bin/dsymutil.x64.sha1',
'-o', 'src/tools/clang/dsymutil/bin/dsymutil',
@ -1249,7 +1237,6 @@ hooks = [
'action': [ 'python3',
'src/third_party/depot_tools/download_from_google_storage.py',
'--no_resume',
'--no_auth',
'--bucket', 'chromium-browser-clang/rc',
'-s', 'src/build/toolchain/win/rc/win/rc.exe.sha1',
],
@ -1261,7 +1248,6 @@ hooks = [
'action': [ 'python3',
'src/third_party/depot_tools/download_from_google_storage.py',
'--no_resume',
'--no_auth',
'--bucket', 'chromium-browser-clang/rc',
'-s', 'src/build/toolchain/win/rc/mac/rc.sha1',
],
@ -1273,7 +1259,6 @@ hooks = [
'action': [ 'python3',
'src/third_party/depot_tools/download_from_google_storage.py',
'--no_resume',
'--no_auth',
'--bucket', 'chromium-browser-clang/rc',
'-s', 'src/build/toolchain/win/rc/linux64/rc.sha1',
],
@ -1285,7 +1270,6 @@ hooks = [
'--directory',
'--recursive',
'--num_threads=10',
'--no_auth',
'--quiet',
'--bucket', 'chromium-webrtc-resources',
'src/resources'],
@ -1403,6 +1387,7 @@ include_rules = [
"+absl/cleanup/cleanup.h",
"+absl/container",
"-absl/container/fixed_array.h",
"+absl/crc",
"+absl/functional/any_invocable.h",
"+absl/functional/bind_front.h",
"+absl/memory/memory.h",
@ -1424,7 +1409,7 @@ include_rules = [
]
specific_include_rules = {
"webrtc_lib_link_test\.cc": [
"webrtc_lib_link_test\\.cc": [
"+media/engine",
"+modules/audio_device",
"+modules/audio_processing",

View File

@ -1,20 +1,21 @@
#Owners for infra and repo related files
# Owners for infra and repo related files
per-file .gitignore=*
per-file AUTHORS=*
per-file DEPS=*
per-file WATCHLISTS=*
per-file whitespace.txt=*
per-file .gn=mbonadei@webrtc.org,jansson@webrtc.org,jleconte@webrtc.org
per-file BUILD.gn=mbonadei@webrtc.org,jansson@webrtc.org,jleconte@webrtc.org
per-file .../BUILD.gn=mbonadei@webrtc.org,jansson@webrtc.org,jleconte@webrtc.org
per-file *.gni=mbonadei@webrtc.org,jansson@webrtc.org,jleconte@webrtc.org
per-file .../*.gni=mbonadei@webrtc.org,jansson@webrtc.org,jleconte@webrtc.org
per-file .vpython=mbonadei@webrtc.org,jansson@webrtc.org,jleconte@webrtc.org
per-file .vpython3=mbonadei@webrtc.org,jansson@webrtc.org,jleconte@webrtc.org
per-file AUTHORS=*
per-file DEPS=*
per-file pylintrc=mbonadei@webrtc.org,jansson@webrtc.org,jleconte@webrtc.org
per-file .rustfmt.toml=boivie@webrtc.org,mbonadei@webrtc.org,jleconte@webrtc.org
per-file pylintrc_old_style=mbonadei@webrtc.org,jansson@webrtc.org,jleconte@webrtc.org
per-file WATCHLISTS=*
per-file whitespace.txt=*
per-file native-api.md=mbonadei@webrtc.org
per-file ....lua=titovartem@webrtc.org
per-file .style.yapf=jleconte@webrtc.org
per-file *.py=mbonadei@webrtc.org,jansson@webrtc.org,jleconte@webrtc.org
per-file .rustfmt.toml=boivie@webrtc.org,mbonadei@webrtc.org,jleconte@webrtc.org

View File

@ -662,6 +662,23 @@ def CheckGnGen(input_api, output_api):
return []
def CheckDeps(input_api, output_api):
"""Runs checkdeps """
repo_root = input_api.change.RepositoryRoot()
checkdeps_path = input_api.os_path.join(repo_root, 'buildtools',
'checkdeps')
with _AddToPath(checkdeps_path):
import checkdeps
deps_checker = checkdeps.DepsChecker(input_api.PresubmitLocalPath())
deps_checker.CheckDirectory(input_api.PresubmitLocalPath())
results = []
if deps_checker.results_formatter.GetResults():
results.append(
output_api.PresubmitError('\n'.join(
deps_checker.results_formatter.GetResults())))
return results
def CheckUnwantedDependencies(input_api, output_api, source_file_filter):
"""Runs checkdeps on #include statements added in this
change. Breaking - rules is an error, breaking ! rules is a
@ -815,10 +832,7 @@ def RunPythonTests(input_api, output_api):
'process_perf_results_test.py',
]
test_directories = [
input_api.PresubmitLocalPath(),
Join('rtc_tools', 'py_event_log_analyzer'),
] + [
test_directories = [input_api.PresubmitLocalPath()] + [
root for root, _, files in os.walk(Join('tools_webrtc')) if any(
f.endswith('_test.py') and f not in excluded_files for f in files)
]
@ -1000,6 +1014,7 @@ def CommonChecks(input_api, output_api):
results.extend(
input_api.canned_checks.CheckPatchFormatted(input_api, output_api))
results.extend(CheckNativeApiHeaderChanges(input_api, output_api))
results.extend(CheckDeps(input_api, output_api))
results.extend(
CheckNoIOStreamInHeaders(input_api,
output_api,

View File

@ -6,6 +6,7 @@ License: BSD-3-Clause
License File: LICENSE
Shipped: yes
Security Critical: yes
Update Mechanism: Manual
Mitigated: CVE-2022-2294
CVE-2022-2294: Fixed by https://crbug.com/40060120.

View File

@ -102,76 +102,41 @@
'WATCHLISTS': {
'this_file': [],
'all_webrtc': [],
'root_files': ['peah@webrtc.org',
'qiang.lu@intel.com',
'yujie.mao@webrtc.org'],
'root_files': ['peah@webrtc.org'],
'build_files': ['mbonadei@webrtc.org'],
'common_audio': ['alessiob@webrtc.org',
'audio-team@agora.io',
'peah@webrtc.org',
'common_audio': ['peah@webrtc.org',
'saza@webrtc.org'],
'audio': ['peah@webrtc.org'],
'api': ['hta@webrtc.org',
'peah@webrtc.org'],
'base': ['hta@webrtc.org'],
'call': ['mflodman@webrtc.org',
'stefan@webrtc.org'],
'video': ['mflodman@webrtc.org',
'stefan@webrtc.org',
'video-team@agora.io',
'yujie.mao@webrtc.org',
'zhengzhonghou@agora.io'],
'video_capture': ['mflodman@webrtc.org',
'perkj@webrtc.org',
'sdk-team@agora.io',
'zhengzhonghou@agora.io'],
'audio_device': ['audio-team@agora.io',
'henrika@webrtc.org',
'peah@webrtc.org',
'saza@webrtc.org',
'sdk-team@agora.io'],
'audio_coding': ['alessiob@webrtc.org',
'audio-team@agora.io',
'henrik.lundin@webrtc.org',
'call': ['stefan@webrtc.org'],
'video': ['stefan@webrtc.org'],
'video_capture': ['perkj@webrtc.org'],
'audio_device': ['henrika@webrtc.org',
'peah@webrtc.org',
'saza@webrtc.org'],
'neteq': ['alessiob@webrtc.org',
'audio-team@agora.io',
'henrik.lundin@webrtc.org',
'audio_coding': ['henrik.lundin@webrtc.org',
'peah@webrtc.org',
'saza@webrtc.org'],
'neteq': ['henrik.lundin@webrtc.org',
'saza@webrtc.org'],
'audio_mixer': ['aleloi@webrtc.org',
'henrik.lundin@webrtc.org',
'audio_mixer': ['henrik.lundin@webrtc.org',
'peah@webrtc.org',
'saza@webrtc.org'],
'audio_processing': ['alessiob@webrtc.org',
'audio-team@agora.io',
'henrik.lundin@webrtc.org',
'audio_processing': ['henrik.lundin@webrtc.org',
'peah@webrtc.org',
'saza@webrtc.org'],
'video_coding': ['mflodman@webrtc.org',
'stefan@webrtc.org',
'video-team@agora.io',
'zhengzhonghou@agora.io'],
'bitrate_controller': ['mflodman@webrtc.org',
'stefan@webrtc.org',
'zhuangzesen@agora.io'],
'video_coding': ['stefan@webrtc.org'],
'bitrate_controller': ['stefan@webrtc.org'],
'congestion_controller': [],
'remote_bitrate_estimator': ['mflodman@webrtc.org',
'stefan@webrtc.org',
'zhuangzesen@agora.io'],
'pacing': ['mflodman@webrtc.org',
'stefan@webrtc.org',
'zhuangzesen@agora.io'],
'rtp_rtcp': ['mflodman@webrtc.org',
'stefan@webrtc.org',
'danilchap@webrtc.org',
'zhuangzesen@agora.io'],
'system_wrappers': ['fengyue@agora.io',
'henrika@webrtc.org',
'mflodman@webrtc.org',
'peah@webrtc.org',
'zhengzhonghou@agora.io'],
'pc': ['steveanton+watch@webrtc.org'],
'remote_bitrate_estimator': ['stefan@webrtc.org'],
'pacing': ['stefan@webrtc.org'],
'rtp_rtcp': ['stefan@webrtc.org',
'danilchap@webrtc.org'],
'system_wrappers': ['henrika@webrtc.org',
'peah@webrtc.org'],
'pc': [],
'logging': ['terelius@webrtc.org'],
},
}

View File

@ -26,7 +26,6 @@ rtc_library("enable_media") {
deps = [
":peer_connection_interface",
":scoped_refptr",
"../call",
"../call:call_interfaces",
"../media:media_engine",
"../media:rtc_audio_video",
@ -76,7 +75,6 @@ rtc_library("create_modular_peer_connection_factory") {
"../pc:peer_connection_factory_proxy",
"../rtc_base:threading",
"../rtc_base/system:rtc_export",
"../stats:rtc_stats",
]
}
@ -126,7 +124,6 @@ rtc_library("rtp_headers") {
"rtp_headers.h",
]
deps = [
":array_view",
"../rtc_base:checks",
"../rtc_base/system:rtc_export",
"units:timestamp",
@ -142,11 +139,11 @@ rtc_library("rtp_packet_info") {
"rtp_packet_infos.h",
]
deps = [
":array_view",
":make_ref_counted",
":refcountedbase",
":rtp_headers",
":scoped_refptr",
"../modules/rtp_rtcp:rtp_rtcp_format",
"../rtc_base/system:rtc_export",
"units:time_delta",
"units:timestamp",
@ -168,7 +165,6 @@ rtc_library("media_stream_interface") {
]
deps = [
":audio_options_api",
":make_ref_counted",
":ref_count",
":rtp_parameters",
":scoped_refptr",
@ -199,7 +195,6 @@ rtc_library("candidate") {
"../rtc_base:crc32",
"../rtc_base:crypto_random",
"../rtc_base:ip_address",
"../rtc_base:logging",
"../rtc_base:net_helper",
"../rtc_base:network_constants",
"../rtc_base:socket_address",
@ -227,9 +222,7 @@ rtc_source_set("ice_transport_interface") {
deps = [
":async_dns_resolver",
":local_network_access_permission",
":packet_socket_factory",
":ref_count",
":rtc_error",
":scoped_refptr",
"environment",
"rtc_event_log",
@ -265,9 +258,31 @@ rtc_library("dtmf_sender_interface") {
visibility = [ "*" ]
sources = [ "dtmf_sender_interface.h" ]
deps = [ ":ref_count" ]
}
rtc_library("sframe_types") {
visibility = [ "*" ]
sources = [ "sframe/sframe_types.h" ]
}
rtc_library("sframe_encrypter_interface") {
visibility = [ "*" ]
sources = [ "sframe/sframe_encrypter_interface.h" ]
deps = [
":media_stream_interface",
":ref_count",
":rtc_error",
":sframe_types",
]
}
rtc_library("sframe_decrypter_interface") {
visibility = [ "*" ]
sources = [ "sframe/sframe_decrypter_interface.h" ]
deps = [
":ref_count",
":rtc_error",
":sframe_types",
]
}
@ -287,6 +302,7 @@ rtc_library("rtp_sender_interface") {
":rtc_error",
":rtp_parameters",
":scoped_refptr",
":sframe_encrypter_interface",
"../rtc_base:checks",
"../rtc_base/system:rtc_export",
"crypto:frame_encryptor_interface",
@ -328,6 +344,7 @@ rtc_library("jsep") {
]
deps = [
":candidate",
":payload_type",
":ref_count",
":rtc_error",
":rtp_parameters",
@ -370,6 +387,7 @@ rtc_library("jsep") {
}
rtc_library("data_channel_interface") {
visibility = [ "*" ]
sources = [
"data_channel_interface.cc",
"data_channel_interface.h",
@ -386,6 +404,7 @@ rtc_library("data_channel_interface") {
}
rtc_library("legacy_stats_types") {
visibility = [ "*" ]
sources = [
"legacy_stats_types.cc",
"legacy_stats_types.h",
@ -404,6 +423,7 @@ rtc_library("legacy_stats_types") {
}
rtc_library("peer_connection_interface") {
visibility = [ "*" ]
sources = [
"peer_connection_interface.cc",
"peer_connection_interface.h",
@ -478,6 +498,7 @@ rtc_library("peer_connection_interface") {
}
rtc_library("rtp_receiver_interface") {
visibility = [ "*" ]
sources = [
"rtp_receiver_interface.cc",
"rtp_receiver_interface.h",
@ -487,8 +508,12 @@ rtc_library("rtp_receiver_interface") {
":frame_transformer_interface",
":media_stream_interface",
":ref_count",
":rtc_error",
":rtp_parameters",
":scoped_refptr",
":sframe_decrypter_interface",
":sframe_types",
"../rtc_base:checks",
"../rtc_base/system:rtc_export",
"crypto:frame_decryptor_interface",
"transport/rtp:rtp_source",
@ -496,12 +521,12 @@ rtc_library("rtp_receiver_interface") {
}
rtc_library("rtp_transceiver_interface") {
visibility = [ "*" ]
sources = [
"rtp_transceiver_interface.cc",
"rtp_transceiver_interface.h",
]
deps = [
":array_view",
":ref_count",
":rtc_error",
":rtp_parameters",
@ -516,6 +541,7 @@ rtc_library("rtp_transceiver_interface") {
}
rtc_library("set_local_description_observer_interface") {
visibility = [ "*" ]
sources = [ "set_local_description_observer_interface.h" ]
deps = [
":ref_count",
@ -524,6 +550,7 @@ rtc_library("set_local_description_observer_interface") {
}
rtc_library("set_remote_description_observer_interface") {
visibility = [ "*" ]
sources = [ "set_remote_description_observer_interface.h" ]
deps = [
":ref_count",
@ -532,19 +559,16 @@ rtc_library("set_remote_description_observer_interface") {
}
rtc_library("uma_metrics") {
visibility = [ "*" ]
sources = [ "uma_metrics.h" ]
deps = [
":ref_count",
":rtc_error",
]
deps = []
}
rtc_library("video_track_source_proxy_factory") {
visibility = [ "*" ]
sources = [ "video_track_source_proxy_factory.h" ]
deps = [
":media_stream_interface",
":ref_count",
":rtc_error",
":scoped_refptr",
"../rtc_base:threading",
"../rtc_base/system:rtc_export",
@ -573,53 +597,38 @@ rtc_library("libjingle_peerconnection_api") {
"video_track_source_proxy_factory.h", # Used downstream
]
deps = [
":array_view",
":async_dns_resolver",
":audio_options_api",
":candidate",
":data_channel_event_observer_interface",
":data_channel_interface",
":dtls_transport_interface",
":dtmf_sender_interface",
":fec_controller_api",
":field_trials_view",
":frame_transformer_interface",
":ice_transport_interface",
":jsep",
":legacy_stats_types",
":libjingle_logging_api",
":local_network_access_permission",
":make_ref_counted",
":media_stream_interface",
":network_state_predictor_api",
":packet_socket_factory",
":peer_connection_interface",
":priority",
":ref_count",
":rtc_error",
":rtc_stats_api",
":rtp_packet_info",
":rtp_parameters",
":rtp_receiver_interface",
":rtp_sender_interface",
":rtp_transceiver_direction",
":rtp_transceiver_interface",
":rtp_transport_factory",
":scoped_refptr",
":sctp_transport_interface",
":sequence_checker",
":set_local_description_observer_interface",
":sframe_decrypter_interface",
":sframe_encrypter_interface",
":sframe_types",
":turn_customizer",
"../call:rtp_interfaces",
"../media:media_engine",
"../p2p:connection",
"../p2p:dtls_transport_factory",
"../p2p:port",
"../p2p:port_allocator",
"../pc:media_factory",
"../pc:session_description",
"../rtc_base:copy_on_write_buffer",
"../rtc_base:logging",
"../rtc_base:macromagic",
"../rtc_base:network",
"../rtc_base:network_constants",
@ -627,7 +636,6 @@ rtc_library("libjingle_peerconnection_api") {
"../rtc_base:socket_factory",
"../rtc_base:ssl",
"../rtc_base:ssl_adapter",
"../rtc_base:stringutils",
"../rtc_base/system:no_unique_address",
"../rtc_base/system:plan_b_only",
"adaptation:resource_adaptation_api",
@ -643,20 +651,14 @@ rtc_library("libjingle_peerconnection_api") {
"metronome",
"neteq:neteq_api",
"rtc_event_log:rtc_event_log_factory_interface",
"task_queue",
"transport:bandwidth_estimation_settings",
"transport:bitrate_settings",
"transport:enums",
"transport:network_control",
"transport:sctp_transport_factory_interface",
"transport/rtp:rtp_source",
"units:data_rate",
"units:time_delta",
"units:timestamp",
"video:encoded_image",
"video:video_bitrate_allocator_factory",
"video:video_frame",
"video:video_rtp_headers",
"video_codecs:video_codecs_api",
"//third_party/abseil-cpp/absl/algorithm:container",
"//third_party/abseil-cpp/absl/base:core_headers",
@ -670,10 +672,10 @@ rtc_library("libjingle_peerconnection_api") {
# Basically, don't add stuff here. You might break sensitive downstream
# targets like pnacl. API should not depend on anything outside of this
# file, really. All these should arguably go away in time.
"../media:rtc_media_config",
"../rtc_base:checks",
"../rtc_base:threading",
"../rtc_base/system:rtc_export",
"../media:rtc_media_config", # keep
"../rtc_base:checks", # keep
"../rtc_base:threading", # keep
"../rtc_base/system:rtc_export", # keep
]
}
@ -684,16 +686,12 @@ rtc_library("frame_transformer_interface") {
"frame_transformer_interface.h",
]
deps = [
":array_view",
":make_ref_counted",
":ref_count",
":scoped_refptr",
"../rtc_base:checks",
"../rtc_base:refcount",
"../rtc_base/system:rtc_export",
"units:time_delta",
"units:timestamp",
"video:encoded_frame",
"video:video_frame_metadata",
]
}
@ -744,7 +742,6 @@ rtc_source_set("async_dns_resolver") {
visibility = [ "*" ]
sources = [ "async_dns_resolver.h" ]
deps = [
"../rtc_base:checks",
"../rtc_base:socket_address",
"../rtc_base/system:rtc_export",
"//third_party/abseil-cpp/absl/functional:any_invocable",
@ -755,9 +752,7 @@ rtc_source_set("local_network_access_permission") {
visibility = [ "*" ]
sources = [ "local_network_access_permission.h" ]
deps = [
"../rtc_base:checks",
"../rtc_base:socket_address",
"../rtc_base/system:rtc_export",
"//third_party/abseil-cpp/absl/functional:any_invocable",
]
}
@ -790,14 +785,12 @@ rtc_source_set("video_quality_analyzer_api") {
sources = [ "test/video_quality_analyzer_interface.h" ]
deps = [
":array_view",
":rtc_stats_api",
":scoped_refptr",
":stats_observer_interface",
"../rtc_base:checks",
"video:encoded_image",
"video:video_frame",
"video:video_rtp_headers",
"video_codecs:video_codecs_api",
"//third_party/abseil-cpp/absl/strings:string_view",
]
@ -814,6 +807,15 @@ rtc_source_set("rtp_transceiver_direction") {
sources = [ "rtp_transceiver_direction.h" ]
}
rtc_source_set("payload_type") {
visibility = [ "*" ]
sources = [ "payload_type.h" ]
deps = [
"../rtc_base:strong_alias",
"//third_party/abseil-cpp/absl/strings:str_format",
]
}
rtc_library("priority") {
visibility = [ "*" ]
sources = [
@ -836,7 +838,6 @@ rtc_library("rtp_parameters") {
"rtp_parameters.h",
]
deps = [
":array_view",
":priority",
":rtc_error",
":rtp_transceiver_direction",
@ -906,39 +907,11 @@ rtc_source_set("peer_connection_quality_test_fixture_api") {
sources = [ "test/peerconnection_quality_test_fixture.h" ]
deps = [
":array_view",
":audio_quality_analyzer_api",
":fec_controller_api",
":frame_generator_api",
":function_view",
":media_stream_interface",
":network_state_predictor_api",
":packet_socket_factory",
":rtp_parameters",
":simulated_network_api",
":stats_observer_interface",
":track_id_stream_info_map",
":video_quality_analyzer_api",
"../media:media_constants",
"../rtc_base:checks",
"../rtc_base:network",
"../rtc_base:rtc_certificate_generator",
"../rtc_base:ssl",
"../rtc_base:stringutils",
"../rtc_base:threading",
"../test:fileutils",
"audio:audio_mixer_api",
"audio:audio_processing",
"rtc_event_log",
"task_queue",
"test/pclf:media_configuration",
"test/pclf:media_quality_test_params",
"test/pclf:peer_configurer",
"test/video:video_frame_writer",
"transport:network_control",
"units:time_delta",
"video:video_frame",
"video_codecs:video_codecs_api",
"//third_party/abseil-cpp/absl/base:core_headers",
"//third_party/abseil-cpp/absl/memory",
"//third_party/abseil-cpp/absl/strings:string_view",
@ -986,10 +959,6 @@ if (rtc_include_tests) {
":network_state_predictor_api",
":rtp_parameters",
":simulated_network_api",
"../call:fake_network",
"../call:rtp_interfaces",
"../test:test_common",
"../test:video_test_common",
"../video/config:encoder_config",
"transport:bitrate_settings",
"transport:network_control",
@ -1044,7 +1013,6 @@ rtc_library("create_frame_generator") {
"../system_wrappers",
"../test:frame_generator_impl",
"environment",
"environment:environment_factory",
"//third_party/abseil-cpp/absl/base:nullability",
"//third_party/abseil-cpp/absl/strings:string_view",
]
@ -1071,10 +1039,7 @@ rtc_library("create_peer_connection_quality_test_frame_generator") {
rtc_source_set("data_channel_event_observer_interface") {
visibility = [ "*" ]
sources = [ "data_channel_event_observer_interface.h" ]
deps = [
":array_view",
"//third_party/abseil-cpp/absl/strings:string_view",
]
deps = [ "//third_party/abseil-cpp/absl/strings:string_view" ]
}
rtc_source_set("libjingle_logging_api") {
@ -1112,12 +1077,10 @@ rtc_source_set("rtc_stats_api") {
]
deps = [
":make_ref_counted",
":ref_count",
":refcountedbase",
":scoped_refptr",
"../api:refcountedbase",
"../rtc_base:checks",
"../rtc_base:refcount",
"../rtc_base/system:rtc_export",
"units:timestamp",
]
@ -1131,7 +1094,6 @@ rtc_library("audio_options_api") {
]
deps = [
":array_view",
"../rtc_base:stringutils",
"../rtc_base/system:rtc_export",
]
@ -1143,11 +1105,7 @@ rtc_library("transport_api") {
"call/transport.cc",
"call/transport.h",
]
deps = [
":array_view",
":refcountedbase",
":scoped_refptr",
]
deps = []
}
rtc_source_set("bitrate_allocation") {
@ -1164,7 +1122,6 @@ rtc_source_set("simulated_network_api") {
visibility = [ "*" ]
sources = [ "test/simulated_network.h" ]
deps = [
"../rtc_base:random",
"transport:ecn_marking",
"units:data_rate",
"units:data_size",
@ -1181,15 +1138,12 @@ rtc_library("network_emulation_manager_api") {
"test/network_emulation_manager.h",
]
deps = [
":array_view",
":field_trials_view",
":packet_socket_factory",
":peer_network_dependencies",
":simulated_network_api",
":time_controller",
"../rtc_base:checks",
"../rtc_base:ip_address",
"../rtc_base:network",
"../rtc_base:network_constants",
"../rtc_base:socket_address",
"../test/network:simulated_network",
@ -1212,11 +1166,9 @@ rtc_library("time_controller") {
":function_view",
"../rtc_base:socket_server",
"../rtc_base:threading",
"../rtc_base/synchronization:yield_policy",
"../system_wrappers",
"task_queue",
"units:time_delta",
"units:timestamp",
"//third_party/abseil-cpp/absl/strings:string_view",
]
}
@ -1244,11 +1196,6 @@ rtc_source_set("network_state_predictor_api") {
rtc_source_set("array_view") {
visibility = [ "*" ]
sources = [ "array_view.h" ]
deps = [
"../rtc_base:checks",
"../rtc_base:type_traits",
"//third_party/abseil-cpp/absl/base:core_headers",
]
}
rtc_source_set("refcountedbase") {
@ -1269,18 +1216,13 @@ rtc_library("ice_transport_factory") {
deps = [
":ice_transport_interface",
":make_ref_counted",
":packet_socket_factory",
":scoped_refptr",
":sequence_checker",
"../p2p:connection",
"../p2p:ice_transport_internal",
"../p2p:p2p_constants",
"../p2p:p2p_transport_channel",
"../p2p:port_allocator",
"../rtc_base:macromagic",
"../rtc_base:threading",
"../rtc_base/system:rtc_export",
"rtc_event_log",
]
}
@ -1314,13 +1256,10 @@ rtc_library("datagram_connection") {
visibility = [ "*" ]
sources = [ "datagram_connection.h" ]
deps = [
":array_view",
":candidate",
":ref_count",
"../p2p:transport_description",
"../rtc_base:macromagic",
"../rtc_base/system:rtc_export",
"environment",
"units:timestamp",
"//third_party/abseil-cpp/absl/functional:any_invocable",
"//third_party/abseil-cpp/absl/strings:string_view",
@ -1336,11 +1275,9 @@ rtc_library("datagram_connection_factory") {
deps = [
":datagram_connection",
":make_ref_counted",
":ref_count",
":scoped_refptr",
"../p2p:port_allocator",
"../pc:datagram_connection_internal",
"../rtc_base:macromagic",
"../rtc_base:ssl",
"../rtc_base/system:rtc_export",
"environment",
@ -1359,8 +1296,6 @@ if (rtc_include_tests) {
]
deps = [
":scoped_refptr",
"../modules/audio_processing",
"../modules/audio_processing:audioproc_f_impl",
"audio:audio_processing",
"audio:builtin_audio_processing_builder",
@ -1378,7 +1313,6 @@ if (rtc_include_tests) {
deps = [
":neteq_simulator_api",
"../modules/audio_coding:neteq_test_factory",
"../rtc_base:checks",
"neteq:neteq_api",
"//third_party/abseil-cpp/absl/flags:flag",
"//third_party/abseil-cpp/absl/flags:parse",
@ -1415,9 +1349,9 @@ if (rtc_include_tests) {
"test/videocodec_test_stats.h",
]
deps = [
"../api/units:data_rate",
"../api/units:frequency",
"../rtc_base:stringutils",
"units:data_rate",
"units:frequency",
"video:video_frame_type",
]
}
@ -1430,7 +1364,6 @@ if (rtc_include_tests) {
":field_trials",
":videocodec_test_stats_api",
"../modules/video_coding:codec_globals_headers",
"../modules/video_coding:video_codec_interface",
"video:encoded_image",
"video:video_frame",
"video_codecs:video_codecs_api",
@ -1446,7 +1379,6 @@ if (rtc_include_tests) {
]
deps = [
":videocodec_test_fixture_api",
"../modules/video_coding:video_codecs_test_framework",
"../modules/video_coding:videocodec_test_impl",
"video_codecs:video_codecs_api",
]
@ -1470,7 +1402,7 @@ if (rtc_include_tests) {
sources = [ "test/mock_audio_sink.h" ]
deps = [
"../api:media_stream_interface",
":media_stream_interface",
"../test:test_support",
]
}
@ -1520,10 +1452,7 @@ if (rtc_include_tests) {
testonly = true
sources = [ "test/mock_frame_encryptor.h" ]
deps = [
":array_view",
":rtp_parameters",
# For api/crypto/frame_encryptor_interface.h
"../test:test_support",
"crypto:frame_encryptor_interface",
]
@ -1534,7 +1463,6 @@ if (rtc_include_tests) {
testonly = true
sources = [ "test/mock_frame_decryptor.h" ]
deps = [
":array_view",
":rtp_parameters",
"../test:test_support",
"crypto:frame_decryptor_interface",
@ -1557,10 +1485,10 @@ if (rtc_include_tests) {
testonly = true
sources = [ "test/mock_encoder_selector.h" ]
deps = [
"../api/video_codecs:video_codecs_api",
"../test:test_support",
"units:data_rate",
"video:render_resolution",
"video_codecs:video_codecs_api",
]
}
@ -1572,9 +1500,6 @@ if (rtc_include_tests) {
"test/fake_frame_encryptor.h",
]
deps = [
":array_view",
":make_ref_counted",
":ref_count",
":rtp_parameters",
"../rtc_base:checks",
"../rtc_base:refcount",
@ -1590,8 +1515,6 @@ if (rtc_include_tests) {
"test/fake_frame_decryptor.h",
]
deps = [
":array_view",
":make_ref_counted",
":rtp_parameters",
"../rtc_base:checks",
"crypto:frame_decryptor_interface",
@ -1633,7 +1556,6 @@ if (rtc_include_tests) {
sources = [ "test/mock_peerconnectioninterface.h" ]
deps = [
":candidate",
":data_channel_event_observer_interface",
":data_channel_interface",
":dtls_transport_interface",
@ -1642,24 +1564,21 @@ if (rtc_include_tests) {
":make_ref_counted",
":media_stream_interface",
":peer_connection_interface",
":ref_count",
":rtc_error",
":rtc_stats_api",
":rtp_parameters",
":rtp_receiver_interface",
":rtp_sender_interface",
":rtp_transceiver_interface",
":scoped_refptr",
":sctp_transport_interface",
":set_local_description_observer_interface",
":set_remote_description_observer_interface",
"../api:scoped_refptr",
"../rtc_base:refcount",
"../rtc_base:threading",
"../test:test_support",
"adaptation:resource_adaptation_api",
"transport:bandwidth_estimation_settings",
"transport:bitrate_settings",
"transport:network_control",
]
}
@ -1686,7 +1605,6 @@ if (rtc_include_tests) {
testonly = true
sources = [ "test/mock_transformable_frame.h" ]
deps = [
":array_view",
":frame_transformer_interface",
"../test:test_support",
"units:time_delta",
@ -1732,7 +1650,6 @@ if (rtc_include_tests) {
]
deps = [
":array_view",
":dtls_transport_interface",
":dtmf_sender_interface",
":frame_transformer_interface",
@ -1745,9 +1662,9 @@ if (rtc_include_tests) {
":rtp_transceiver_direction",
":rtp_transceiver_interface",
":scoped_refptr",
"../api/crypto:frame_decryptor_interface",
"../rtc_base:refcount",
"../test:test_support",
"crypto:frame_decryptor_interface",
"crypto:frame_encryptor_interface",
"transport/rtp:rtp_source",
"video_codecs:video_codecs_api",
@ -1760,11 +1677,10 @@ if (rtc_include_tests) {
sources = [ "test/mock_transformable_audio_frame.h" ]
deps = [
":array_view",
":frame_transformer_interface",
"../api/units:timestamp",
"../test:test_support",
"units:time_delta",
"units:timestamp",
]
}
@ -1774,7 +1690,6 @@ if (rtc_include_tests) {
sources = [ "test/mock_transformable_video_frame.h" ]
deps = [
":array_view",
":frame_transformer_interface",
"../test:test_support",
"units:time_delta",
@ -1789,9 +1704,9 @@ if (rtc_include_tests) {
sources = [ "test/mock_video_bitrate_allocator.h" ]
deps = [
"../api/video:video_bitrate_allocator",
"../test:test_support",
"video:video_bitrate_allocation",
"video:video_bitrate_allocator",
]
}
@ -1801,10 +1716,10 @@ if (rtc_include_tests) {
sources = [ "test/mock_video_bitrate_allocator_factory.h" ]
deps = [
"../api/video:video_bitrate_allocator_factory",
"../test:test_support",
"environment",
"video:video_bitrate_allocator",
"video:video_bitrate_allocator_factory",
"video_codecs:video_codecs_api",
]
}
@ -1818,9 +1733,9 @@ if (rtc_include_tests) {
]
deps = [
"../api/video_codecs:video_codecs_api",
"../test:test_support",
"environment",
"video_codecs:video_codecs_api",
]
}
@ -1830,10 +1745,10 @@ if (rtc_include_tests) {
sources = [ "test/mock_video_decoder.h" ]
deps = [
"../api/video_codecs:video_codecs_api",
"../test:test_support",
"video:encoded_image",
"video:video_frame",
"video_codecs:video_codecs_api",
]
}
@ -1844,11 +1759,11 @@ if (rtc_include_tests) {
deps = [
":fec_controller_api",
"../api/video_codecs:video_codecs_api",
"../test:test_support",
"video:encoded_image",
"video:video_frame",
"video:video_frame_type",
"video_codecs:video_codecs_api",
]
}
@ -1858,9 +1773,8 @@ if (rtc_include_tests) {
sources = [ "test/mock_video_track.h" ]
deps = [
":ref_count",
"../api:media_stream_interface",
"../api:scoped_refptr",
":media_stream_interface",
":scoped_refptr",
"../rtc_base:refcount",
"../test:test_support",
"video:video_frame",
@ -1872,7 +1786,6 @@ if (rtc_include_tests) {
testonly = true
sources = [ "test/mock_datagram_connection.h" ]
deps = [
":array_view",
":candidate",
":datagram_connection",
"../p2p:transport_description",
@ -1887,7 +1800,6 @@ if (rtc_include_tests) {
testonly = true
sources = [ "test/mock_datagram_connection_observer.h" ]
deps = [
":array_view",
":candidate",
":datagram_connection",
"//test:test_support",
@ -1951,6 +1863,7 @@ if (rtc_include_tests) {
"../media:media_constants",
"../media:rid_description",
"../media:stream_params",
"../modules/rtp_rtcp:rtp_rtcp_format",
"../p2p:p2p_constants",
"../p2p:transport_description",
"../p2p:transport_info",
@ -2024,11 +1937,9 @@ if (rtc_include_tests) {
":mock_frame_decryptor",
":mock_frame_encryptor",
":mock_media_stream_interface",
":mock_packet_socket_factory",
":mock_peer_connection_factory_interface",
":mock_peerconnectioninterface",
":mock_rtp",
":mock_transformable_audio_frame",
":mock_transformable_frame",
":mock_transformable_video_frame",
":mock_video_bitrate_allocator",
@ -2051,7 +1962,7 @@ rtc_library("field_trials_registry") {
]
deps = [
":field_trials_view",
"../experiments:registered_field_trials",
"../experiments:registered_field_trials", # keep
"../rtc_base:checks",
"../rtc_base:logging",
"../rtc_base/containers:flat_set",
@ -2102,14 +2013,10 @@ rtc_library("frame_transformer_factory") {
]
deps = [
":frame_transformer_interface",
":ref_count",
":scoped_refptr",
"../audio",
"../modules/rtp_rtcp",
"../rtc_base:checks",
"../rtc_base/system:rtc_export",
"video:encoded_frame",
"video:video_frame_metadata",
]
}

113
api/DEPS
View File

@ -1,6 +1,7 @@
# This is supposed to be a complete list of top-level directories,
# excepting only api/ itself.
include_rules = [
"-.agents",
"-agents",
"-audio",
"-base",
@ -45,105 +46,110 @@ include_rules = [
specific_include_rules = {
# Some internal headers are allowed even in API headers:
".*\.h": [
".*\\.h": [
"+rtc_base/checks.h",
"+rtc_base/system/rtc_export.h",
"+rtc_base/system/rtc_export_template.h",
"+rtc_base/units/unit_base.h",
],
"array_view\.h": [
"array_view\\.h": [
"+rtc_base/type_traits.h",
],
# Needed because AudioEncoderOpus is in the wrong place for
# backwards compatibilty reasons. See
# https://bugs.chromium.org/p/webrtc/issues/detail?id=7847
"audio_encoder_opus\.h": [
"audio_encoder_opus\\.h": [
"+modules/audio_coding/codecs/opus/audio_encoder_opus.h",
],
"async_resolver_factory\.h": [
"async_resolver_factory\\.h": [
"+rtc_base/async_resolver_interface.h",
],
"async_dns_resolver\.h": [
"async_dns_resolver\\.h": [
"+rtc_base/socket_address.h",
],
"audio_device_defines\.h": [
"audio_device_defines\\.h": [
"+rtc_base/strings/string_builder.h",
],
"audio_format\.h": [
"audio_format\\.h": [
"+rtc_base/strings/string_builder.h",
],
"candidate\.h": [
"candidate\\.h": [
"+rtc_base/network_constants.h",
"+rtc_base/socket_address.h",
],
"create_peerconnection_factory\.h": [
"create_peerconnection_factory\\.h": [
"+rtc_base/thread.h",
],
"data_channel_interface\.h": [
"data_channel_interface\\.h": [
"+rtc_base/copy_on_write_buffer.h",
],
"data_channel_transport_interface\.h": [
"data_channel_transport_interface\\.h": [
"+rtc_base/copy_on_write_buffer.h",
],
"datagram_connection\.h": [
"datagram_connection\\.h": [
"+p2p/base/transport_description.h",
],
"mock_datagram_connection\.h": [
"mock_datagram_connection\\.h": [
"+p2p/base/transport_description.h",
],
"datagram_connection_factory\.h": [
"datagram_connection_factory\\.h": [
"+p2p/base/port_allocator.h",
"+rtc_base/rtc_certificate.h",
],
"dtls_transport_interface\.h": [
"dtls_transport_interface\\.h": [
"+rtc_base/ssl_certificate.h",
],
"fec_controller\.h": [
"fec_controller\\.h": [
"+modules/include/module_fec_types.h",
],
"ice_server_parsing\.h": [
"ice_server_parsing\\.h": [
"+p2p/base/port_allocator.h",
"+rtc_base/socket_address.h",
],
"jsep\.h": [
"jsep\\.h": [
"+absl/strings/has_absl_stringify.h",
"+absl/strings/str_format.h",
"+rtc_base/system/no_unique_address.h",
"+rtc_base/thread_annotations.h",
],
"local_network_access_permission\.h": [
"local_network_access_permission\\.h": [
"+rtc_base/socket_address.h",
],
"packet_socket_factory\.h": [
"packet_socket_factory\\.h": [
"+rtc_base/async_packet_socket.h",
"+rtc_base/socket_address.h",
"+rtc_base/ssl_certificate.h",
],
"turn_customizer\.h": [
"payload_type\\.h": [
"+absl/strings/str_format.h",
"+rtc_base/strong_alias.h",
],
"turn_customizer\\.h": [
"+p2p/base/port_interface.h",
],
"peer_connection_interface\.h": [
"peer_connection_interface\\.h": [
"+media/base/media_config.h",
"+media/base/media_engine.h",
"+p2p/base/port.h",
@ -162,23 +168,23 @@ specific_include_rules = {
"+rtc_base/thread.h",
],
"proxy\.h": [
"proxy\\.h": [
"+rtc_base/event.h",
"+rtc_base/message_handler.h", # Inherits from it.
"+rtc_base/thread.h",
],
"ref_counted_base\.h": [
"ref_counted_base\\.h": [
"+rtc_base/ref_counter.h",
],
"rtc_error\.h": [
"rtc_error\\.h": [
"+rtc_base/logging.h",
"+rtc_base/strings/string_builder.h",
"+absl/strings/has_absl_stringify.h",
"+absl/strings/str_format.h",
],
"rtc_event_log_output_file.h": [
"rtc_event_log_output_file\\.h": [
# For private member and constructor.
"+rtc_base/system/file_wrapper.h",
],
@ -186,104 +192,109 @@ specific_include_rules = {
"+rtc_base/ref_counted_object.h",
],
"legacy_stats_types\.h": [
"legacy_stats_types\\.h": [
"+rtc_base/thread_annotations.h",
"+rtc_base/thread_checker.h",
],
"audio_decoder\.h": [
"audio_decoder\\.h": [
"+rtc_base/buffer.h",
],
"audio_encoder\.h": [
"audio_encoder\\.h": [
"+rtc_base/buffer.h",
],
"make_ref_counted\.h": [
"make_ref_counted\\.h": [
"+rtc_base/ref_counted_object.h",
],
"mock.*\.h": [
"mock.*\\.h": [
"+test/gmock.h",
],
"mock_peerconnectioninterface\.h": [
"mock_peerconnectioninterface\\.h": [
"+rtc_base/ref_counted_object.h",
],
"mock_video_track\.h": [
"mock_video_track\\.h": [
"+rtc_base/ref_counted_object.h",
],
"notifier\.h": [
"notifier\\.h": [
"+rtc_base/system/no_unique_address.h",
"+rtc_base/thread_annotations.h",
],
"priority\.h": [
"priority\\.h": [
"+rtc_base/strong_alias.h",
],
"sctp_transport_interface\.h": [
"sctp_transport_interface\\.h": [
"+absl/strings/str_format.h",
],
"simulated_network\.h": [
"simulated_network\\.h": [
"+rtc_base/random.h",
"+rtc_base/thread_annotations.h",
],
"time_controller\.h": [
"time_controller\\.h": [
"+rtc_base/thread.h",
],
"videocodec_test_fixture\.h": [
"videocodec_test_fixture\\.h": [
"+modules/video_coding/include/video_codec_interface.h"
],
"rtp_parameters\.h": [
"rtp_parameters\\.h": [
"+absl/strings/str_format.h",
"+rtc_base/strings/str_join.h"
],
"sequence_checker\.h": [
"sequence_checker\\.h": [
"+rtc_base/synchronization/sequence_checker_internal.h",
"+rtc_base/thread_annotations.h",
],
"video_encoder_factory_template.*\.h": [
"video_encoder_factory_template.*\\.h": [
"+modules/video_coding",
],
"video_encoder_factory_interface\.h": [
"video_encoder_factory_interface\\.h": [
"+rtc_base/numerics",
],
"video_encoder_interface\.h": [
"video_encoder_interface\\.h": [
"+rtc_base/numerics",
],
"simple_encoder_wrapper\.h": [
"video_quality_test_fixture\\.h": [
"+video/config/video_encoder_config.h",
],
"simple_encoder_wrapper\\.h": [
"+common_video",
"+modules",
],
"video_decoder_factory_template.*\.h": [
"video_decoder_factory_template.*\\.h": [
"+modules/video_coding",
],
"field_trials\.h": [
"field_trials\\.h": [
"+rtc_base/containers/flat_map.h",
],
"video_track_source_proxy_factory.h": [
"video_track_source_proxy_factory\\.h": [
"+rtc_base/thread.h",
],
"field_trials_registry\.h": [
"field_trials_registry\\.h": [
"+rtc_base/containers/flat_set.h",
],
"ice_transport_factory\.h": [
"ice_transport_factory\\.h": [
"+p2p/base/port_allocator.h",
],
@ -291,7 +302,7 @@ specific_include_rules = {
# so we re-add all the top-level directories here. (That's because .h
# files leak their #includes to whoever's #including them, but .cc files
# do not since no one #includes them.)
".*\.cc": [
".*\\.cc": [
"+audio",
"+call",
"+common_audio",

View File

@ -1,5 +1,4 @@
hta@webrtc.org
magjed@webrtc.org
perkj@webrtc.org
tommi@webrtc.org
@ -7,6 +6,8 @@ tommi@webrtc.org
deadbeef@webrtc.org
per-file peer_connection*=hbos@webrtc.org
per-file peer_connection*=eshr@webrtc.org
per-file peer_connection*=guidou@webrtc.org
per-file DEPS=mbonadei@webrtc.org
@ -16,6 +17,7 @@ per-file uma_metrics.h=kron@webrtc.org
per-file webrtc_sdp.cc = set noparent
per-file webrtc_sdp.cc = hta@webrtc.org
per-file webrtc_sdp.cc = hbos@webrtc.org
per-file webrtc_sdp.cc = eshr@webrtc.org
# If none of the above are present, may also try one of these
per-file webrtc_sdp.cc = tommi@webrtc.org
per-file webrtc_sdp.cc = guidou@webrtc.org

View File

@ -11,347 +11,20 @@
#ifndef API_ARRAY_VIEW_H_
#define API_ARRAY_VIEW_H_
#include <algorithm>
#include <array>
#include <cstddef>
#include <iterator>
#include <span>
#include <type_traits>
#include "absl/base/macros.h"
#include "rtc_base/checks.h"
#include "rtc_base/type_traits.h"
namespace webrtc {
// tl;dr: ArrayView is the same thing as gsl::span from the Guideline
// Support Library.
//
// Many functions read from or write to arrays. The obvious way to do this is
// to use two arguments, a pointer to the first element and an element count:
//
// bool Contains17(const int* arr, size_t size) {
// for (size_t i = 0; i < size; ++i) {
// if (arr[i] == 17)
// return true;
// }
// return false;
// }
//
// This is flexible, since it doesn't matter how the array is stored (C array,
// std::vector, Buffer, ...), but it's error-prone because the caller
// has to correctly specify the array length:
//
// Contains17(arr, std::size(arr)); // C array
// Contains17(arr.data(), arr.size()); // std::vector
// Contains17(arr, size); // pointer + size
// ...
//
// It's also kind of messy to have two separate arguments for what is
// conceptually a single thing.
//
// Enter ArrayView<T>. It contains a T pointer (to an array it doesn't
// own) and a count, and supports the basic things you'd expect, such as
// indexing and iteration. It allows us to write our function like this:
//
// bool Contains17(ArrayView<const int> arr) {
// for (auto e : arr) {
// if (e == 17)
// return true;
// }
// return false;
// }
//
// And even better, because a bunch of things will implicitly convert to
// ArrayView, we can call it like this:
//
// Contains17(arr); // C array
// Contains17(arr); // std::vector
// Contains17(ArrayView<int>(arr, size)); // pointer + size
// Contains17(nullptr); // nullptr -> empty ArrayView
// ...
//
// ArrayView<T> stores both a pointer and a size, but you may also use
// ArrayView<T, N>, which has a size that's fixed at compile time (which means
// it only has to store the pointer).
//
// One important point is that ArrayView<T> and ArrayView<const T> are
// different types, which allow and don't allow mutation of the array elements,
// respectively. The implicit conversions work just like you'd hope, so that
// e.g. vector<int> will convert to either ArrayView<int> or ArrayView<const
// int>, but const vector<int> will convert only to ArrayView<const int>.
// (ArrayView itself can be the source type in such conversions, so
// ArrayView<int> will convert to ArrayView<const int>.)
//
// Note: ArrayView is tiny (just a pointer and a count if variable-sized, just
// a pointer if fix-sized) and trivially copyable, so it's probably cheaper to
// pass it by value than by const reference.
namespace array_view_internal {
// Magic constant for indicating that the size of an ArrayView is variable
// instead of fixed.
enum : std::ptrdiff_t { kArrayViewVarSize = -4711 };
// Base class for ArrayViews of fixed nonzero size.
template <typename T, std::ptrdiff_t Size>
class ArrayViewBase {
static_assert(Size > 0, "ArrayView size must be variable or non-negative");
public:
ArrayViewBase(T* data, size_t /* size */) : data_(data) {}
static constexpr size_t size() { return Size; }
static constexpr bool empty() { return false; }
T* data() const { return data_; }
protected:
static constexpr bool fixed_size() { return true; }
private:
T* data_;
};
// Specialized base class for ArrayViews of fixed zero size.
template <typename T>
class ArrayViewBase<T, 0> {
public:
explicit ArrayViewBase(T* /* data */, size_t /* size */) {}
static constexpr size_t size() { return 0; }
static constexpr bool empty() { return true; }
T* data() const { return nullptr; }
protected:
static constexpr bool fixed_size() { return true; }
};
// Specialized base class for ArrayViews of variable size.
template <typename T>
class ArrayViewBase<T, array_view_internal::kArrayViewVarSize> {
public:
ArrayViewBase(T* data, size_t size)
: data_(size == 0 ? nullptr : data), size_(size) {}
constexpr size_t size() const { return size_; }
constexpr bool empty() const { return size_ == 0; }
T* data() const { return data_; }
protected:
static constexpr bool fixed_size() { return false; }
private:
T* data_;
size_t size_;
};
} // namespace array_view_internal
template <typename T,
std::ptrdiff_t Size = array_view_internal::kArrayViewVarSize>
class ArrayView final : public array_view_internal::ArrayViewBase<T, Size> {
public:
using value_type = T;
using reference = value_type&;
using const_reference = const value_type&;
using pointer = value_type*;
using const_pointer = const value_type*;
using const_iterator = const T*;
// Construct an ArrayView from a pointer and a length.
template <typename U>
ArrayView(U* data, size_t size)
: array_view_internal::ArrayViewBase<T, Size>::ArrayViewBase(data, size) {
RTC_DCHECK_EQ(size == 0 ? nullptr : data, this->data());
RTC_DCHECK_EQ(size, this->size());
RTC_DCHECK_EQ(!this->data(),
this->size() == 0); // data is null iff size == 0.
}
// Construct an empty ArrayView. Note that fixed-size ArrayViews of size > 0
// cannot be empty.
ArrayView() : ArrayView(nullptr, 0) {}
ArrayView(std::nullptr_t) // NOLINT
: ArrayView() {}
ArrayView(std::nullptr_t, size_t size)
: ArrayView(static_cast<T*>(nullptr), size) {
static_assert(Size == 0 || Size == array_view_internal::kArrayViewVarSize,
"");
RTC_DCHECK_EQ(0, size);
}
// Construct an ArrayView from a C-style array.
template <typename U, size_t N>
ArrayView(U (&array)[N]) // NOLINT
: ArrayView(array, N) {
static_assert(Size == N || Size == array_view_internal::kArrayViewVarSize,
"Array size must match ArrayView size");
}
// (Only if size is fixed.) Construct a fixed size ArrayView<T, N> from a
// non-const std::array instance. For an ArrayView with variable size, the
// used ctor is ArrayView(U& u) instead.
template <typename U,
size_t N,
typename std::enable_if<
Size == static_cast<std::ptrdiff_t>(N)>::type* = nullptr>
ArrayView(std::array<U, N>& u) // NOLINT
: ArrayView(u.data(), u.size()) {}
// (Only if size is fixed.) Construct a fixed size ArrayView<T, N> where T is
// const from a const(expr) std::array instance. For an ArrayView with
// variable size, the used ctor is ArrayView(U& u) instead.
template <typename U,
size_t N,
typename std::enable_if<
Size == static_cast<std::ptrdiff_t>(N)>::type* = nullptr>
ArrayView(const std::array<U, N>& u) // NOLINT
: ArrayView(u.data(), u.size()) {}
// (Only if size is fixed.) Construct an ArrayView from any type U that has a
// static constexpr size() method whose return value is equal to Size, and a
// data() method whose return value converts implicitly to T*. In particular,
// this means we allow conversion from ArrayView<T, N> to ArrayView<const T,
// N>, but not the other way around. We also don't allow conversion from
// ArrayView<T> to ArrayView<T, N>, or from ArrayView<T, M> to ArrayView<T,
// N> when M != N.
template <typename U,
typename std::enable_if_t<
!std::is_same_v<ArrayView, std::remove_reference_t<U>> &&
Size != array_view_internal::kArrayViewVarSize &&
HasDataAndSize<U, T>::value>* = nullptr>
ArrayView(U& u) // NOLINT
: ArrayView(u.data(), u.size()) {
static_assert(U::size() == Size, "Sizes must match exactly");
}
template <typename U,
typename std::enable_if_t<
!std::is_same_v<ArrayView, std::remove_reference_t<U>> &&
Size != array_view_internal::kArrayViewVarSize &&
HasDataAndSize<U, T>::value>* = nullptr>
ArrayView(const U& u) // NOLINT(runtime/explicit)
: ArrayView(u.data(), u.size()) {
static_assert(U::size() == Size, "Sizes must match exactly");
}
// (Only if size is variable.) Construct an ArrayView from any type U that
// has a size() method whose return value converts implicitly to size_t, and
// a data() method whose return value converts implicitly to T*. In
// particular, this means we allow conversion from ArrayView<T> to
// ArrayView<const T>, but not the other way around. Other allowed
// conversions include
// ArrayView<T, N> to ArrayView<T> or ArrayView<const T>,
// std::vector<T> to ArrayView<T> or ArrayView<const T>,
// const std::vector<T> to ArrayView<const T>,
// Buffer to ArrayView<uint8_t> or ArrayView<const uint8_t>, and
// const Buffer to ArrayView<const uint8_t>.
template <typename U,
typename std::enable_if_t<
!std::is_same_v<ArrayView, std::remove_reference_t<U>> &&
Size == array_view_internal::kArrayViewVarSize &&
HasDataAndSize<U, T>::value>* = nullptr>
ArrayView(U& u) // NOLINT
: ArrayView(u.data(), u.size()) {}
template <typename U,
typename std::enable_if_t<
!std::is_same_v<ArrayView, std::remove_reference_t<U>> &&
Size == array_view_internal::kArrayViewVarSize &&
HasDataAndSize<U, T>::value>* = nullptr>
ArrayView(const U& u) // NOLINT(runtime/explicit)
: ArrayView(u.data(), u.size()) {}
// Indexing and iteration. These allow mutation even if the ArrayView is
// const, because the ArrayView doesn't own the array. (To prevent mutation,
// use a const element type.)
T& operator[](size_t idx) const {
RTC_DCHECK_LT(idx, this->size());
RTC_DCHECK(this->data());
return this->data()[idx];
}
T* begin() const { return this->data(); }
T* end() const { return this->data() + this->size(); }
const T* cbegin() const { return this->data(); }
const T* cend() const { return this->data() + this->size(); }
std::reverse_iterator<T*> rbegin() const {
return std::make_reverse_iterator(end());
}
std::reverse_iterator<T*> rend() const {
return std::make_reverse_iterator(begin());
}
std::reverse_iterator<const T*> crbegin() const {
return std::make_reverse_iterator(cend());
}
std::reverse_iterator<const T*> crend() const {
return std::make_reverse_iterator(cbegin());
}
constexpr ArrayView<T> subspan(size_t offset,
size_t count = std::dynamic_extent) const {
ABSL_HARDENING_ASSERT(offset <= this->size());
if (count == std::dynamic_extent) {
count = this->size() - offset;
} else {
ABSL_HARDENING_ASSERT(count <= this->size() - offset);
}
return ArrayView<T>(this->data() + offset, count);
}
// Prefer to use `subspan` instead of `subview` in new code.
// TODO: bugs.webrtc.org/439801349 - make deprecated when all usages in
// WebRTC and chromium are migrated to subspan.
ArrayView<T> subview(size_t offset, size_t size) const {
return offset < this->size()
? ArrayView<T>(this->data() + offset,
std::min(size, this->size() - offset))
: ArrayView<T>();
}
ArrayView<T> subview(size_t offset) const {
return subview(offset, this->size());
}
};
// Comparing two ArrayViews compares their (pointer,size) pairs; it does *not*
// dereference the pointers.
template <typename T, std::ptrdiff_t Size1, std::ptrdiff_t Size2>
bool operator==(const ArrayView<T, Size1>& a, const ArrayView<T, Size2>& b) {
return a.data() == b.data() && a.size() == b.size();
}
template <typename T, std::ptrdiff_t Size1, std::ptrdiff_t Size2>
bool operator!=(const ArrayView<T, Size1>& a, const ArrayView<T, Size2>& b) {
return !(a == b);
}
// Variable-size ArrayViews are the size of two pointers; fixed-size ArrayViews
// are the size of one pointer. (And as a special case, fixed-size ArrayViews
// of size 0 require no storage.)
static_assert(sizeof(ArrayView<int>) == 2 * sizeof(int*), "");
static_assert(sizeof(ArrayView<int, 17>) == sizeof(int*), "");
static_assert(std::is_empty<ArrayView<int, 0>>::value, "");
template <typename T, size_t extent = std::dynamic_extent>
using ArrayView = std::span<T, extent>;
// TODO: bugs.webrtc.org/439801349 - deprecate when unused by WebRTC
template <typename T>
inline ArrayView<T> MakeArrayView(T* data, size_t size) {
return ArrayView<T>(data, size);
}
// Only for primitive types that have the same size and aligment.
// Allow reinterpret cast of the array view to another primitive type of the
// same size.
// Template arguments order is (U, T, Size) to allow deduction of the template
// arguments in client calls: reinterpret_array_view<target_type>(array_view).
template <typename U, typename T, std::ptrdiff_t Size>
inline ArrayView<U, Size> reinterpret_array_view(ArrayView<T, Size> view) {
static_assert(sizeof(U) == sizeof(T) && alignof(U) == alignof(T),
"ArrayView reinterpret_cast is only supported for casting "
"between views that represent the same chunk of memory.");
static_assert(
std::is_fundamental<T>::value && std::is_fundamental<U>::value,
"ArrayView reinterpret_cast is only supported for casting between "
"fundamental types.");
return ArrayView<U, Size>(reinterpret_cast<U*>(view.data()), view.size());
}
} // namespace webrtc

View File

@ -13,6 +13,7 @@
#include <array>
#include <cstddef>
#include <cstdint>
#include <span>
#include <string>
#include <utility>
#include <vector>
@ -70,10 +71,10 @@ TEST(ArrayViewDeathTest, TestConstructFromPtrAndArray) {
EXPECT_EQ(arr, wf.data());
ArrayView<char> q(arr, 0);
EXPECT_EQ(0u, q.size());
EXPECT_EQ(nullptr, q.data());
EXPECT_TRUE(q.empty());
ArrayView<char, 0> qf(arr, 0);
static_assert(qf.size() == 0, "");
EXPECT_EQ(nullptr, qf.data());
EXPECT_TRUE(qf.empty());
#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
// DCHECK error (nullptr with nonzero size).
EXPECT_DEATH(ArrayView<int>(static_cast<int*>(nullptr), 5), "");
@ -428,7 +429,8 @@ TEST(ArrayViewDeathTest, TestIndexing) {
EXPECT_EQ('Y', y[2]);
EXPECT_EQ('X', z[3]);
#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
EXPECT_DEATH(z[8], ""); // DCHECK error (index out of bounds).
// DCHECK error (index out of bounds).
EXPECT_DEATH(std::ignore = z[8], "");
#endif
}
@ -436,7 +438,6 @@ TEST(ArrayViewTest, TestIterationEmpty) {
// Variable-size.
ArrayView<std::vector<std::vector<std::vector<std::string>>>> av;
EXPECT_EQ(av.begin(), av.end());
EXPECT_EQ(av.cbegin(), av.cend());
for (auto& e : av) {
EXPECT_TRUE(false);
EXPECT_EQ(42u, e.size()); // Dummy use of e to prevent unused var warning.
@ -445,7 +446,6 @@ TEST(ArrayViewTest, TestIterationEmpty) {
// Fixed-size.
ArrayView<std::vector<std::vector<std::vector<std::string>>>, 0> af;
EXPECT_EQ(af.begin(), af.end());
EXPECT_EQ(af.cbegin(), af.cend());
for (auto& e : af) {
EXPECT_TRUE(false);
EXPECT_EQ(42u, e.size()); // Dummy use of e to prevent unused var warning.
@ -456,13 +456,11 @@ TEST(ArrayViewTest, TestReverseIterationEmpty) {
// Variable-size.
ArrayView<std::vector<std::vector<std::vector<std::string>>>> av;
EXPECT_EQ(av.rbegin(), av.rend());
EXPECT_EQ(av.crbegin(), av.crend());
EXPECT_TRUE(av.empty());
// Fixed-size.
ArrayView<std::vector<std::vector<std::vector<std::string>>>, 0> af;
EXPECT_EQ(af.begin(), af.end());
EXPECT_EQ(af.cbegin(), af.cend());
EXPECT_TRUE(af.empty());
}
@ -470,9 +468,7 @@ TEST(ArrayViewTest, TestIterationVariable) {
char arr[] = "Arrr!";
ArrayView<char> av(arr);
EXPECT_EQ('A', *av.begin());
EXPECT_EQ('A', *av.cbegin());
EXPECT_EQ('\0', *(av.end() - 1));
EXPECT_EQ('\0', *(av.cend() - 1));
char i = 0;
for (auto& e : av) {
EXPECT_EQ(arr + i, &e);
@ -491,16 +487,9 @@ TEST(ArrayViewTest, TestReverseIterationVariable) {
char arr[] = "Arrr!";
ArrayView<char> av(arr);
EXPECT_EQ('\0', *av.rbegin());
EXPECT_EQ('\0', *av.crbegin());
EXPECT_EQ('A', *(av.rend() - 1));
EXPECT_EQ('A', *(av.crend() - 1));
const char* cit = av.cend() - 1;
for (auto crit = av.crbegin(); crit != av.crend(); ++crit, --cit) {
EXPECT_EQ(*cit, *crit);
}
char* it = av.end() - 1;
auto it = av.end() - 1;
for (auto rit = av.rbegin(); rit != av.rend(); ++rit, --it) {
EXPECT_EQ(*it, *rit);
}
@ -510,9 +499,7 @@ TEST(ArrayViewTest, TestIterationFixed) {
char arr[] = "Arrr!";
ArrayView<char, 6> av(arr);
EXPECT_EQ('A', *av.begin());
EXPECT_EQ('A', *av.cbegin());
EXPECT_EQ('\0', *(av.end() - 1));
EXPECT_EQ('\0', *(av.cend() - 1));
char i = 0;
for (auto& e : av) {
EXPECT_EQ(arr + i, &e);
@ -531,16 +518,9 @@ TEST(ArrayViewTest, TestReverseIterationFixed) {
char arr[] = "Arrr!";
ArrayView<char, 6> av(arr);
EXPECT_EQ('\0', *av.rbegin());
EXPECT_EQ('\0', *av.crbegin());
EXPECT_EQ('A', *(av.rend() - 1));
EXPECT_EQ('A', *(av.crend() - 1));
const char* cit = av.cend() - 1;
for (auto crit = av.crbegin(); crit != av.crend(); ++crit, --cit) {
EXPECT_EQ(*cit, *crit);
}
char* it = av.end() - 1;
auto it = av.end() - 1;
for (auto rit = av.rbegin(); rit != av.rend(); ++rit, --it) {
EXPECT_EQ(*it, *rit);
}
@ -551,45 +531,7 @@ TEST(ArrayViewTest, TestEmpty) {
const int a[] = {1, 2, 3};
EXPECT_FALSE(ArrayView<const int>(a).empty());
static_assert(ArrayView<int, 0>::empty(), "");
static_assert(!ArrayView<int, 3>::empty(), "");
}
TEST(ArrayViewTest, TestCompare) {
int a[] = {1, 2, 3};
int b[] = {1, 2, 3};
EXPECT_EQ(ArrayView<int>(a), ArrayView<int>(a));
EXPECT_EQ((ArrayView<int, 3>(a)), (ArrayView<int, 3>(a)));
EXPECT_EQ(ArrayView<int>(a), (ArrayView<int, 3>(a)));
EXPECT_EQ(ArrayView<int>(), ArrayView<int>());
EXPECT_EQ(ArrayView<int>(), ArrayView<int>(a, 0));
EXPECT_EQ(ArrayView<int>(a, 0), ArrayView<int>(b, 0));
EXPECT_EQ((ArrayView<int, 0>(a, 0)), ArrayView<int>());
EXPECT_NE(ArrayView<int>(a), ArrayView<int>(b));
EXPECT_NE((ArrayView<int, 3>(a)), (ArrayView<int, 3>(b)));
EXPECT_NE((ArrayView<int, 3>(a)), ArrayView<int>(b));
EXPECT_NE(ArrayView<int>(a), ArrayView<int>());
EXPECT_NE(ArrayView<int>(a), ArrayView<int>(a, 2));
EXPECT_NE((ArrayView<int, 3>(a)), (ArrayView<int, 2>(a, 2)));
}
TEST(ArrayViewTest, TestSubViewVariable) {
int a[] = {1, 2, 3};
ArrayView<int> av(a);
EXPECT_EQ(av.subview(0), av);
EXPECT_THAT(av.subview(1), ElementsAre(2, 3));
EXPECT_THAT(av.subview(2), ElementsAre(3));
EXPECT_THAT(av.subview(3), IsEmpty());
EXPECT_THAT(av.subview(4), IsEmpty());
EXPECT_THAT(av.subview(1, 0), IsEmpty());
EXPECT_THAT(av.subview(1, 1), ElementsAre(2));
EXPECT_THAT(av.subview(1, 2), ElementsAre(2, 3));
EXPECT_THAT(av.subview(1, 3), ElementsAre(2, 3));
static_assert(ArrayView<int, 0>().empty());
}
TEST(ArrayViewTest, TestSubSpanVariable) {
@ -609,44 +551,64 @@ TEST(ArrayViewTest, TestSubSpanVariable) {
TEST(ArrayViewTest, TestSubSpanWithInvalidInput) {
int a[] = {1, 2, 3};
ArrayView<int> av(a);
EXPECT_DEATH_IF_SUPPORTED(av.subspan(4), "");
EXPECT_DEATH_IF_SUPPORTED(av.subspan(1, 3), "");
EXPECT_DEATH_IF_SUPPORTED(std::ignore = av.subspan(4), "");
EXPECT_DEATH_IF_SUPPORTED(std::ignore = av.subspan(1, 3), "");
}
TEST(ArrayViewTest, TestSubViewFixed) {
int a[] = {1, 2, 3};
TEST(ArrayViewTest, SubspanFixed) {
std::array<int, 3> a = {1, 2, 3};
ArrayView<int, 3> av(a);
EXPECT_EQ(av.subview(0), av);
EXPECT_THAT(av.subspan<0>(), ElementsAre(1, 2, 3));
EXPECT_THAT(av.subspan<1>(), ElementsAre(2, 3));
EXPECT_THAT(av.subspan<2>(), ElementsAre(3));
EXPECT_THAT(av.subspan<3>(), IsEmpty());
EXPECT_THAT(av.subview(1), ElementsAre(2, 3));
EXPECT_THAT(av.subview(2), ElementsAre(3));
EXPECT_THAT(av.subview(3), IsEmpty());
EXPECT_THAT(av.subview(4), IsEmpty());
EXPECT_THAT((av.subspan<1, 0>()), IsEmpty());
EXPECT_THAT((av.subspan<1, 1>()), ElementsAre(2));
EXPECT_THAT((av.subspan<1, 2>()), ElementsAre(2, 3));
EXPECT_THAT(av.subview(1, 0), IsEmpty());
EXPECT_THAT(av.subview(1, 1), ElementsAre(2));
EXPECT_THAT(av.subview(1, 2), ElementsAre(2, 3));
EXPECT_THAT(av.subview(1, 3), ElementsAre(2, 3));
EXPECT_EQ(av.subspan<1>().extent, 2u);
EXPECT_EQ((av.subspan<1, 1>().extent), 1u);
ArrayView<int> dynamic_av(a);
EXPECT_THAT(dynamic_av.subspan<0>(), ElementsAre(1, 2, 3));
EXPECT_THAT(dynamic_av.subspan<1>(), ElementsAre(2, 3));
EXPECT_THAT(dynamic_av.subspan<2>(), ElementsAre(3));
EXPECT_THAT(dynamic_av.subspan<3>(), IsEmpty());
EXPECT_THAT((dynamic_av.subspan<1, 0>()), IsEmpty());
EXPECT_THAT((dynamic_av.subspan<1, 1>()), ElementsAre(2));
EXPECT_THAT((dynamic_av.subspan<1, 2>()), ElementsAre(2, 3));
EXPECT_EQ(dynamic_av.subspan<1>().extent, std::dynamic_extent);
EXPECT_EQ((dynamic_av.subspan<1, 1>()).extent, 1u);
}
TEST(ArrayViewTest, TestReinterpretCastFixedSize) {
uint8_t bytes[] = {1, 2, 3};
ArrayView<uint8_t, 3> uint8_av(bytes);
ArrayView<int8_t, 3> int8_av = reinterpret_array_view<int8_t>(uint8_av);
EXPECT_EQ(int8_av.size(), uint8_av.size());
EXPECT_EQ(int8_av[0], 1);
EXPECT_EQ(int8_av[1], 2);
EXPECT_EQ(int8_av[2], 3);
TEST(ArrayViewTest, FirstFixed) {
std::array<int, 3> a = {1, 2, 3};
ArrayView<int> av(a);
EXPECT_THAT(av.first<0>(), IsEmpty());
EXPECT_THAT(av.first<1>(), ElementsAre(1));
EXPECT_THAT(av.first<2>(), ElementsAre(1, 2));
EXPECT_THAT(av.first<3>(), ElementsAre(1, 2, 3));
EXPECT_EQ((av.first<0>()).extent, 0u);
EXPECT_EQ((av.first<2>()).extent, 2u);
}
TEST(ArrayViewTest, TestReinterpretCastVariableSize) {
std::vector<int8_t> v = {1, 2, 3};
ArrayView<int8_t> int8_av(v);
ArrayView<uint8_t> uint8_av = reinterpret_array_view<uint8_t>(int8_av);
EXPECT_EQ(int8_av.size(), uint8_av.size());
EXPECT_EQ(uint8_av[0], 1);
EXPECT_EQ(uint8_av[1], 2);
EXPECT_EQ(uint8_av[2], 3);
TEST(ArrayViewTest, LastFixed) {
std::array<int, 3> a = {1, 2, 3};
ArrayView<int> av(a);
EXPECT_THAT(av.last<0>(), IsEmpty());
EXPECT_THAT(av.last<1>(), ElementsAre(3));
EXPECT_THAT(av.last<2>(), ElementsAre(2, 3));
EXPECT_THAT(av.last<3>(), ElementsAre(1, 2, 3));
EXPECT_EQ((av.last<0>()).extent, 0u);
EXPECT_EQ((av.last<2>()).extent, 2u);
}
} // namespace webrtc

View File

@ -48,11 +48,11 @@ rtc_library("audio_frame_api") {
]
deps = [
"..:array_view",
"..:rtp_packet_info",
"../../rtc_base:checks",
"../../rtc_base:logging",
"../../rtc_base:timeutils",
"//third_party/abseil-cpp/absl/algorithm:container",
]
}
@ -83,7 +83,6 @@ rtc_library("audio_processing") {
":aec3_config",
":audio_processing_statistics",
":echo_control",
"..:array_view",
"..:ref_count",
"..:scoped_refptr",
"../../rtc_base:checks",
@ -175,10 +174,7 @@ rtc_source_set("echo_control") {
rtc_source_set("neural_residual_echo_estimator_api") {
visibility = [ "*" ]
sources = [ "neural_residual_echo_estimator.h" ]
deps = [
":aec3_config",
"..:array_view",
]
deps = [ ":aec3_config" ]
}
if (rtc_enable_protobuf) {

View File

@ -13,8 +13,9 @@
#include <cstdint>
#include <cstring>
#include <optional>
#include <span>
#include "api/array_view.h"
#include "absl/algorithm/container.h"
#include "api/audio/audio_view.h"
#include "api/audio/channel_layout.h"
#include "api/rtp_packet_infos.h"
@ -102,7 +103,7 @@ void AudioFrame::CopyFrom(const AudioFrame& src) {
// copying over new values. If we don't, msan might complain in some tests.
// Consider locking down construction, avoiding the default constructor and
// prefering construction that initializes all state.
ClearSamples(data_);
absl::c_fill(data_, 0);
}
timestamp_ = src.timestamp_;
@ -126,18 +127,16 @@ void AudioFrame::CopyFrom(const AudioFrame& src) {
}
const int16_t* AudioFrame::data() const {
return muted_ ? zeroed_data().begin() : data_.data();
return muted_ ? zeroed_data().data() : data_.data();
}
InterleavedView<const int16_t> AudioFrame::data_view() const {
// If you get a nullptr from `data_view()`, it's likely because the
// samples_per_channel_ and/or num_channels_ members haven't been properly
// set. Since `data_view()` returns an InterleavedView<> (which internally
// uses ArrayView<>), we inherit the behavior in InterleavedView when
// the view size is 0 that ArrayView<>::data() returns nullptr. So, even when
// an AudioFrame is muted and we want to return `zeroed_data()`, if
// samples_per_channel_ or num_channels_ is 0, the view will point to
// nullptr.
// set. `data_view()` returns an InterleavedView<> which internally
// uses std::span<>. So, even when an AudioFrame is muted and we want to
// return `zeroed_data()`, if samples_per_channel_ or num_channels_ is 0,
// the view might point to nullptr.
return InterleavedView<const int16_t>(muted_ ? &zeroed_data()[0] : &data_[0],
samples_per_channel_, num_channels_);
}
@ -147,7 +146,7 @@ int16_t* AudioFrame::mutable_data() {
// Consider instead if we should rather zero the buffer when `muted_` is set
// to `true`.
if (muted_) {
ClearSamples(data_);
absl::c_fill(data_, 0);
muted_ = false;
}
return &data_[0];
@ -170,7 +169,7 @@ InterleavedView<int16_t> AudioFrame::mutable_data(size_t samples_per_channel,
// Consider instead if we should rather zero the whole buffer when `muted_` is
// set to `true`.
if (muted_) {
ClearSamples(data_, total_samples);
absl::c_fill_n(data_, total_samples, 0);
muted_ = false;
}
samples_per_channel_ = samples_per_channel;
@ -212,9 +211,9 @@ void AudioFrame::SetSampleRateAndChannelSize(int sample_rate) {
}
// static
ArrayView<const int16_t> AudioFrame::zeroed_data() {
std::span<const int16_t> AudioFrame::zeroed_data() {
static int16_t* null_data = new int16_t[kMaxDataSizeSamples]();
return ArrayView<const int16_t>(null_data, kMaxDataSizeSamples);
return std::span<const int16_t>(null_data, kMaxDataSizeSamples);
}
} // namespace webrtc

View File

@ -16,8 +16,8 @@
#include <array>
#include <optional>
#include <span>
#include "api/array_view.h"
#include "api/audio/audio_view.h"
#include "api/audio/channel_layout.h"
#include "api/rtp_packet_infos.h"
@ -199,7 +199,7 @@ class AudioFrame {
// A permanently zeroed out buffer to represent muted frames. This is a
// header-only class, so the only way to avoid creating a separate zeroed
// buffer per translation unit is to wrap a static in an inline function.
static ArrayView<const int16_t> zeroed_data();
static std::span<const int16_t> zeroed_data();
std::array<int16_t, kMaxDataSizeSamples> data_;
bool muted_ = true;

View File

@ -18,11 +18,11 @@
#include <cstring>
#include <memory>
#include <optional>
#include <span>
#include <string>
#include "absl/base/nullability.h"
#include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "api/audio/audio_processing_statistics.h"
#include "api/audio/echo_control.h"
#include "api/environment/environment.h"
@ -147,10 +147,10 @@ class RTC_EXPORT AudioProcessing : public RefCountInterface {
// 32000 or 48000 and any differing values will be treated as 48000.
int maximum_internal_processing_rate = 32000;
// Allow multi-channel processing of render audio.
bool multi_channel_render = false;
bool multi_channel_render = true;
// Allow multi-channel processing of capture audio when AEC3 is active
// or a custom AEC is injected..
bool multi_channel_capture = false;
// or a custom AEC is injected.
bool multi_channel_capture = true;
// Indicates how to downmix multi-channel capture audio to mono (when
// needed).
DownmixMethod capture_downmix_method = DownmixMethod::kAverageChannels;
@ -592,7 +592,7 @@ class RTC_EXPORT AudioProcessing : public RefCountInterface {
// representation of the input is returned. Returns true/false to indicate
// whether an output returned.
virtual bool GetLinearAecOutput(
ArrayView<std::array<float, 160>> linear_output) const = 0;
std::span<std::array<float, 160>> linear_output) const = 0;
// This must be called prior to ProcessStream() if and only if adaptive analog
// gain control is enabled, to pass the current analog level from the audio
@ -874,10 +874,10 @@ class EchoDetector : public RefCountInterface {
int num_render_channels) = 0;
// Analysis (not changing) of the first channel of the render signal.
virtual void AnalyzeRenderAudio(ArrayView<const float> render_audio) = 0;
virtual void AnalyzeRenderAudio(std::span<const float> render_audio) = 0;
// Analysis (not changing) of the capture signal.
virtual void AnalyzeCaptureAudio(ArrayView<const float> capture_audio) = 0;
virtual void AnalyzeCaptureAudio(std::span<const float> capture_audio) = 0;
struct Metrics {
std::optional<double> echo_likelihood;

View File

@ -13,10 +13,11 @@
#include <cstddef>
#include <iterator>
#include <span>
#include <variant>
#include <vector>
#include "api/array_view.h"
#include "absl/algorithm/container.h"
#include "rtc_base/checks.h"
namespace webrtc {
@ -33,7 +34,7 @@ namespace webrtc {
// buffer. Channels can be enumerated and accessing the individual channel
// data is done via MonoView<>.
//
// The views are comparable to and built on ArrayView<> but add
// The views are comparable to and built on std::span<> but add
// audio specific properties for the dimensions of the buffer and the above
// specialized [de]interleaved support.
//
@ -44,14 +45,13 @@ namespace webrtc {
// can be either an single channel (mono) interleaved buffer (e.g. AudioFrame),
// or a de-interleaved channel (e.g. from AudioBuffer).
template <typename T>
using MonoView = ArrayView<T>;
using MonoView = std::span<T>;
// The maximum number of audio channels supported by WebRTC encoders, decoders
// and the AudioFrame class.
// TODO(peah, tommi): Should kMaxNumberOfAudioChannels be 16 rather than 24?
// The reason is that AudioFrame's max number of samples is 7680, which can
// hold 16 10ms 16bit channels at 48 kHz (and not 24 channels).
static constexpr size_t kMaxNumberOfAudioChannels = 24;
// AudioFrame's max number of samples is 7680, which can hold 16 10ms 16bit
// channels at 48 kHz.
static constexpr size_t kMaxNumberOfAudioChannels = 16;
// InterleavedView<> is a view over an interleaved audio buffer (e.g. from
// AudioFrame).
@ -59,6 +59,8 @@ template <typename T>
class InterleavedView {
public:
using value_type = T;
using iterator = typename std::span<T>::iterator;
using const_iterator = typename std::span<const T>::iterator;
InterleavedView() = default;
@ -88,7 +90,7 @@ class InterleavedView {
size_t num_channels() const { return num_channels_; }
size_t samples_per_channel() const { return samples_per_channel_; }
ArrayView<T> data() const { return data_; }
std::span<T> data() const { return data_; }
bool empty() const { return data_.empty(); }
size_t size() const { return data_.size(); }
@ -112,14 +114,16 @@ class InterleavedView {
}
T& operator[](size_t idx) const { return data_[idx]; }
T* begin() const { return data_.begin(); }
T* end() const { return data_.end(); }
const T* cbegin() const { return data_.cbegin(); }
const T* cend() const { return data_.cend(); }
std::reverse_iterator<T*> rbegin() const { return data_.rbegin(); }
std::reverse_iterator<T*> rend() const { return data_.rend(); }
std::reverse_iterator<const T*> crbegin() const { return data_.crbegin(); }
std::reverse_iterator<const T*> crend() const { return data_.crend(); }
iterator begin() const { return data_.begin(); }
iterator end() const { return data_.end(); }
const_iterator cbegin() const { return data_.begin(); }
const_iterator cend() const { return data_.end(); }
std::reverse_iterator<iterator> rbegin() const { return data_.rbegin(); }
std::reverse_iterator<iterator> rend() const { return data_.rend(); }
std::reverse_iterator<const_iterator> crbegin() const {
return data_.rbegin();
}
std::reverse_iterator<const_iterator> crend() const { return data_.rend(); }
private:
// TODO(tommi): Consider having these both be stored as uint16_t to
@ -127,7 +131,7 @@ class InterleavedView {
// construction.
size_t num_channels_ = 0u;
size_t samples_per_channel_ = 0u;
ArrayView<T> data_;
std::span<T> data_;
};
template <typename T>
@ -207,7 +211,7 @@ class DeinterleavedView {
void Clear() {
for (size_t i = 0u; i < num_channels_; ++i) {
MonoView<T> view = (*this)[i];
ClearSamples(view);
absl::c_fill(view, 0);
}
}
@ -304,22 +308,6 @@ void CopySamples(D& destination, const S& source) {
source.size() * sizeof(typename S::value_type));
}
// Sets all the samples in a view to 0. This template function is a simple
// wrapper around `memset()` but adds the benefit of automatically calculating
// the byte size from the number of samples and sample type.
template <typename T>
void ClearSamples(T& view) {
memset(&view[0], 0, view.size() * sizeof(typename T::value_type));
}
// Same as `ClearSamples()` above but allows for clearing only the first
// `sample_count` number of samples.
template <typename T>
void ClearSamples(T& view, size_t sample_count) {
RTC_DCHECK_LE(sample_count, view.size());
memset(&view[0], 0, sample_count * sizeof(typename T::value_type));
}
} // namespace webrtc
#endif // API_AUDIO_AUDIO_VIEW_H_

View File

@ -12,8 +12,8 @@
#define API_AUDIO_NEURAL_RESIDUAL_ECHO_ESTIMATOR_H_
#include <array>
#include <span>
#include "api/array_view.h"
#include "api/audio/echo_canceller3_config.h"
namespace webrtc {
@ -45,18 +45,23 @@ class NeuralResidualEchoEstimator {
// Other inputs:
// * dominant_nearend: True if dominant nearend is active
virtual void Estimate(const Block& render,
ArrayView<const std::array<float, 64>> y,
ArrayView<const std::array<float, 64>> e,
ArrayView<const std::array<float, 65>> S2,
ArrayView<const std::array<float, 65>> Y2,
ArrayView<const std::array<float, 65>> E2,
std::span<const std::array<float, 64>> y,
std::span<const std::array<float, 64>> e,
std::span<const std::array<float, 65>> S2,
std::span<const std::array<float, 65>> Y2,
std::span<const std::array<float, 65>> E2,
bool dominant_nearend,
ArrayView<std::array<float, 65>> R2,
ArrayView<std::array<float, 65>> R2_unbounded) = 0;
std::span<std::array<float, 65>> R2,
std::span<std::array<float, 65>> R2_unbounded) = 0;
// Returns a recommended AEC3 configuration for this estimator.
virtual EchoCanceller3Config GetConfiguration(bool multi_channel) const = 0;
// Adjusts the provided AEC3 suppressor configuration based on the estimator's
// requirements.
virtual EchoCanceller3Config::Suppressor AdjustConfig(
const EchoCanceller3Config::Suppressor& config) const = 0;
// Resets the internal state of the estimator.
virtual void Reset() = 0;
};

View File

@ -23,7 +23,6 @@ if (rtc_include_tests) {
deps = [
"..:aec3_config",
"..:audio_frame_api",
"../..:array_view",
"../../../modules/audio_processing:aec3_config_json",
"../../../rtc_base:checks",
"../../../test:test_support",

View File

@ -66,7 +66,7 @@ TEST(AudioFrameTest, FrameStartsZeroedAndMuted) {
EXPECT_TRUE(AllSamplesAre(0, frame));
}
// TODO: b/335805780 - Delete test when `mutable_data()` returns ArrayView.
// TODO: b/335805780 - Delete test when `mutable_data()` returns std::span.
TEST(AudioFrameTest, UnmutedFrameIsInitiallyZeroedLegacy) {
AudioFrame frame(kSampleRateHz, kNumChannelsMono, CHANNEL_LAYOUT_NONE);
frame.mutable_data();
@ -88,7 +88,7 @@ TEST(AudioFrameTest, UnmutedFrameIsInitiallyZeroed) {
TEST(AudioFrameTest, MutedFrameBufferIsZeroed) {
AudioFrame frame;
int16_t* frame_data =
frame.mutable_data(kSamplesPerChannel, kNumChannelsMono).begin();
frame.mutable_data(kSamplesPerChannel, kNumChannelsMono).data().data();
EXPECT_FALSE(frame.muted());
// Fill the reserved buffer with non-zero data.
for (size_t i = 0; i < frame.max_16bit_samples(); i++) {

View File

@ -13,9 +13,9 @@
#include <array>
#include <cstddef>
#include <cstdint>
#include <span>
#include <vector>
#include "api/array_view.h"
#include "test/gtest.h"
namespace webrtc {
@ -37,7 +37,7 @@ void Increment(int16_t& t) {
// Fills a given buffer with monotonically increasing values.
template <typename T>
void FillBuffer(ArrayView<T> buffer) {
void FillBuffer(std::span<T> buffer) {
T value = {};
for (T& t : buffer) {
Increment<T>(value);
@ -50,7 +50,7 @@ void FillBuffer(ArrayView<T> buffer) {
TEST(AudioViewTest, MonoView) {
const size_t kArraySize = 100u;
int16_t arr[kArraySize];
FillBuffer(ArrayView<int16_t>(arr));
FillBuffer(std::span<int16_t>(arr));
MonoView<int16_t> mono(arr);
MonoView<const int16_t> const_mono(arr);
@ -69,15 +69,16 @@ TEST(AudioViewTest, MonoView) {
TEST(AudioViewTest, InterleavedView) {
const size_t kArraySize = 100u;
int16_t arr[kArraySize];
FillBuffer(ArrayView<int16_t>(arr));
FillBuffer(std::span<int16_t>(arr));
InterleavedView<int16_t> interleaved(arr, kArraySize, 1);
EXPECT_EQ(NumChannels(interleaved), 1u);
EXPECT_TRUE(IsMono(interleaved));
EXPECT_EQ(SamplesPerChannel(interleaved), kArraySize);
EXPECT_EQ(interleaved.AsMono().size(), kArraySize);
EXPECT_EQ(&interleaved.AsMono()[0], &arr[0]);
EXPECT_EQ(interleaved.AsMono(), interleaved.data());
EXPECT_EQ(interleaved.AsMono().size(), std::size(arr));
EXPECT_EQ(interleaved.AsMono().data(), std::data(arr));
EXPECT_EQ(interleaved.AsMono().size(), interleaved.data().size());
EXPECT_EQ(interleaved.AsMono().data(), interleaved.data().data());
// Basic iterator test.
int i = 0;
@ -121,7 +122,9 @@ TEST(AudioViewTest, DeinterleavedView) {
auto mono_ch = di.AsMono();
EXPECT_EQ(NumChannels(mono_ch), 1u);
EXPECT_EQ(SamplesPerChannel(mono_ch), 10u);
EXPECT_EQ(di[0], mono_ch); // first channel should be same as mono.
// first channel should be same as mono.
EXPECT_EQ(di[0].data(), mono_ch.data());
EXPECT_EQ(di[0].size(), mono_ch.size());
di = DeinterleavedView<int16_t>(arr, 50, 2);
// Test assignment.
@ -141,7 +144,7 @@ TEST(AudioViewTest, CopySamples) {
const size_t kArraySize = 100u;
int16_t source_arr[kArraySize] = {};
int16_t dest_arr[kArraySize] = {};
FillBuffer(ArrayView<int16_t>(source_arr));
FillBuffer(std::span<int16_t>(source_arr));
InterleavedView<const int16_t> source(source_arr, 2);
InterleavedView<int16_t> destination(dest_arr, 2);
@ -162,36 +165,6 @@ TEST(AudioViewTest, CopySamples) {
}
}
TEST(AudioViewTest, ClearSamples) {
std::array<int16_t, 100u> samples = {};
FillBuffer(ArrayView<int16_t>(samples));
ASSERT_NE(samples[0], 0);
ClearSamples(samples);
for (const auto s : samples) {
ASSERT_EQ(s, 0);
}
std::array<float, 100u> samples_f = {};
FillBuffer(ArrayView<float>(samples_f));
ASSERT_NE(samples_f[0], 0.0);
ClearSamples(samples_f);
for (const auto s : samples_f) {
ASSERT_EQ(s, 0.0);
}
// Clear only half of the buffer
FillBuffer(ArrayView<int16_t>(samples));
const auto half_way = samples.size() / 2;
ClearSamples(samples, half_way);
for (size_t i = 0u; i < samples.size(); ++i) {
if (i < half_way) {
ASSERT_EQ(samples[i], 0);
} else {
ASSERT_NE(samples[i], 0);
}
}
}
TEST(AudioViewTest, DeinterleavedViewPointerArray) {
// Create vectors of varying sizes to guarantee that they don't end up
// aligned in memory.

View File

@ -29,7 +29,6 @@ rtc_library("audio_codecs_api") {
"audio_format.h",
]
deps = [
"..:array_view",
"..:bitrate_allocation",
"..:make_ref_counted",
"..:ref_count",

View File

@ -1,3 +1,2 @@
alessiob@webrtc.org
henrik.lundin@webrtc.org
jakobi@webrtc.org

View File

@ -14,10 +14,10 @@
#include <cstdint>
#include <memory>
#include <optional>
#include <span>
#include <utility>
#include <vector>
#include "api/array_view.h"
#include "rtc_base/buffer.h"
#include "rtc_base/checks.h"
#include "rtc_base/sanitizer.h"
@ -41,7 +41,7 @@ class OldStyleEncodedFrame final : public AudioDecoder::EncodedAudioFrame {
}
std::optional<DecodeResult> Decode(
ArrayView<int16_t> decoded) const override {
std::span<int16_t> decoded) const override {
auto speech_type = AudioDecoder::kSpeech;
const int ret = decoder_->Decode(
payload_.data(), payload_.size(), decoder_->SampleRateHz(),
@ -104,7 +104,7 @@ int AudioDecoder::Decode(const uint8_t* encoded,
int16_t* decoded,
SpeechType* speech_type) {
TRACE_EVENT0("webrtc", "AudioDecoder::Decode");
MsanCheckInitialized(MakeArrayView(encoded, encoded_len));
MsanCheckInitialized(std::span(encoded, encoded_len));
int duration = PacketDuration(encoded, encoded_len);
if (duration >= 0 &&
duration * Channels() * sizeof(int16_t) > max_decoded_bytes) {
@ -121,7 +121,7 @@ int AudioDecoder::DecodeRedundant(const uint8_t* encoded,
int16_t* decoded,
SpeechType* speech_type) {
TRACE_EVENT0("webrtc", "AudioDecoder::DecodeRedundant");
MsanCheckInitialized(MakeArrayView(encoded, encoded_len));
MsanCheckInitialized(std::span(encoded, encoded_len));
int duration = PacketDurationRedundant(encoded, encoded_len);
if (duration >= 0 &&
duration * Channels() * sizeof(int16_t) > max_decoded_bytes) {

View File

@ -16,9 +16,9 @@
#include <memory>
#include <optional>
#include <span>
#include <vector>
#include "api/array_view.h"
#include "api/audio/audio_view.h"
#include "rtc_base/buffer.h"
// RingRTC Change to configure opus
@ -65,7 +65,7 @@ class AudioDecoder {
// decoder produced comfort noise or speech. On failure, returns an empty
// std::optional. Decode may be called at most once per frame object.
virtual std::optional<DecodeResult> Decode(
ArrayView<int16_t> decoded) const = 0;
std::span<int16_t> decoded) const = 0;
};
struct ParseResult {

View File

@ -14,9 +14,9 @@
#include <cstdint>
#include <memory>
#include <optional>
#include <span>
#include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "api/call/bitrate_allocation.h"
#include "rtc_base/buffer.h"
#include "rtc_base/checks.h"
@ -45,7 +45,7 @@ int AudioEncoder::RtpTimestampRateHz() const {
}
AudioEncoder::EncodedInfo AudioEncoder::Encode(uint32_t rtp_timestamp,
ArrayView<const int16_t> audio,
std::span<const int16_t> audio,
Buffer* encoded) {
TRACE_EVENT0("webrtc", "AudioEncoder::Encode");
RTC_CHECK_EQ(audio.size(),
@ -77,9 +77,9 @@ void AudioEncoder::SetMaxPlaybackRate(int /* frequency_hz */) {}
void AudioEncoder::SetTargetBitrate(int /* target_bps */) {}
ArrayView<std::unique_ptr<AudioEncoder>>
std::span<std::unique_ptr<AudioEncoder>>
AudioEncoder::ReclaimContainedEncoders() {
return nullptr;
return {};
}
bool AudioEncoder::EnableAudioNetworkAdaptor(absl::string_view /*config*/) {

View File

@ -16,12 +16,12 @@
#include <memory>
#include <optional>
#include <span>
#include <utility>
#include <vector>
#include "absl/base/attributes.h"
#include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "api/audio/audio_view.h"
#include "api/call/bitrate_allocation.h"
#include "api/units/data_rate.h"
@ -200,7 +200,7 @@ class AudioEncoder {
// EncodeImpl() which does the actual work, and then checks some
// postconditions.
EncodedInfo Encode(uint32_t rtp_timestamp,
ArrayView<const int16_t> audio,
std::span<const int16_t> audio,
Buffer* encoded);
// Resets the encoder to its starting state, discarding any input that has
@ -246,7 +246,7 @@ class AudioEncoder {
// not call any methods on this encoder afterwards, except for the
// destructor. The default implementation just returns an empty array.
// NOTE: This method is subject to change. Do not call or override it.
virtual ArrayView<std::unique_ptr<AudioEncoder>> ReclaimContainedEncoders();
virtual std::span<std::unique_ptr<AudioEncoder>> ReclaimContainedEncoders();
// Enables audio network adaptor. Returns true if successful.
virtual bool EnableAudioNetworkAdaptor(absl::string_view config);
@ -316,7 +316,7 @@ class AudioEncoder {
// Subclasses implement this to perform the actual encoding. Called by
// Encode().
virtual EncodedInfo EncodeImpl(uint32_t rtp_timestamp,
ArrayView<const int16_t> audio,
std::span<const int16_t> audio,
Buffer* encoded) = 0;
};
} // namespace webrtc

View File

@ -13,7 +13,6 @@
#include <optional>
#include <string>
#include "api/array_view.h"
#include "rtc_base/strings/string_builder.h"
namespace webrtc {

View File

@ -13,7 +13,7 @@
#include <stdint.h>
#include "api/array_view.h"
#include <span>
namespace webrtc {
@ -41,9 +41,9 @@ struct PacketOptions {
class Transport {
public:
virtual bool SendRtp(ArrayView<const uint8_t> packet,
virtual bool SendRtp(std::span<const uint8_t> packet,
const PacketOptions& options) = 0;
virtual bool SendRtcp(ArrayView<const uint8_t> packet,
virtual bool SendRtcp(std::span<const uint8_t> packet,
const PacketOptions& options) = 0;
protected:

View File

@ -35,7 +35,6 @@ rtc_source_set("frame_decryptor_interface") {
visibility = [ "*" ]
sources = [ "frame_decryptor_interface.h" ]
deps = [
"..:array_view",
"..:ref_count",
"..:rtp_parameters",
"../../rtc_base:refcount",
@ -46,7 +45,6 @@ rtc_source_set("frame_encryptor_interface") {
visibility = [ "*" ]
sources = [ "frame_encryptor_interface.h" ]
deps = [
"..:array_view",
"..:ref_count",
"..:rtp_parameters",
"../../rtc_base:refcount",

View File

@ -13,9 +13,9 @@
#include <cstddef>
#include <cstdint>
#include <span>
#include <vector>
#include "api/array_view.h"
#include "api/media_types.h"
#include "api/ref_count.h"
@ -62,9 +62,9 @@ class FrameDecryptorInterface : public RefCountInterface {
// cases.
virtual Result Decrypt(MediaType media_type,
const std::vector<uint32_t>& csrcs,
ArrayView<const uint8_t> additional_data,
ArrayView<const uint8_t> encrypted_frame,
ArrayView<uint8_t> frame) = 0;
std::span<const uint8_t> additional_data,
std::span<const uint8_t> encrypted_frame,
std::span<uint8_t> frame) = 0;
// Returns the total required length in bytes for the output of the
// decryption. This can be larger than the actual number of bytes you need but

View File

@ -13,8 +13,8 @@
#include <cstddef>
#include <cstdint>
#include <span>
#include "api/array_view.h"
#include "api/media_types.h"
#include "api/ref_count.h"
@ -40,9 +40,9 @@ class FrameEncryptorInterface : public RefCountInterface {
// selected by the implementer to represent error codes.
virtual int Encrypt(MediaType media_type,
uint32_t ssrc,
ArrayView<const uint8_t> additional_data,
ArrayView<const uint8_t> frame,
ArrayView<uint8_t> encrypted_frame,
std::span<const uint8_t> additional_data,
std::span<const uint8_t> frame,
std::span<uint8_t> encrypted_frame,
size_t* bytes_written) = 0;
// Returns the total required length in bytes for the output of the

View File

@ -12,11 +12,11 @@
#define API_DATA_CHANNEL_EVENT_OBSERVER_INTERFACE_H_
#include <cstdint>
#include <span>
#include <string>
#include <vector>
#include "absl/strings/string_view.h"
#include "api/array_view.h"
namespace webrtc {
@ -55,7 +55,7 @@ class DataChannelEventObserverInterface {
void set_data_type(DataType type) { data_type_ = type; }
const std::vector<uint8_t>& data() const { return data_; }
void set_data(ArrayView<const uint8_t> d) {
void set_data(std::span<const uint8_t> d) {
data_.assign(d.begin(), d.end());
}

View File

@ -12,11 +12,11 @@
#include <cstddef>
#include <cstdint>
#include <span>
#include <string_view>
#include "absl/functional/any_invocable.h"
#include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "api/candidate.h"
#include "api/ref_count.h"
#include "api/units/timestamp.h"
@ -48,7 +48,7 @@ class RTC_EXPORT DatagramConnection : public RefCountInterface {
struct PacketMetadata {
Timestamp receive_time;
};
virtual void OnPacketReceived(ArrayView<const uint8_t> data,
virtual void OnPacketReceived(std::span<const uint8_t> data,
PacketMetadata metadata) = 0;
// Notification of outcome of an earlier call to SendPacket.
@ -96,13 +96,13 @@ class RTC_EXPORT DatagramConnection : public RefCountInterface {
// performed, the caller is responsible for ensuring uniqueness and handing
// rollovers.
PacketId id = 0;
ArrayView<const uint8_t> payload;
std::span<const uint8_t> payload;
};
// Send a batch of packets on this connection. Listen to
// Observer::OnSendOutcome for notification of whether each was sent
// successfully.
virtual void SendPackets(ArrayView<PacketSendParameters> packets) = 0;
virtual void SendPackets(std::span<PacketSendParameters> packets) = 0;
// Initiate closing connection and releasing resources. Must be called before
// destruction.

View File

@ -14,9 +14,9 @@
#include <cstdint>
#include <memory>
#include <optional>
#include <span>
#include <string>
#include "api/array_view.h"
#include "api/ref_count.h"
#include "api/scoped_refptr.h"
#include "api/units/time_delta.h"
@ -46,10 +46,10 @@ class TransformableFrameInterface {
// Returns the frame payload data. The data is valid until the next non-const
// method call.
virtual ArrayView<const uint8_t> GetData() const = 0;
virtual std::span<const uint8_t> GetData() const = 0;
// Copies `data` into the owned frame payload data.
virtual void SetData(ArrayView<const uint8_t> data) = 0;
virtual void SetData(std::span<const uint8_t> data) = 0;
virtual uint8_t GetPayloadType() const = 0;
virtual bool CanSetPayloadType() const { return false; }
@ -125,7 +125,7 @@ class TransformableAudioFrameInterface : public TransformableFrameInterface {
RTC_EXPORT explicit TransformableAudioFrameInterface(Passkey passkey);
~TransformableAudioFrameInterface() override = default;
virtual ArrayView<const uint32_t> GetContributingSources() const = 0;
virtual std::span<const uint32_t> GetContributingSources() const = 0;
virtual const std::optional<uint16_t> SequenceNumber() const = 0;

View File

@ -17,7 +17,6 @@ rtc_library("neteq_api") {
]
deps = [
"..:array_view",
"..:rtp_headers",
"..:rtp_packet_info",
"..:scoped_refptr",

View File

@ -1,14 +1,14 @@
specific_include_rules = {
"custom_neteq_factory\.h": [
"custom_neteq_factory\\.h": [
"+system_wrappers/include/clock.h",
],
"default_neteq_factory\.h": [
"default_neteq_factory\\.h": [
"+system_wrappers/include/clock.h",
],
"neteq_controller\.h": [
"neteq_controller\\.h": [
"+system_wrappers/include/clock.h",
],
"neteq_factory\.h": [
"neteq_factory\\.h": [
"+system_wrappers/include/clock.h",
],
}

View File

@ -16,12 +16,13 @@
#include <map>
#include <optional>
#include <span>
#include <string>
#include <vector>
#include "api/array_view.h"
// RingRTC change to configure opus
#include "api/audio_codecs/audio_decoder.h"
// End RingRTC change
#include "api/audio_codecs/audio_format.h"
#include "api/rtp_headers.h"
#include "api/rtp_packet_info.h"
@ -33,28 +34,29 @@ namespace webrtc {
class AudioFrame;
struct NetEqNetworkStatistics {
uint16_t current_buffer_size_ms; // Current jitter buffer size in ms.
uint16_t preferred_buffer_size_ms; // Target buffer size in ms.
uint16_t jitter_peaks_found; // 1 if adding extra delay due to peaky
// jitter; 0 otherwise.
uint16_t expand_rate; // Fraction (of original stream) of synthesized
// audio inserted through expansion (in Q14).
uint16_t speech_expand_rate; // Fraction (of original stream) of synthesized
// speech inserted through expansion (in Q14).
uint16_t preemptive_rate; // Fraction of data inserted through pre-emptive
// expansion (in Q14).
uint16_t accelerate_rate; // Fraction of data removed through acceleration
// (in Q14).
uint16_t secondary_decoded_rate; // Fraction of data coming from FEC/RED
// decoding (in Q14).
uint16_t secondary_discarded_rate; // Fraction of discarded FEC/RED data (in
// Q14).
uint16_t current_buffer_size_ms = 0; // Current jitter buffer size in ms.
uint16_t preferred_buffer_size_ms = 0; // Target buffer size in ms.
uint16_t jitter_peaks_found =
0; // 1 if adding extra delay due to peaky jitter; 0 otherwise.
uint16_t expand_rate = 0; // Fraction (of original stream) of synthesized
// audio inserted through expansion (in Q14).
uint16_t speech_expand_rate =
0; // Fraction (of original stream) of synthesized speech inserted
// through expansion (in Q14).
uint16_t preemptive_rate =
0; // Fraction of data inserted through preemptive expansion (in Q14).
uint16_t accelerate_rate =
0; // Fraction of data removed through acceleration (in Q14).
uint16_t secondary_decoded_rate =
0; // Fraction of data coming from FEC/RED decoding (in Q14).
uint16_t secondary_discarded_rate =
0; // Fraction of discarded FEC/RED data (in Q14).
// Statistics for packet waiting times, i.e., the time between a packet
// arrives until it is decoded.
int mean_waiting_time_ms;
int median_waiting_time_ms;
int min_waiting_time_ms;
int max_waiting_time_ms;
int mean_waiting_time_ms = 0;
int median_waiting_time_ms = 0;
int min_waiting_time_ms = 0;
int max_waiting_time_ms = 0;
};
// NetEq statistics that persist over the lifetime of the class.
@ -187,14 +189,14 @@ class NetEq {
virtual ~NetEq() {}
virtual int InsertPacket(const RTPHeader& rtp_header,
ArrayView<const uint8_t> payload) {
std::span<const uint8_t> payload) {
return InsertPacket(rtp_header, payload,
/*receive_time=*/Timestamp::MinusInfinity());
}
// TODO: webrtc:343501093 - removed unused method.
virtual int InsertPacket(const RTPHeader& rtp_header,
ArrayView<const uint8_t> payload,
std::span<const uint8_t> payload,
Timestamp receive_time) {
return InsertPacket(rtp_header, payload,
RtpPacketInfo(rtp_header, receive_time));
@ -204,7 +206,7 @@ class NetEq {
// Returns 0 on success, -1 on failure.
// TODO: webrtc:343501093 - Make this method pure virtual.
virtual int InsertPacket(const RTPHeader& rtp_header,
ArrayView<const uint8_t> payload,
std::span<const uint8_t> payload,
const RtpPacketInfo& /* rtp_packet_info */) {
return InsertPacket(rtp_header, payload);
}

View File

@ -16,7 +16,6 @@ rtc_library("numerics") {
"samples_stats_counter.h",
]
deps = [
"..:array_view",
"../../rtc_base:checks",
"../../rtc_base:rtc_numerics",
"../units:timestamp",

View File

@ -1,6 +1,6 @@
specific_include_rules = {
# Some internal headers are allowed even in API headers:
"samples_stats_counter\.h": [
"samples_stats_counter\\.h": [
"+rtc_base/numerics/running_statistics.h",
]
}

View File

@ -15,10 +15,10 @@
#include <stdint.h>
#include <map>
#include <span>
#include <string>
#include <vector>
#include "api/array_view.h"
#include "api/units/timestamp.h"
#include "rtc_base/checks.h"
#include "rtc_base/numerics/running_statistics.h"
@ -102,7 +102,7 @@ class SamplesStatsCounter {
// guarantees of order, so samples can be in different order comparing to in
// which they were added into counter. Also return value will be invalidate
// after call to any non const method.
ArrayView<const StatsSample> GetTimedSamples() const { return samples_; }
std::span<const StatsSample> GetTimedSamples() const { return samples_; }
std::vector<double> GetSamples() const {
std::vector<double> out;
out.reserve(samples_.size());

77
api/payload_type.h Normal file
View File

@ -0,0 +1,77 @@
/*
* Copyright 2024 The WebRTC Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef API_PAYLOAD_TYPE_H_
#define API_PAYLOAD_TYPE_H_
#include <optional>
#include "absl/strings/str_format.h"
#include "rtc_base/strong_alias.h"
namespace webrtc {
class PayloadType : public StrongAlias<class PayloadTypeTag, int> {
public:
// The default constructor makes a NotSet.
PayloadType() : StrongAlias(-1) {}
// Non-explicit conversions from and to ints are to be deprecated and
// removed once calling code is upgraded.
constexpr PayloadType(int pt) : StrongAlias(pt) { // NOLINT: explicit
// The number of tests that use invalid values is high enough that
// this DCHECK can't be deployed yet.
// Also, allow -1 as argument as a temporary measure. Those calls should
// eventually be replaced with PayloadType::NotSet() values.
// Intended check:
// RTC_DCHECK(pt >= -1 && pt <= 127) << "Payload type " << pt << " is
// invalid";
}
constexpr operator int() const& { return value(); } // NOLINT: explicit
// Factory function to create a value if you need to check for
// values in the valid range.
static std::optional<PayloadType> Create(int pt) {
if (pt < 0 || pt > 127) {
return std::nullopt;
}
return PayloadType(pt);
}
// Factory function for the NotSet value. This should be the only way
// to create a value outside the valid range.
static constexpr PayloadType NotSet() { return PayloadType(Internal{}, -1); }
bool Valid(bool rtcp_mux = false) {
// A payload type is a 7-bit value in the RTP header, so max = 127.
// If RTCP multiplexing is used, the numbers from 64 to 95 are reserved
// for RTCP packets.
if (rtcp_mux && (value() > 63 && value() < 96)) {
return false;
}
return value() >= 0 && value() <= 127;
}
// Older interface to validity check.
static bool IsValid(PayloadType id, bool rtcp_mux) {
return id.Valid(rtcp_mux);
}
bool IsSet() { return value() >= 0; }
private:
class Internal {};
// Allow -1 for "NotSet"
explicit constexpr PayloadType(Internal tag, int pt) : StrongAlias(pt) {}
template <typename Sink>
friend void AbslStringify(Sink& sink, const PayloadType pt) {
absl::Format(&sink, "%d", pt.value());
}
};
} // namespace webrtc
#endif // API_PAYLOAD_TYPE_H_

View File

@ -16,6 +16,8 @@
#include "absl/strings/string_view.h"
#include "rtc_base/strings/string_builder.h"
namespace webrtc {
namespace {
absl::string_view kRTCErrorTypeNames[] = {
@ -32,11 +34,10 @@ absl::string_view kRTCErrorTypeNames[] = {
"INTERNAL_ERROR",
"OPERATION_ERROR_WITH_DATA",
};
static_assert(
static_cast<int>(webrtc::RTCErrorType::OPERATION_ERROR_WITH_DATA) ==
(std::size(kRTCErrorTypeNames) - 1),
"kRTCErrorTypeNames must have as many strings as RTCErrorType "
"has values.");
static_assert(static_cast<int>(RTCErrorType::OPERATION_ERROR_WITH_DATA) ==
(std::size(kRTCErrorTypeNames) - 1),
"kRTCErrorTypeNames must have as many strings as RTCErrorType "
"has values.");
absl::string_view kRTCErrorDetailTypeNames[] = {
"NONE",
@ -48,16 +49,13 @@ absl::string_view kRTCErrorDetailTypeNames[] = {
"HARDWARE_ENCODER_NOT_AVAILABLE",
"HARDWARE_ENCODER_ERROR",
};
static_assert(
static_cast<int>(webrtc::RTCErrorDetailType::HARDWARE_ENCODER_ERROR) ==
(std::size(kRTCErrorDetailTypeNames) - 1),
"kRTCErrorDetailTypeNames must have as many strings as "
"RTCErrorDetailType has values.");
static_assert(static_cast<int>(RTCErrorDetailType::HARDWARE_ENCODER_ERROR) ==
(std::size(kRTCErrorDetailTypeNames) - 1),
"kRTCErrorDetailTypeNames must have as many strings as "
"RTCErrorDetailType has values.");
} // namespace
namespace webrtc {
// static
RTCError RTCError::OK() {
return RTCError();

View File

@ -225,20 +225,6 @@ class RTC_EXPORT RTCError {
std::optional<uint16_t> sctp_cause_code_;
};
// Helper macro that can be used by implementations to create an error with a
// message and log it. `message` should be a string literal or movable
// std::string.
#define LOG_AND_RETURN_ERROR_EX(type, message, severity) \
{ \
RTC_DCHECK(type != RTCErrorType::NONE); \
RTC_LOG(severity) << message << " (" << ::webrtc::ToString(type) << ")"; \
return ::webrtc::RTCError(type, message); \
}
// LOG_AND_RETURN_ERROR is a s simpler variant of `LOG_AND_RETURN_ERROR_EX`.
#define LOG_AND_RETURN_ERROR(type, message) \
LOG_AND_RETURN_ERROR_EX(type, message, LS_ERROR)
inline RTCError LogErrorImpl(RTCError error,
LoggingSeverity severity,
const char* file,
@ -255,7 +241,6 @@ inline RTCError LogErrorImpl(RTCError error,
return error;
}
// A slightly more C++ looking alternative to the LOG_AND_RETURN_ERROR() macro.
// This approach does not hide the return statement and also allows for
// constructing/formatting the error string inline.
//

View File

@ -259,7 +259,7 @@ TEST(RTCErrorOrTest, BuildString) {
EXPECT_STREQ(error.message(), "StringyBuilder #2");
}
// Tests a non macro based alternative to `LOG_AND_RETURN_ERROR`.
// Tests `LOG_ERROR`.
TEST(RTCErrorOrTest, BuildStringLog) {
class LogSinkImpl : public LogSink {
public:

View File

@ -18,24 +18,48 @@
#include "api/rtp_headers.h"
#include "api/units/timestamp.h"
#include "modules/rtp_rtcp/source/rtp_header_extensions.h"
#include "modules/rtp_rtcp/source/rtp_packet_received.h"
namespace webrtc {
RtpPacketInfo::RtpPacketInfo()
: ssrc_(0), rtp_timestamp_(0), receive_time_(Timestamp::MinusInfinity()) {}
: sequence_number_(0),
ssrc_(0),
rtp_timestamp_(0),
receive_time_(Timestamp::MinusInfinity()) {}
RtpPacketInfo::RtpPacketInfo(const RtpPacketReceived& rtp_packet)
: sequence_number_(rtp_packet.SequenceNumber()),
ssrc_(rtp_packet.Ssrc()),
csrcs_(rtp_packet.Csrcs()),
rtp_timestamp_(rtp_packet.Timestamp()),
receive_time_(rtp_packet.arrival_time()) {
AudioLevel audio_level;
if (rtp_packet.GetExtension<AudioLevelExtension>(&audio_level)) {
audio_level_ = audio_level.level();
}
AbsoluteCaptureTime capture_time;
if (rtp_packet.GetExtension<AbsoluteCaptureTimeExtension>(&capture_time)) {
absolute_capture_time_ = std::move(capture_time);
}
}
RtpPacketInfo::RtpPacketInfo(uint32_t ssrc,
std::vector<uint32_t> csrcs,
uint32_t rtp_timestamp,
Timestamp receive_time)
: ssrc_(ssrc),
: sequence_number_(0),
ssrc_(ssrc),
csrcs_(std::move(csrcs)),
rtp_timestamp_(rtp_timestamp),
receive_time_(receive_time) {}
RtpPacketInfo::RtpPacketInfo(const RTPHeader& rtp_header,
Timestamp receive_time)
: ssrc_(rtp_header.ssrc),
: sequence_number_(rtp_header.sequenceNumber),
ssrc_(rtp_header.ssrc),
rtp_timestamp_(rtp_header.timestamp),
receive_time_(receive_time) {
const auto& extension = rtp_header.extension;
@ -50,13 +74,6 @@ RtpPacketInfo::RtpPacketInfo(const RTPHeader& rtp_header,
absolute_capture_time_ = extension.absolute_capture_time;
}
bool operator==(const RtpPacketInfo& lhs, const RtpPacketInfo& rhs) {
return (lhs.ssrc() == rhs.ssrc()) && (lhs.csrcs() == rhs.csrcs()) &&
(lhs.rtp_timestamp() == rhs.rtp_timestamp()) &&
(lhs.receive_time() == rhs.receive_time()) &&
(lhs.audio_level() == rhs.audio_level()) &&
(lhs.absolute_capture_time() == rhs.absolute_capture_time()) &&
(lhs.local_capture_clock_offset() == rhs.local_capture_clock_offset());
}
bool operator==(const RtpPacketInfo& lhs, const RtpPacketInfo& rhs) = default;
} // namespace webrtc

View File

@ -23,6 +23,8 @@
namespace webrtc {
class RtpPacketReceived;
//
// Structure to hold information about a received `RtpPacket`. It is primarily
// used to carry per-packet information from when a packet is received until
@ -32,11 +34,17 @@ class RTC_EXPORT RtpPacketInfo {
public:
RtpPacketInfo();
explicit RtpPacketInfo(const RtpPacketReceived& rtp_packet);
// TODO: bugs.webrtc.org/42225366 - The constructor will be deprecated. Use
// RtpPacketInfo(const RtpPacketReceived& rtp_packet).
RtpPacketInfo(uint32_t ssrc,
std::vector<uint32_t> csrcs,
uint32_t rtp_timestamp,
Timestamp receive_time);
// TODO: bugs.webrtc.org/42225366 - The constructor will be deprecated. Use
// RtpPacketInfo(const RtpPacketReceived& rtp_packet).
RtpPacketInfo(const RTPHeader& rtp_header, Timestamp receive_time);
RtpPacketInfo(const RtpPacketInfo& other) = default;
@ -47,6 +55,9 @@ class RTC_EXPORT RtpPacketInfo {
uint32_t ssrc() const { return ssrc_; }
void set_ssrc(uint32_t value) { ssrc_ = value; }
uint16_t sequence_number() const { return sequence_number_; }
void set_sequence_number(uint16_t value) { sequence_number_ = value; }
const std::vector<uint32_t>& csrcs() const { return csrcs_; }
void set_csrcs(std::vector<uint32_t> value) { csrcs_ = std::move(value); }
@ -80,9 +91,12 @@ class RTC_EXPORT RtpPacketInfo {
return *this;
}
friend bool operator==(const RtpPacketInfo& lhs, const RtpPacketInfo& rhs);
private:
// Fields from the RTP header:
// https://tools.ietf.org/html/rfc3550#section-5.1
uint16_t sequence_number_;
uint32_t ssrc_;
std::vector<uint32_t> csrcs_;
uint32_t rtp_timestamp_;
@ -106,12 +120,6 @@ class RTC_EXPORT RtpPacketInfo {
std::optional<TimeDelta> local_capture_clock_offset_;
};
bool operator==(const RtpPacketInfo& lhs, const RtpPacketInfo& rhs);
inline bool operator!=(const RtpPacketInfo& lhs, const RtpPacketInfo& rhs) {
return !(lhs == rhs);
}
} // namespace webrtc
#endif // API_RTP_PACKET_INFO_H_

View File

@ -17,9 +17,29 @@
#include "api/rtp_headers.h"
#include "api/units/time_delta.h"
#include "api/units/timestamp.h"
#include "modules/rtp_rtcp/include/rtp_header_extension_map.h"
#include "modules/rtp_rtcp/source/rtp_header_extensions.h"
#include "modules/rtp_rtcp/source/rtp_packet_received.h"
#include "rtc_base/checks.h"
#include "test/gmock.h"
#include "test/gtest.h"
namespace webrtc {
namespace {
using ::testing::ElementsAreArray;
using ::testing::Optional;
template <typename ExtensionType,
typename ExtensionValue = ExtensionType::value_type>
RtpPacketReceived CreateRtpPacketReceivedWithExtension(ExtensionValue value) {
RtpHeaderExtensionMap extensions;
extensions.Register<ExtensionType>(5);
RtpPacketReceived packet(&extensions);
RTC_CHECK(packet.SetExtension<ExtensionType>(value))
<< "Unable to set extension.";
return packet;
}
TEST(RtpPacketInfoTest, Ssrc) {
constexpr uint32_t kValue = 4038189233;
@ -44,13 +64,12 @@ TEST(RtpPacketInfoTest, Ssrc) {
rhs = RtpPacketInfo();
EXPECT_NE(rhs.ssrc(), kValue);
rhs = RtpPacketInfo(/*ssrc=*/kValue, /*csrcs=*/{}, /*rtp_timestamp=*/{},
/*receive_time=*/Timestamp::Zero());
rhs.set_ssrc(kValue);
EXPECT_EQ(rhs.ssrc(), kValue);
}
TEST(RtpPacketInfoTest, Csrcs) {
const std::vector<uint32_t> value = {4038189233, 3016333617, 1207992985};
TEST(RtpPacketInfoTest, SequenceNumber) {
constexpr uint16_t kValue = 34653;
RtpPacketInfo lhs;
RtpPacketInfo rhs;
@ -58,8 +77,8 @@ TEST(RtpPacketInfoTest, Csrcs) {
EXPECT_TRUE(lhs == rhs);
EXPECT_FALSE(lhs != rhs);
rhs.set_csrcs(value);
EXPECT_EQ(rhs.csrcs(), value);
rhs.set_sequence_number(kValue);
EXPECT_EQ(rhs.sequence_number(), kValue);
EXPECT_FALSE(lhs == rhs);
EXPECT_TRUE(lhs != rhs);
@ -70,11 +89,37 @@ TEST(RtpPacketInfoTest, Csrcs) {
EXPECT_FALSE(lhs != rhs);
rhs = RtpPacketInfo();
EXPECT_NE(rhs.csrcs(), value);
EXPECT_NE(rhs.sequence_number(), kValue);
rhs = RtpPacketInfo(/*ssrc=*/{}, /*csrcs=*/value, /*rtp_timestamp=*/{},
/*receive_time=*/Timestamp::Zero());
EXPECT_EQ(rhs.csrcs(), value);
rhs.set_sequence_number(kValue);
EXPECT_EQ(rhs.sequence_number(), kValue);
}
TEST(RtpPacketInfoTest, Csrcs) {
const std::vector<uint32_t> kValue = {4038189233, 3016333617, 1207992985};
RtpPacketInfo lhs;
RtpPacketInfo rhs;
EXPECT_TRUE(lhs == rhs);
EXPECT_FALSE(lhs != rhs);
rhs.set_csrcs(kValue);
EXPECT_EQ(rhs.csrcs(), kValue);
EXPECT_FALSE(lhs == rhs);
EXPECT_TRUE(lhs != rhs);
lhs = rhs;
EXPECT_TRUE(lhs == rhs);
EXPECT_FALSE(lhs != rhs);
rhs = RtpPacketInfo();
EXPECT_NE(rhs.csrcs(), kValue);
rhs.set_csrcs(kValue);
EXPECT_EQ(rhs.csrcs(), kValue);
}
TEST(RtpPacketInfoTest, RtpTimestamp) {
@ -100,8 +145,7 @@ TEST(RtpPacketInfoTest, RtpTimestamp) {
rhs = RtpPacketInfo();
EXPECT_NE(rhs.rtp_timestamp(), kValue);
rhs = RtpPacketInfo(/*ssrc=*/{}, /*csrcs=*/{}, /*rtp_timestamp=*/kValue,
/*receive_time=*/Timestamp::Zero());
rhs.set_rtp_timestamp(kValue);
EXPECT_EQ(rhs.rtp_timestamp(), kValue);
}
@ -128,8 +172,7 @@ TEST(RtpPacketInfoTest, ReceiveTimeMs) {
rhs = RtpPacketInfo();
EXPECT_NE(rhs.receive_time(), kValue);
rhs = RtpPacketInfo(/*ssrc=*/{}, /*csrcs=*/{}, /*rtp_timestamp=*/{},
/*receive_time=*/kValue);
rhs.set_receive_time(kValue);
EXPECT_EQ(rhs.receive_time(), kValue);
}
@ -156,8 +199,6 @@ TEST(RtpPacketInfoTest, AudioLevel) {
rhs = RtpPacketInfo();
EXPECT_NE(rhs.audio_level(), kValue);
rhs = RtpPacketInfo(/*ssrc=*/{}, /*csrcs=*/{}, /*rtp_timestamp=*/{},
/*receive_time=*/Timestamp::Zero());
rhs.set_audio_level(kValue);
EXPECT_EQ(rhs.audio_level(), kValue);
}
@ -186,8 +227,6 @@ TEST(RtpPacketInfoTest, AbsoluteCaptureTime) {
rhs = RtpPacketInfo();
EXPECT_NE(rhs.absolute_capture_time(), kValue);
rhs = RtpPacketInfo(/*ssrc=*/{}, /*csrcs=*/{}, /*rtp_timestamp=*/{},
/*receive_time=*/Timestamp::Zero());
rhs.set_absolute_capture_time(kValue);
EXPECT_EQ(rhs.absolute_capture_time(), kValue);
}
@ -215,10 +254,52 @@ TEST(RtpPacketInfoTest, LocalCaptureClockOffset) {
rhs = RtpPacketInfo();
EXPECT_EQ(rhs.local_capture_clock_offset(), std::nullopt);
rhs = RtpPacketInfo(/*ssrc=*/{}, /*csrcs=*/{}, /*rtp_timestamp=*/{},
/*receive_time=*/Timestamp::Zero());
rhs.set_local_capture_clock_offset(kValue);
EXPECT_EQ(rhs.local_capture_clock_offset(), kValue);
}
TEST(RtpPacketInfoTest, RtpPacketReceivedNoExtensions) {
constexpr Timestamp kArrivalTime = Timestamp::Micros(8868963877546349045LL);
constexpr uint32_t kSsrc = 4038189233;
constexpr uint16_t kSequenceNumber = 1234;
constexpr uint32_t kRtpTimestamp = 5684353;
const std::vector<uint32_t> kCsrcs = {15, 60};
RtpPacketReceived packet;
packet.set_arrival_time(kArrivalTime);
packet.SetSsrc(kSsrc);
packet.SetCsrcs(kCsrcs);
packet.SetSequenceNumber(kSequenceNumber);
packet.SetTimestamp(kRtpTimestamp);
RtpPacketInfo rtp_packet_info(packet);
EXPECT_EQ(rtp_packet_info.ssrc(), kSsrc);
EXPECT_EQ(rtp_packet_info.sequence_number(), kSequenceNumber);
EXPECT_THAT(rtp_packet_info.csrcs(), ElementsAreArray(kCsrcs));
EXPECT_EQ(rtp_packet_info.rtp_timestamp(), kRtpTimestamp);
EXPECT_EQ(rtp_packet_info.receive_time(), kArrivalTime);
}
TEST(RtpPacketInfoTest, RtpPacketReceivedAudioLevel) {
constexpr uint8_t kValue = 14;
RtpPacketReceived packet =
CreateRtpPacketReceivedWithExtension<AudioLevelExtension>(
AudioLevel(/*voice_activity=*/true, /*level=*/kValue));
EXPECT_THAT(RtpPacketInfo(packet).audio_level(), Optional(kValue));
}
TEST(RtpPacketInfoTest, RtpPacketReceivedAbsoluteCaptureTime) {
const AbsoluteCaptureTime kAbsoluteCaptureTime = {
.absolute_capture_timestamp = 1493489345934859334,
.estimated_capture_clock_offset = 3453534534};
RtpPacketReceived packet =
CreateRtpPacketReceivedWithExtension<AbsoluteCaptureTimeExtension>(
kAbsoluteCaptureTime);
EXPECT_THAT(RtpPacketInfo(packet).absolute_capture_time(),
Optional(kAbsoluteCaptureTime));
}
} // namespace
} // namespace webrtc

View File

@ -18,7 +18,6 @@
#include "absl/strings/ascii.h"
#include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "api/rtc_error.h"
#include "api/rtp_transceiver_direction.h"
#include "media/base/media_constants.h"
@ -206,15 +205,14 @@ RtpParameters::RtpParameters(const RtpParameters& rhs) = default;
RtpParameters::~RtpParameters() = default;
std::string RtpExtension::ToString() const {
char buf[256];
SimpleStringBuilder sb(buf);
StringBuilder sb;
sb << "{uri: " << uri;
sb << ", id: " << id;
if (encrypt) {
sb << ", encrypt";
}
sb << '}';
return sb.str();
sb << "}";
return sb.Release();
}
bool RtpExtension::IsSupportedForAudio(absl::string_view uri) {
@ -248,14 +246,6 @@ bool RtpExtension::IsSupportedForVideo(absl::string_view uri) {
bool RtpExtension::IsEncryptionSupported(absl::string_view uri) {
return
#if defined(ENABLE_EXTERNAL_AUTH)
// TODO(jbauch): Figure out a way to always allow "kAbsSendTimeUri"
// here and filter out later if external auth is really used in
// srtpfilter. External auth is used by Chromium and replaces the
// extension header value of "kAbsSendTimeUri", so it must not be
// encrypted (which can't be done by Chromium).
uri != RtpExtension::kAbsSendTimeUri &&
#endif
uri != RtpExtension::kEncryptHeaderExtensionsUri;
}

View File

@ -13,6 +13,7 @@
#include <stdint.h>
#include <cstddef>
#include <map>
#include <optional>
#include <string>
@ -27,6 +28,7 @@
#include "api/rtp_transceiver_direction.h"
#include "api/video/resolution.h"
#include "api/video_codecs/scalability_mode.h"
#include "rtc_base/strings/str_join.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
@ -227,6 +229,30 @@ struct RTC_EXPORT RtpCodec {
bool operator!=(const RtpCodec& o) const { return !(*this == o); }
bool IsResiliencyCodec() const;
bool IsMediaCodec() const;
template <typename Sink>
friend void AbslStringify(Sink& sink, const RtpCodec& c) {
absl::Format(&sink, "{mime_type: %s", c.mime_type());
if (c.clock_rate) {
absl::Format(&sink, ", clock_rate: %d", *c.clock_rate);
}
if (c.num_channels) {
absl::Format(&sink, ", num_channels: %d", *c.num_channels);
}
if (!c.parameters.empty()) {
sink.Append(", parameters: {");
bool first = true;
for (const auto& kv : c.parameters) {
if (!first) {
sink.Append(", ");
}
absl::Format(&sink, "%s: %s", kv.first, kv.second);
first = false;
}
sink.Append("}");
}
sink.Append("}");
}
};
// RtpCodecCapability is to RtpCodecParameters as RtpCapabilities is to
@ -643,6 +669,44 @@ struct RTC_EXPORT RtpEncodingParameters {
bool operator!=(const RtpEncodingParameters& o) const {
return !(*this == o);
}
template <typename Sink>
friend void AbslStringify(Sink& sink, const RtpEncodingParameters& p) {
sink.Append("{");
if (p.ssrc)
absl::Format(&sink, "ssrc: %u, ", *p.ssrc);
absl::Format(&sink, "active: %s, ", p.active ? "true" : "false");
absl::Format(&sink, "rid: '%s', ", p.rid);
if (p.max_bitrate_bps) {
absl::Format(&sink, "max_bitrate_bps: %d, ", *p.max_bitrate_bps);
}
if (p.min_bitrate_bps) {
absl::Format(&sink, "min_bitrate_bps: %d, ", *p.min_bitrate_bps);
}
if (p.max_framerate) {
absl::Format(&sink, "max_framerate: %.2f, ", *p.max_framerate);
}
if (p.num_temporal_layers) {
absl::Format(&sink, "num_temporal_layers: %d, ", *p.num_temporal_layers);
}
if (p.scale_resolution_down_by) {
absl::Format(&sink, "scale_resolution_down_by: %.2f, ",
*p.scale_resolution_down_by);
}
if (p.scale_resolution_down_to) {
absl::Format(&sink, "scale_resolution_down_to: %dx%d, ",
p.scale_resolution_down_to->width,
p.scale_resolution_down_to->height);
}
if (p.scalability_mode) {
absl::Format(&sink, "scalability_mode: '%s', ", *p.scalability_mode);
}
if (p.codec) {
absl::Format(&sink, "codec: %v, ", *p.codec);
}
absl::Format(&sink, "adaptive_ptime: %s}",
p.adaptive_ptime ? "true" : "false");
}
};
struct RTC_EXPORT RtpCodecParameters : public RtpCodec {
@ -661,7 +725,8 @@ struct RTC_EXPORT RtpCodecParameters : public RtpCodec {
bool operator!=(const RtpCodecParameters& o) const { return !(*this == o); }
template <typename Sink>
friend void AbslStringify(Sink& sink, const RtpCodecParameters& p) {
absl::Format(&sink, "[%d: %s]", p.payload_type, p.mime_type());
absl::Format(&sink, "{payload_type: %d, codec: %v}", p.payload_type,
static_cast<const RtpCodec&>(p));
}
};
@ -722,6 +787,17 @@ struct RtcpParameters final {
reduced_size == o.reduced_size && mux == o.mux;
}
bool operator!=(const RtcpParameters& o) const { return !(*this == o); }
template <typename Sink>
friend void AbslStringify(Sink& sink, const RtcpParameters& p) {
sink.Append("{");
if (p.ssrc)
absl::Format(&sink, "ssrc: %u, ", *p.ssrc);
absl::Format(&sink, "cname: '%s', ", p.cname);
absl::Format(&sink, "reduced_size: %s, ",
p.reduced_size ? "true" : "false");
absl::Format(&sink, "mux: %s}", p.mux ? "true" : "false");
}
};
struct RTC_EXPORT RtpParameters {
@ -768,6 +844,23 @@ struct RTC_EXPORT RtpParameters {
// If at least two active encodings have different codec values
// (including one being unset and another set), this is considered mixed.
bool IsMixedCodec() const;
template <typename Sink>
friend void AbslStringify(Sink& sink, const RtpParameters& p) {
sink.Append("{");
absl::Format(&sink, "transaction_id: '%s', ", p.transaction_id);
absl::Format(&sink, "mid: '%s', ", p.mid);
absl::Format(&sink, "codecs: [%v], ", StrJoin(p.codecs, ", "));
absl::Format(&sink, "header_extensions: [%v], ",
StrJoin(p.header_extensions, ", "));
absl::Format(&sink, "encodings: [%v], ", StrJoin(p.encodings, ", "));
absl::Format(&sink, "rtcp: %v", p.rtcp);
if (p.degradation_preference) {
absl::Format(&sink, ", degradation_preference: %s",
DegradationPreferenceToString(*p.degradation_preference));
}
sink.Append("}");
}
};
} // namespace webrtc

View File

@ -25,9 +25,13 @@
#include "api/media_stream_interface.h"
#include "api/media_types.h"
#include "api/ref_count.h"
#include "api/rtc_error.h"
#include "api/rtp_parameters.h"
#include "api/scoped_refptr.h"
#include "api/sframe/sframe_decrypter_interface.h"
#include "api/sframe/sframe_types.h"
#include "api/transport/rtp/rtp_source.h"
#include "rtc_base/checks.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
@ -131,6 +135,17 @@ class RTC_EXPORT RtpReceiverInterface : public RefCountInterface,
void SetFrameTransformer(
scoped_refptr<FrameTransformerInterface> frame_transformer) override;
// Creates an internal Sframe decrypter and returns a handle for key
// management.
// Default implementation of CreateSframeDecrypterOrError.
// TODO: issues.webrtc.org/479862368 - make pure virtual when all
// implementations are updated
virtual RTCErrorOr<scoped_refptr<SframeDecrypterInterface>>
CreateSframeDecrypterOrError(SframeCipherSuite cipher_suite) {
RTC_DCHECK_NOTREACHED();
return RTCError();
}
protected:
~RtpReceiverInterface() override = default;
};

View File

@ -31,7 +31,9 @@
#include "api/rtc_error.h"
#include "api/rtp_parameters.h"
#include "api/scoped_refptr.h"
#include "api/sframe/sframe_encrypter_interface.h"
#include "api/video_codecs/video_encoder_factory.h"
#include "rtc_base/checks.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
@ -135,6 +137,17 @@ class RTC_EXPORT RtpSenderInterface : public RefCountInterface,
void SetFrameTransformer(scoped_refptr<FrameTransformerInterface>
/* frame_transformer */) override {}
// Creates an internal Sframe encrypter and returns a handle for key
// management.
// Default implementation of CreateSframeEncrypterOrError.
// TODO: bugs.webrtc.org/479862368 - remove when all implementations are
// updated
virtual RTCErrorOr<scoped_refptr<SframeEncrypterInterface>>
CreateSframeEncrypterOrError(const SframeEncrypterInit& options) {
RTC_DCHECK_NOTREACHED();
return RTCError();
}
// TODO(crbug.com/1354101): make pure virtual again after Chrome roll.
virtual RTCError GenerateKeyFrame(const std::vector<std::string>& rids) {
return RTCError::OK();

View File

@ -12,11 +12,11 @@
#define API_RTP_TRANSCEIVER_INTERFACE_H_
#include <optional>
#include <span>
#include <string>
#include <vector>
#include "absl/base/attributes.h"
#include "api/array_view.h"
#include "api/media_types.h"
#include "api/ref_count.h"
#include "api/rtc_error.h"
@ -152,7 +152,7 @@ class RTC_EXPORT RtpTransceiverInterface : public RefCountInterface {
// by WebRTC for this transceiver.
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-setcodecpreferences
virtual RTCError SetCodecPreferences(
ArrayView<RtpCodecCapability> codecs) = 0;
std::span<RtpCodecCapability> codecs) = 0;
virtual std::vector<RtpCodecCapability> codec_preferences() const = 0;
// Returns the set of header extensions that was set
@ -172,7 +172,7 @@ class RTC_EXPORT RtpTransceiverInterface : public RefCountInterface {
// so that it negotiates use of header extensions which are not kStopped.
// https://w3c.github.io/webrtc-extensions/#rtcrtptransceiver-interface
virtual RTCError SetHeaderExtensionsToNegotiate(
ArrayView<const RtpHeaderExtensionCapability> header_extensions) = 0;
std::span<const RtpHeaderExtensionCapability> header_extensions) = 0;
protected:
~RtpTransceiverInterface() override = default;

View File

@ -0,0 +1,36 @@
/*
* Copyright 2026 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef API_SFRAME_SFRAME_DECRYPTER_INTERFACE_H_
#define API_SFRAME_SFRAME_DECRYPTER_INTERFACE_H_
#include <cstdint>
#include <span>
#include "api/ref_count.h"
#include "api/rtc_error.h"
namespace webrtc {
// Key management handle for Sframe receiver decryption.
class SframeDecrypterInterface : public RefCountInterface {
public:
virtual RTCError AddDecryptionKey(uint64_t key_id,
std::span<const uint8_t> key_material) = 0;
virtual RTCError RemoveDecryptionKey(uint64_t key_id) = 0;
protected:
~SframeDecrypterInterface() override = default;
};
} // namespace webrtc
#endif // API_SFRAME_SFRAME_DECRYPTER_INTERFACE_H_

View File

@ -0,0 +1,40 @@
/*
* Copyright 2026 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef API_SFRAME_SFRAME_ENCRYPTER_INTERFACE_H_
#define API_SFRAME_SFRAME_ENCRYPTER_INTERFACE_H_
#include <cstdint>
#include <span>
#include "api/ref_count.h"
#include "api/rtc_error.h"
#include "api/sframe/sframe_types.h"
namespace webrtc {
struct SframeEncrypterInit {
SframeMode mode;
SframeCipherSuite cipher_suite;
};
// Key management handle for Sframe sender encryption.
class SframeEncrypterInterface : public RefCountInterface {
public:
virtual RTCError SetEncryptionKey(uint64_t key_id,
std::span<const uint8_t> key_material) = 0;
protected:
~SframeEncrypterInterface() override = default;
};
} // namespace webrtc
#endif // API_SFRAME_SFRAME_ENCRYPTER_INTERFACE_H_

31
api/sframe/sframe_types.h Normal file
View File

@ -0,0 +1,31 @@
/*
* Copyright 2026 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef API_SFRAME_SFRAME_TYPES_H_
#define API_SFRAME_SFRAME_TYPES_H_
namespace webrtc {
enum class SframeMode {
kPerFrame,
kPerPacket,
};
enum class SframeCipherSuite {
kAes128CtrHmacSha256_80,
kAes128CtrHmacSha256_64,
kAes128CtrHmacSha256_32,
kAes128GcmSha256_128,
kAes256GcmSha512_128,
};
} // namespace webrtc
#endif // API_SFRAME_SFRAME_TYPES_H_

View File

@ -1,3 +1,4 @@
set noparent
hbos@webrtc.org
eshr@webrtc.org
hta@webrtc.org

View File

@ -1,13 +1,13 @@
specific_include_rules = {
"task_queue_base\.h": [
"task_queue_base\\.h": [
# Make TaskQueueBase RTC_LOCKABALE to allow annotate variables are only
# accessed on specific task queue.
"+rtc_base/thread_annotations.h",
],
"task_queue_test\.h": [
"task_queue_test\\.h": [
"+test/gtest.h",
],
"pending_task_safety_flag.h": [
"pending_task_safety_flag\\.h": [
"+rtc_base/checks.h",
"+rtc_base/system/no_unique_address.h",
],

View File

@ -19,6 +19,7 @@
#include "api/scoped_refptr.h"
#include "api/sequence_checker.h"
#include "api/task_queue/task_queue_base.h"
#include "rtc_base/checks.h"
#include "rtc_base/system/no_unique_address.h"
#include "rtc_base/system/rtc_export.h"
@ -165,6 +166,7 @@ class RTC_EXPORT ScopedTaskSafetyDetached final {
inline absl::AnyInvocable<void() &&> SafeTask(
scoped_refptr<PendingTaskSafetyFlag> flag,
absl::AnyInvocable<void() &&> task) {
RTC_DCHECK(flag);
return [flag = std::move(flag), task = std::move(task)]() mutable {
if (flag->alive()) {
std::move(task)();
@ -176,6 +178,7 @@ inline absl::AnyInvocable<void() &&> SafeTask(
inline absl::AnyInvocable<void()> SafeInvocable(
scoped_refptr<PendingTaskSafetyFlag> flag,
absl::AnyInvocable<void()> task) {
RTC_DCHECK(flag);
return [flag = std::move(flag), task = std::move(task)]() mutable {
if (flag->alive()) {
task();

View File

@ -15,6 +15,7 @@
#include <cstdint>
#include <memory>
#include <string>
#include <utility>
#include <vector>
@ -38,11 +39,14 @@
#include "rtc_base/event.h"
#include "rtc_base/ref_counter.h"
#include "rtc_base/time_utils.h"
#include "test/gmock.h"
#include "test/gtest.h"
namespace webrtc {
namespace {
using ::testing::ElementsAre;
// Avoids a dependency to system_wrappers.
void SleepFor(TimeDelta duration) {
ScopedAllowBaseSyncPrimitivesForTesting allow;
@ -81,6 +85,29 @@ TEST_P(TaskQueueTest, PostAndCheckCurrent) {
EXPECT_TRUE(event.Wait(TimeDelta::Seconds(1)));
}
// Verifies that a task can post a new task from within the task
// and that the new one eventually runs.
TEST_P(TaskQueueTest, TaskCanPostContinuationTask) {
std::unique_ptr<TaskQueueFactory> factory = GetParam()(nullptr);
auto queue = CreateTaskQueue(factory, "TaskCanPostContinuationTask");
std::vector<std::string> events;
Event done;
queue->PostTask([&events, &done, queue = queue.get()] {
events.push_back("Start");
queue->PostTask([&events, &done] {
events.push_back("Continue");
done.Set();
});
events.push_back("FirstDone");
});
EXPECT_TRUE(done.Wait(TimeDelta::Seconds(1)));
EXPECT_THAT(events, ElementsAre("Start", "FirstDone", "Continue"));
}
TEST_P(TaskQueueTest, PostCustomTask) {
std::unique_ptr<TaskQueueFactory> factory = GetParam()(nullptr);
Event ran;

View File

@ -8,23 +8,23 @@ specific_include_rules = {
".*": [
"+rtc_base/ref_counted_object.h",
],
"dummy_peer_connection\.h": [
"dummy_peer_connection\\.h": [
"+rtc_base/ref_counted_object.h",
],
"neteq_factory_with_codecs\.h": [
"neteq_factory_with_codecs\\.h": [
"+system_wrappers/include/clock.h",
],
"network_emulation_manager\.h": [
"network_emulation_manager\\.h": [
"+rtc_base/network_constants.h",
"+rtc_base/ip_address.h",
"+rtc_base/socket_address.h",
],
"peer_network_dependencies\.h": [
"peer_network_dependencies\\.h": [
"+rtc_base/socket_factory.h",
"+rtc_base/network.h",
"+rtc_base/thread.h",
],
"peerconnection_quality_test_fixture\.h": [
"peerconnection_quality_test_fixture\\.h": [
"+logging/rtc_event_log/rtc_event_log_factory_interface.h",
"+rtc_base/network.h",
"+rtc_base/rtc_certificate_generator.h",
@ -33,38 +33,38 @@ specific_include_rules = {
"+media/base/media_constants.h",
"+modules/audio_processing/include/audio_processing.h",
],
"time_controller\.h": [
"time_controller\\.h": [
"+rtc_base/synchronization/yield_policy.h",
"+system_wrappers/include/clock.h",
"+rtc_base/socket_server.h",
],
"create_frame_generator\.h": [
"create_frame_generator\\.h": [
"+system_wrappers/include/clock.h",
],
"mock_async_dns_resolver\.h": [
"mock_async_dns_resolver\\.h": [
"+rtc_base/socket_address.h",
],
"mock_local_network_access_permission\.h": [
"mock_local_network_access_permission\\.h": [
"+rtc_base/socket_address.h",
],
"mock_packet_socket_factory\.h": [
"mock_packet_socket_factory\\.h": [
"+rtc_base/async_packet_socket.h",
"+rtc_base/socket_address.h",
],
"mock_peerconnectioninterface\.h": [
"mock_peerconnectioninterface\\.h": [
"+rtc_base/thread.h",
],
"mock_peer_connection_factory_interface\.h": [
"mock_peer_connection_factory_interface\\.h": [
"+p2p/base/port_allocator.h",
"+rtc_base/rtc_certificate_generator.h",
],
"mock_peerconnectioninterface\.h": [
"mock_peerconnectioninterface\\.h": [
"+rtc_base/thread.h",
],
"videocodec_test_fixture\.h": [
"videocodec_test_fixture\\.h": [
"+modules/video_coding/codecs/h264/include/h264_globals.h",
],
"rtc_error_matchers\.h": [
"rtc_error_matchers\\.h": [
"+test/gmock.h",
],
}

View File

@ -12,9 +12,9 @@
#include <cstddef>
#include <cstdint>
#include <span>
#include <vector>
#include "api/array_view.h"
#include "api/media_types.h"
#include "rtc_base/checks.h"
@ -27,9 +27,9 @@ FakeFrameDecryptor::FakeFrameDecryptor(uint8_t fake_key,
FakeFrameDecryptor::Result FakeFrameDecryptor::Decrypt(
MediaType /* media_type */,
const std::vector<uint32_t>& /* csrcs */,
ArrayView<const uint8_t> /* additional_data */,
ArrayView<const uint8_t> encrypted_frame,
ArrayView<uint8_t> frame) {
std::span<const uint8_t> /* additional_data */,
std::span<const uint8_t> encrypted_frame,
std::span<uint8_t> frame) {
if (fail_decryption_) {
return Result(Status::kFailedToDecrypt, 0);
}

View File

@ -14,9 +14,9 @@
#include <stddef.h>
#include <stdint.h>
#include <span>
#include <vector>
#include "api/array_view.h"
#include "api/crypto/frame_decryptor_interface.h"
#include "api/media_types.h"
@ -36,9 +36,9 @@ class FakeFrameDecryptor : public FrameDecryptorInterface {
// the postfix byte. This will always fail if fail_decryption_ is set to true.
Result Decrypt(MediaType media_type,
const std::vector<uint32_t>& csrcs,
ArrayView<const uint8_t> additional_data,
ArrayView<const uint8_t> encrypted_frame,
ArrayView<uint8_t> frame) override;
std::span<const uint8_t> additional_data,
std::span<const uint8_t> encrypted_frame,
std::span<uint8_t> frame) override;
// Always returns 1 less than the size of the encrypted frame.
size_t GetMaxPlaintextByteSize(MediaType media_type,
size_t encrypted_frame_size) override;

View File

@ -12,8 +12,8 @@
#include <cstddef>
#include <cstdint>
#include <span>
#include "api/array_view.h"
#include "api/media_types.h"
#include "rtc_base/checks.h"
@ -24,9 +24,9 @@ FakeFrameEncryptor::FakeFrameEncryptor(uint8_t fake_key, uint8_t postfix_byte)
// FrameEncryptorInterface implementation
int FakeFrameEncryptor::Encrypt(MediaType /* media_type */,
uint32_t /* ssrc */,
ArrayView<const uint8_t> /* additional_data */,
ArrayView<const uint8_t> frame,
ArrayView<uint8_t> encrypted_frame,
std::span<const uint8_t> /* additional_data */,
std::span<const uint8_t> frame,
std::span<uint8_t> encrypted_frame,
size_t* bytes_written) {
if (fail_encryption_) {
return static_cast<int>(FakeEncryptionStatus::FORCED_FAILURE);

View File

@ -14,7 +14,8 @@
#include <stddef.h>
#include <stdint.h>
#include "api/array_view.h"
#include <span>
#include "api/crypto/frame_encryptor_interface.h"
#include "api/media_types.h"
#include "rtc_base/ref_counted_object.h"
@ -34,9 +35,9 @@ class FakeFrameEncryptor : public RefCountedObject<FrameEncryptorInterface> {
// bit to the end. This will always fail if fail_encryption_ is set to true.
int Encrypt(MediaType media_type,
uint32_t ssrc,
ArrayView<const uint8_t> additional_data,
ArrayView<const uint8_t> frame,
ArrayView<uint8_t> encrypted_frame,
std::span<const uint8_t> additional_data,
std::span<const uint8_t> frame,
std::span<uint8_t> encrypted_frame,
size_t* bytes_written) override;
// Always returns 1 more than the size of the frame.
size_t GetMaxCiphertextByteSize(MediaType media_type,

View File

@ -95,10 +95,7 @@ rtc_library("metrics_accumulator") {
rtc_library("metrics_exporter") {
visibility = [ "*" ]
sources = [ "metrics_exporter.h" ]
deps = [
":metric",
"../..:array_view",
]
deps = [ ":metric" ]
}
if (!build_with_chromium) {
@ -114,7 +111,6 @@ if (!build_with_chromium) {
deps = [
":metric",
":metrics_exporter",
"../..:array_view",
"../../../rtc_base:stringutils",
"../../../test:test_flags",
"//third_party/abseil-cpp/absl/flags:flag",
@ -133,7 +129,6 @@ rtc_library("chrome_perf_dashboard_metrics_exporter") {
deps = [
":metric",
":metrics_exporter",
"../..:array_view",
"../../../test:fileutils",
"../../../test:perf_test",
"//third_party/abseil-cpp/absl/memory",
@ -160,7 +155,6 @@ rtc_library("metrics_set_proto_file_exporter") {
deps = [
":metric",
":metrics_exporter",
"../..:array_view",
"../../../rtc_base:logging",
"../../../test:fileutils",
"//third_party/abseil-cpp/absl/strings:string_view",
@ -181,7 +175,6 @@ rtc_library("print_result_proxy_metrics_exporter") {
deps = [
":metric",
":metrics_exporter",
"../..:array_view",
"../../../test:perf_test",
"../../numerics",
]
@ -259,7 +252,6 @@ if (rtc_include_tests) {
":metric",
":metrics_exporter",
":metrics_logger",
"../..:array_view",
"../../../system_wrappers",
"../../../test:test_support",
]

View File

@ -1,18 +1,18 @@
specific_include_rules = {
"metrics_logger_and_exporter\.h": [
"metrics_logger_and_exporter\\.h": [
"+rtc_base/synchronization/mutex.h",
"+system_wrappers/include/clock.h",
],
"metrics_logger\.h": [
"metrics_logger\\.h": [
"+rtc_base/synchronization/mutex.h",
"+rtc_base/thread_annotations.h",
"+system_wrappers/include/clock.h",
],
"metrics_accumulator\.h": [
"metrics_accumulator\\.h": [
"+rtc_base/synchronization/mutex.h",
"+rtc_base/thread_annotations.h",
],
"chrome_perf_dashboard_metrics_exporter_test.cc": [
"chrome_perf_dashboard_metrics_exporter_test\\.cc": [
"+tracing/tracing/proto/histogram.pb.h"
],
}

View File

@ -11,12 +11,12 @@
#include <cstdio>
#include <memory>
#include <span>
#include <string>
#include <vector>
#include "absl/memory/memory.h"
#include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "api/test/metrics/metric.h"
#include "test/testsupport/file_utils.h"
#include "test/testsupport/perf_test.h"
@ -101,7 +101,7 @@ ChromePerfDashboardMetricsExporter::ChromePerfDashboardMetricsExporter(
: export_file_path_(export_file_path) {}
bool ChromePerfDashboardMetricsExporter::Export(
ArrayView<const Metric> metrics) {
std::span<const Metric> metrics) {
std::unique_ptr<PerfTestResultWriter> writer =
absl::WrapUnique<PerfTestResultWriter>(CreateHistogramWriter());
for (const Metric& metric : metrics) {

View File

@ -11,10 +11,10 @@
#ifndef API_TEST_METRICS_CHROME_PERF_DASHBOARD_METRICS_EXPORTER_H_
#define API_TEST_METRICS_CHROME_PERF_DASHBOARD_METRICS_EXPORTER_H_
#include <span>
#include <string>
#include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "api/test/metrics/metric.h"
#include "api/test/metrics/metrics_exporter.h"
@ -29,7 +29,7 @@ class ChromePerfDashboardMetricsExporter : public MetricsExporter {
absl::string_view export_file_path);
~ChromePerfDashboardMetricsExporter() override = default;
bool Export(ArrayView<const Metric> metrics) override;
bool Export(std::span<const Metric> metrics) override;
private:
const std::string export_file_path_;

View File

@ -12,11 +12,11 @@
#include <map>
#include <memory>
#include <optional>
#include <span>
#include <string>
#include <utility>
#include <vector>
#include "api/array_view.h"
#include "api/test/metrics/metric.h"
#include "api/test/metrics/metrics_exporter.h"
#include "api/test/metrics/metrics_logger.h"
@ -54,7 +54,7 @@ struct TestMetricsExporterFactory {
: factory_(factory), export_result_(export_result) {}
~TestMetricsExporter() override = default;
bool Export(ArrayView<const Metric> metrics) override {
bool Export(std::span<const Metric> metrics) override {
factory_->exported_metrics =
std::vector<Metric>(metrics.begin(), metrics.end());
return export_result_;

View File

@ -11,7 +11,8 @@
#ifndef API_TEST_METRICS_METRICS_EXPORTER_H_
#define API_TEST_METRICS_METRICS_EXPORTER_H_
#include "api/array_view.h"
#include <span>
#include "api/test/metrics/metric.h"
namespace webrtc {
@ -24,7 +25,7 @@ class MetricsExporter {
// Exports specified metrics in a format that depends on the implementation.
// Returns true if export succeeded, false otherwise.
virtual bool Export(ArrayView<const Metric> metrics) = 0;
virtual bool Export(std::span<const Metric> metrics) = 0;
};
} // namespace test

View File

@ -11,11 +11,11 @@
#include <cstdio>
#include <map>
#include <span>
#include <string>
#include <utility>
#include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "api/test/metrics/metric.h"
#include "rtc_base/logging.h"
#include "test/testsupport/file_utils.h"
@ -131,7 +131,7 @@ MetricsSetProtoFileExporter::Options::Options(
std::map<std::string, std::string> metadata)
: export_file_path(export_file_path), metadata(std::move(metadata)) {}
bool MetricsSetProtoFileExporter::Export(ArrayView<const Metric> metrics) {
bool MetricsSetProtoFileExporter::Export(std::span<const Metric> metrics) {
#if WEBRTC_ENABLE_PROTOBUF
test_metrics::MetricsSet metrics_set;
for (const auto& [key, value] : options_.metadata) {

View File

@ -12,10 +12,10 @@
#define API_TEST_METRICS_METRICS_SET_PROTO_FILE_EXPORTER_H_
#include <map>
#include <span>
#include <string>
#include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "api/test/metrics/metric.h"
#include "api/test/metrics/metrics_exporter.h"
@ -48,7 +48,7 @@ class MetricsSetProtoFileExporter : public MetricsExporter {
MetricsSetProtoFileExporter& operator=(const MetricsSetProtoFileExporter&) =
delete;
bool Export(ArrayView<const Metric> metrics) override;
bool Export(std::span<const Metric> metrics) override;
private:
const Options options_;

View File

@ -10,10 +10,10 @@
#include "api/test/metrics/print_result_proxy_metrics_exporter.h"
#include <cstddef>
#include <span>
#include <string>
#include <unordered_set>
#include "api/array_view.h"
#include "api/numerics/samples_stats_counter.h"
#include "api/test/metrics/metric.h"
#include "test/testsupport/perf_test.h"
@ -78,7 +78,7 @@ bool NameEndsWithConnected(const std::string& name) {
} // namespace
bool PrintResultProxyMetricsExporter::Export(ArrayView<const Metric> metrics) {
bool PrintResultProxyMetricsExporter::Export(std::span<const Metric> metrics) {
static const std::unordered_set<std::string> per_call_metrics{
"actual_encode_bitrate",
"encode_frame_rate",

View File

@ -11,7 +11,8 @@
#ifndef API_TEST_METRICS_PRINT_RESULT_PROXY_METRICS_EXPORTER_H_
#define API_TEST_METRICS_PRINT_RESULT_PROXY_METRICS_EXPORTER_H_
#include "api/array_view.h"
#include <span>
#include "api/test/metrics/metric.h"
#include "api/test/metrics/metrics_exporter.h"
@ -23,7 +24,7 @@ class PrintResultProxyMetricsExporter : public MetricsExporter {
public:
~PrintResultProxyMetricsExporter() override = default;
bool Export(ArrayView<const Metric> metrics) override;
bool Export(std::span<const Metric> metrics) override;
};
} // namespace test

View File

@ -13,11 +13,11 @@
#include <cstdint>
#include <cstdio>
#include <optional>
#include <span>
#include <string>
#include "absl/flags/flag.h"
#include "absl/strings/str_cat.h"
#include "api/array_view.h"
#include "api/test/metrics/metric.h"
#include "rtc_base/strings/string_builder.h"
#include "test/test_flags.h"
@ -89,7 +89,7 @@ std::string TestCaseAndMetadata(const Metric& metric) {
StdoutMetricsExporter::StdoutMetricsExporter() : output_(stdout) {}
bool StdoutMetricsExporter::Export(ArrayView<const Metric> metrics) {
bool StdoutMetricsExporter::Export(std::span<const Metric> metrics) {
for (const Metric& metric : metrics) {
PrintMetric(metric);
}

View File

@ -12,8 +12,8 @@
#define API_TEST_METRICS_STDOUT_METRICS_EXPORTER_H_
#include <cstdio>
#include <span>
#include "api/array_view.h"
#include "api/test/metrics/metric.h"
#include "api/test/metrics/metrics_exporter.h"
@ -29,7 +29,7 @@ class StdoutMetricsExporter : public MetricsExporter {
StdoutMetricsExporter(const StdoutMetricsExporter&) = delete;
StdoutMetricsExporter& operator=(const StdoutMetricsExporter&) = delete;
bool Export(ArrayView<const Metric> metrics) override;
bool Export(std::span<const Metric> metrics) override;
private:
void PrintMetric(const Metric& metric);

View File

@ -12,11 +12,11 @@
#include <cstddef>
#include <cstdint>
#include <span>
#include <type_traits>
#include "absl/functional/any_invocable.h"
#include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "api/candidate.h"
#include "api/datagram_connection.h"
#include "p2p/base/transport_description.h"
@ -45,14 +45,14 @@ class MockDatagramConnection : public DatagramConnection {
(override));
MOCK_METHOD(void,
SendPackets,
(ArrayView<PacketSendParameters> packets),
(std::span<PacketSendParameters> packets),
(override));
MOCK_METHOD(void,
Terminate,
(absl::AnyInvocable<void()> terminate_complete_callback),
(override));
MOCK_METHOD(std::string_view, IceUsernameFragment, (), (override));
MOCK_METHOD(std::string_view, IcePassword, (), (override));
MOCK_METHOD(absl::string_view, IceUsernameFragment, (), (override));
MOCK_METHOD(absl::string_view, IcePassword, (), (override));
};
static_assert(!std::is_abstract_v<RefCountedObject<MockDatagramConnection>>,

View File

@ -11,8 +11,8 @@
#define API_TEST_MOCK_DATAGRAM_CONNECTION_OBSERVER_H_
#include <cstdint>
#include <span>
#include "api/array_view.h"
#include "api/candidate.h"
#include "api/datagram_connection.h"
#include "test/gmock.h"
@ -27,7 +27,7 @@ class MockDatagramConnectionObserver : public DatagramConnection::Observer {
(override));
MOCK_METHOD(void,
OnPacketReceived,
(ArrayView<const uint8_t> data, PacketMetadata metadata),
(std::span<const uint8_t> data, PacketMetadata metadata),
(override));
MOCK_METHOD(void, OnSendOutcome, (SendOutcome send_outcome), (override));
MOCK_METHOD(void, OnConnectionError, (), (override));

View File

@ -13,9 +13,9 @@
#include <cstddef>
#include <cstdint>
#include <span>
#include <vector>
#include "api/array_view.h"
#include "api/crypto/frame_decryptor_interface.h"
#include "api/media_types.h"
#include "test/gmock.h"
@ -28,9 +28,9 @@ class MockFrameDecryptor : public FrameDecryptorInterface {
Decrypt,
(MediaType,
const std::vector<uint32_t>&,
ArrayView<const uint8_t>,
ArrayView<const uint8_t>,
ArrayView<uint8_t>),
std::span<const uint8_t>,
std::span<const uint8_t>,
std::span<uint8_t>),
(override));
MOCK_METHOD(size_t,

View File

@ -13,8 +13,8 @@
#include <cstddef>
#include <cstdint>
#include <span>
#include "api/array_view.h"
#include "api/crypto/frame_encryptor_interface.h"
#include "api/media_types.h"
#include "test/gmock.h"
@ -27,9 +27,9 @@ class MockFrameEncryptor : public FrameEncryptorInterface {
Encrypt,
(MediaType,
uint32_t,
ArrayView<const uint8_t>,
ArrayView<const uint8_t>,
ArrayView<uint8_t>,
std::span<const uint8_t>,
std::span<const uint8_t>,
std::span<uint8_t>,
size_t*),
(override));

View File

@ -12,10 +12,10 @@
#define API_TEST_MOCK_RTP_TRANSCEIVER_H_
#include <optional>
#include <span>
#include <string>
#include <vector>
#include "api/array_view.h"
#include "api/make_ref_counted.h"
#include "api/media_types.h"
#include "api/rtc_error.h"
@ -68,7 +68,7 @@ class MockRtpTransceiver : public RtpTransceiverInterface {
MOCK_METHOD(void, Stop, (), (override));
MOCK_METHOD(RTCError,
SetCodecPreferences,
(ArrayView<RtpCodecCapability> codecs),
(std::span<RtpCodecCapability> codecs),
(override));
MOCK_METHOD(std::vector<RtpCodecCapability>,
codec_preferences,
@ -84,7 +84,7 @@ class MockRtpTransceiver : public RtpTransceiverInterface {
(const, override));
MOCK_METHOD(RTCError,
SetHeaderExtensionsToNegotiate,
(ArrayView<const RtpHeaderExtensionCapability> header_extensions),
(std::span<const RtpHeaderExtensionCapability> header_extensions),
(override));
};

View File

@ -13,9 +13,9 @@
#include <cstdint>
#include <optional>
#include <span>
#include <string>
#include "api/array_view.h"
#include "api/frame_transformer_interface.h"
#include "api/units/time_delta.h"
#include "api/units/timestamp.h"
@ -27,8 +27,8 @@ class MockTransformableAudioFrame : public TransformableAudioFrameInterface {
public:
MockTransformableAudioFrame() : TransformableAudioFrameInterface(Passkey()) {}
MOCK_METHOD(ArrayView<const uint8_t>, GetData, (), (const, override));
MOCK_METHOD(void, SetData, (ArrayView<const uint8_t>), (override));
MOCK_METHOD(std::span<const uint8_t>, GetData, (), (const, override));
MOCK_METHOD(void, SetData, (std::span<const uint8_t>), (override));
MOCK_METHOD(void, SetRTPTimestamp, (uint32_t), (override));
MOCK_METHOD(uint8_t, GetPayloadType, (), (const, override));
MOCK_METHOD(bool, CanSetPayloadType, (), (const, override));
@ -36,7 +36,7 @@ class MockTransformableAudioFrame : public TransformableAudioFrameInterface {
MOCK_METHOD(uint32_t, GetSsrc, (), (const, override));
MOCK_METHOD(uint32_t, GetTimestamp, (), (const, override));
MOCK_METHOD(std::string, GetMimeType, (), (const, override));
MOCK_METHOD(ArrayView<const uint32_t>,
MOCK_METHOD(std::span<const uint32_t>,
GetContributingSources,
(),
(const, override));

View File

@ -14,10 +14,10 @@
#include <stdint.h>
#include <optional>
#include <span>
#include <string>
#include <type_traits>
#include "api/array_view.h"
#include "api/frame_transformer_interface.h"
#include "api/units/time_delta.h"
#include "api/units/timestamp.h"
@ -29,8 +29,8 @@ class MockTransformableFrame : public TransformableFrameInterface {
public:
MockTransformableFrame() : TransformableFrameInterface(Passkey()) {}
MOCK_METHOD(ArrayView<const uint8_t>, GetData, (), (const, override));
MOCK_METHOD(void, SetData, (ArrayView<const uint8_t>), (override));
MOCK_METHOD(std::span<const uint8_t>, GetData, (), (const, override));
MOCK_METHOD(void, SetData, (std::span<const uint8_t>), (override));
MOCK_METHOD(uint8_t, GetPayloadType, (), (const, override));
MOCK_METHOD(bool, CanSetPayloadType, (), (const, override));
MOCK_METHOD(void, SetPayloadType, (uint8_t), (override));

View File

@ -13,10 +13,10 @@
#include <cstdint>
#include <optional>
#include <span>
#include <string>
#include <type_traits>
#include "api/array_view.h"
#include "api/frame_transformer_interface.h"
#include "api/units/time_delta.h"
#include "api/units/timestamp.h"
@ -28,8 +28,8 @@ namespace webrtc {
class MockTransformableVideoFrame : public TransformableVideoFrameInterface {
public:
MockTransformableVideoFrame() : TransformableVideoFrameInterface(Passkey()) {}
MOCK_METHOD(ArrayView<const uint8_t>, GetData, (), (const, override));
MOCK_METHOD(void, SetData, (ArrayView<const uint8_t> data), (override));
MOCK_METHOD(std::span<const uint8_t>, GetData, (), (const, override));
MOCK_METHOD(void, SetData, (std::span<const uint8_t> data), (override));
MOCK_METHOD(uint32_t, GetTimestamp, (), (const, override));
MOCK_METHOD(void, SetRTPTimestamp, (uint32_t), (override));
MOCK_METHOD(uint32_t, GetSsrc, (), (const, override));

View File

@ -24,8 +24,8 @@ if (rtc_enable_protobuf) {
]
deps = [
":network_config_schedule_proto",
":network_queue",
"../..:network_emulation_manager_api",
"../../../rtc_base:timeutils",
"../../../test/network:schedulable_network_behavior",
"../../units:timestamp",
"//third_party/abseil-cpp/absl/functional:any_invocable",

View File

@ -15,7 +15,9 @@
#include <utility>
#include "absl/functional/any_invocable.h"
#include "api/test/network_emulation/leaky_bucket_network_queue.h"
#include "api/test/network_emulation/network_config_schedule.pb.h"
#include "api/test/network_emulation/network_queue.h"
#include "api/test/network_emulation_manager.h"
#include "api/units/timestamp.h"
#include "test/network/schedulable_network_behavior.h"
@ -34,6 +36,11 @@ void SchedulableNetworkNodeBuilder::set_start_condition(
start_condition_ = std::move(start_condition);
}
void SchedulableNetworkNodeBuilder::set_queue_factory(
NetworkQueueFactory& queue_factory) {
queue_factory_ = &queue_factory;
}
EmulatedNetworkNode* SchedulableNetworkNodeBuilder::Build(
std::optional<uint64_t> random_seed) {
uint64_t seed =
@ -41,8 +48,11 @@ EmulatedNetworkNode* SchedulableNetworkNodeBuilder::Build(
? *random_seed
: static_cast<uint64_t>(
net_.time_controller()->GetClock()->CurrentTime().ns());
std::unique_ptr<NetworkQueue> network_queue =
queue_factory_ ? queue_factory_->CreateQueue()
: std::make_unique<LeakyBucketNetworkQueue>();
return net_.CreateEmulatedNode(std::make_unique<SchedulableNetworkBehavior>(
std::move(schedule_), seed, *net_.time_controller()->GetClock(),
std::move(start_condition_)));
std::move(start_condition_), std::move(network_queue)));
}
} // namespace webrtc

View File

@ -15,6 +15,7 @@
#include "absl/functional/any_invocable.h"
#include "api/test/network_emulation/network_config_schedule.pb.h"
#include "api/test/network_emulation/network_queue.h"
#include "api/test/network_emulation_manager.h"
#include "api/units/timestamp.h"
@ -31,6 +32,7 @@ class SchedulableNetworkNodeBuilder {
// NetworkConfigScheduleItem is used. There is no guarantee on which
// thread/task queue that will be used.
void set_start_condition(absl::AnyInvocable<bool(Timestamp)> start_condition);
void set_queue_factory(NetworkQueueFactory& queue_factory);
// If no random seed is provided, one will be created.
// The random seed is required for loss rate and to delay standard deviation.
@ -41,6 +43,7 @@ class SchedulableNetworkNodeBuilder {
NetworkEmulationManager& net_;
network_behaviour::NetworkConfigSchedule schedule_;
absl::AnyInvocable<bool(Timestamp)> start_condition_;
NetworkQueueFactory* queue_factory_ = nullptr;
};
} // namespace webrtc

View File

@ -146,27 +146,14 @@ NetworkEmulationManager::SimulatedNetworkNode
NetworkEmulationManager::SimulatedNetworkNode::Builder::Build(
uint64_t random_seed) const {
RTC_CHECK(net_);
return Build(net_, random_seed);
}
NetworkEmulationManager::SimulatedNetworkNode
NetworkEmulationManager::SimulatedNetworkNode::Builder::Build(
NetworkEmulationManager* net,
uint64_t random_seed) const {
RTC_CHECK(net);
RTC_CHECK(net_ == nullptr || net_ == net);
std::unique_ptr<NetworkQueue> network_queue;
if (queue_factory_ != nullptr) {
network_queue = queue_factory_->CreateQueue();
} else {
network_queue = std::make_unique<LeakyBucketNetworkQueue>();
}
SimulatedNetworkNode res;
std::unique_ptr<NetworkQueue> network_queue =
queue_factory_ ? queue_factory_->CreateQueue()
: std::make_unique<LeakyBucketNetworkQueue>();
auto behavior = std::make_unique<SimulatedNetwork>(config_, random_seed,
std::move(network_queue));
res.simulation = behavior.get();
res.node = net->CreateEmulatedNode(std::move(behavior));
return res;
return SimulatedNetworkNode{
.simulation = behavior.get(),
.node = net_->CreateEmulatedNode(std::move(behavior))};
}
std::pair<EmulatedNetworkManagerInterface*, EmulatedNetworkManagerInterface*>
@ -177,15 +164,10 @@ NetworkEmulationManager::CreateEndpointPairWithTwoWayRoutes(
auto* alice_node = CreateEmulatedNode(config);
auto* bob_node = CreateEmulatedNode(config);
std::vector<EmulatedEndpoint*> alice_endpoints;
for (int i = 0; i < alice_interface_count; i++) {
alice_endpoints.push_back(CreateEndpoint(EmulatedEndpointConfig()));
}
std::vector<EmulatedEndpoint*> bob_endpoints;
for (int i = 0; i < bob_interface_count; i++) {
bob_endpoints.push_back(CreateEndpoint(EmulatedEndpointConfig()));
}
std::vector<EmulatedEndpoint*> alice_endpoints(
alice_interface_count, CreateEndpoint(EmulatedEndpointConfig()));
std::vector<EmulatedEndpoint*> bob_endpoints(
bob_interface_count, CreateEndpoint(EmulatedEndpointConfig()));
for (auto alice_endpoint : alice_endpoints) {
for (auto bob_endpoint : bob_endpoints) {

View File

@ -15,13 +15,13 @@
#include <functional>
#include <memory>
#include <optional>
#include <span>
#include <string>
#include <utility>
#include <vector>
#include "absl/base/nullability.h"
#include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "api/field_trials_view.h"
#include "api/test/network_emulation/cross_traffic.h"
#include "api/test/network_emulation/network_emulation_interfaces.h"
@ -186,7 +186,6 @@ class NetworkEmulationManager {
class Builder {
public:
explicit Builder(NetworkEmulationManager* net) : net_(net) {}
Builder() : net_(nullptr) {}
Builder(const Builder&) = default;
// Sets the config state, note that this will replace any previously set
// values.
@ -204,8 +203,6 @@ class NetworkEmulationManager {
Builder& avg_burst_loss_length(int avg_burst_loss_length);
Builder& packet_overhead(int packet_overhead);
SimulatedNetworkNode Build(uint64_t random_seed = 1) const;
SimulatedNetworkNode Build(NetworkEmulationManager* net,
uint64_t random_seed = 1) const;
private:
NetworkEmulationManager* const net_;
@ -349,14 +346,14 @@ class NetworkEmulationManager {
// `stats_callback`. Callback will be executed on network emulation
// internal task queue.
virtual void GetStats(
ArrayView<EmulatedEndpoint* const> endpoints,
std::span<EmulatedEndpoint* const> endpoints,
std::function<void(EmulatedNetworkStats)> stats_callback) = 0;
// Passes combined network stats for all specified `nodes` into specified
// `stats_callback`. Callback will be executed on network emulation
// internal task queue.
virtual void GetStats(
ArrayView<EmulatedNetworkNode* const> nodes,
std::span<EmulatedNetworkNode* const> nodes,
std::function<void(EmulatedNetworkNodeStats)> stats_callback) = 0;
// Create a EmulatedTURNServer.

View File

@ -17,7 +17,6 @@ rtc_library("media_configuration") {
]
deps = [
"../..:array_view",
"../..:audio_options_api",
"../..:media_stream_interface",
"../..:rtp_parameters",

View File

@ -8,7 +8,7 @@ specific_include_rules = {
"+rtc_base/socket_factory.h",
"+rtc_base/thread.h",
],
"media_quality_test_params\.h": [
"media_quality_test_params\\.h": [
"+p2p/base/port_allocator.h",
"+rtc_base/socket_factory.h",
],

View File

@ -16,12 +16,12 @@
#include <map>
#include <memory>
#include <optional>
#include <span>
#include <string>
#include <utility>
#include <vector>
#include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "api/test/video/video_frame_writer.h"
#include "api/units/time_delta.h"
#include "rtc_base/checks.h"
@ -229,7 +229,7 @@ VideoCodecConfig::VideoCodecConfig(
: name(name), required_params(std::move(required_params)) {}
std::optional<VideoResolution> VideoSubscription::GetMaxResolution(
ArrayView<const VideoConfig> video_configs) {
std::span<const VideoConfig> video_configs) {
std::vector<VideoResolution> resolutions;
for (const auto& video_config : video_configs) {
resolutions.push_back(video_config.GetResolution());
@ -238,7 +238,7 @@ std::optional<VideoResolution> VideoSubscription::GetMaxResolution(
}
std::optional<VideoResolution> VideoSubscription::GetMaxResolution(
ArrayView<const VideoResolution> resolutions) {
std::span<const VideoResolution> resolutions) {
if (resolutions.empty()) {
return std::nullopt;
}

View File

@ -17,11 +17,11 @@
#include <map>
#include <memory>
#include <optional>
#include <span>
#include <string>
#include <vector>
#include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "api/audio_options.h"
#include "api/media_stream_interface.h"
#include "api/rtp_parameters.h"
@ -394,9 +394,9 @@ class VideoSubscription {
// Returns the resolution constructed as maximum from all resolution
// dimensions: width, height and fps.
static std::optional<VideoResolution> GetMaxResolution(
ArrayView<const VideoConfig> video_configs);
std::span<const VideoConfig> video_configs);
static std::optional<VideoResolution> GetMaxResolution(
ArrayView<const VideoResolution> resolutions);
std::span<const VideoResolution> resolutions);
bool operator==(const VideoSubscription& other) const;
bool operator!=(const VideoSubscription& other) const;

Some files were not shown because too many files have changed in this diff Show More