Merge remote-tracking branch 'upstream/branch-heads/6834' into mutexlox/m132-merge

This commit is contained in:
Miriam Zimmerman 2025-01-07 12:25:28 -05:00
commit 8604cca7c6
1199 changed files with 17877 additions and 27545 deletions

4
.gn
View file

@ -83,4 +83,8 @@ default_args = {
# WebRTC doesn't use jni_zero's multiplexing. Since this causes an error # WebRTC doesn't use jni_zero's multiplexing. Since this causes an error
# let's temporarily disable it. # let's temporarily disable it.
enable_jni_multiplexing = false enable_jni_multiplexing = false
# TODO(b/42223878): use_fuzztest_wrapper adds a dependency to //base so
# let's temporarly disable it.
use_fuzztest_wrapper = false
} }

View file

@ -53,6 +53,7 @@ Eike Rathke <erathke@redhat.com>
Eric Rescorla, RTFM Inc. <ekr@rtfm.com> Eric Rescorla, RTFM Inc. <ekr@rtfm.com>
Filip Hlasek <filip@orcamobility.ai> Filip Hlasek <filip@orcamobility.ai>
Frederik Riedel, Frogg GmbH <frederik.riedel@frogg.io> Frederik Riedel, Frogg GmbH <frederik.riedel@frogg.io>
Gao Chun <gaochun.dev@gmail.com>
Giji Gangadharan <giji.g@samsung.com> Giji Gangadharan <giji.g@samsung.com>
Graham Yoakum <gyoakum@skobalt.com> Graham Yoakum <gyoakum@skobalt.com>
Gustavo Garcia <gustavogb@gmail.com> Gustavo Garcia <gustavogb@gmail.com>
@ -122,7 +123,9 @@ Satender Saroha <ssaroha@yahoo.com>
Saul Kravitz <Saul.Kravitz@celera.com> Saul Kravitz <Saul.Kravitz@celera.com>
Sergio Garcia Murillo <sergio.garcia.murillo@gmail.com> Sergio Garcia Murillo <sergio.garcia.murillo@gmail.com>
Shaofan Qi <vshaqi@gmail.com> Shaofan Qi <vshaqi@gmail.com>
Shigemasa Watanabe <shigemasa7watanabe@gmail.com>
Shuhai Peng <shuhai.peng@intel.com> Shuhai Peng <shuhai.peng@intel.com>
Shunbo Li <lishunbo@shengwang.cn>
Seija <doremylover123@gmail.com> Seija <doremylover123@gmail.com>
Silviu Caragea <silviu.cpp@gmail.com> Silviu Caragea <silviu.cpp@gmail.com>
Stefan Gula <steweg@gmail.com> Stefan Gula <steweg@gmail.com>
@ -149,6 +152,7 @@ Yuriy Pavlyshak <yuriy@appear.in>
Yusuke Suzuki <utatane.tea@gmail.com> Yusuke Suzuki <utatane.tea@gmail.com>
Pengfei Han <hanpfei@gmail.com> Pengfei Han <hanpfei@gmail.com>
Yingying Ma <yingying.ma@intel.com> Yingying Ma <yingying.ma@intel.com>
Hailin Zhao <lynnworld7@gmail.com>
# END individuals section. # END individuals section.
# BEGIN organizations section. # BEGIN organizations section.

View file

@ -419,19 +419,11 @@ config("common_config") {
} }
if (is_clang) { if (is_clang) {
cflags += [ "-Wc++11-narrowing" ] cflags += [
"-Wc++11-narrowing",
if (!is_fuchsia) { "-Wundef",
# Compiling with the Fuchsia SDK results in Wundef errors "-Wunused-lambda-capture",
# TODO(bugs.fuchsia.dev/100722): Remove from (!is_fuchsia) branch when ]
# Fuchsia build errors are fixed.
cflags += [ "-Wundef" ]
}
if (!is_nacl) {
# Flags NaCl (Clang 3.7) do not recognize.
cflags += [ "-Wunused-lambda-capture" ]
}
} }
if (is_win && !is_clang) { if (is_win && !is_clang) {
@ -656,7 +648,7 @@ if (rtc_include_tests && !build_with_chromium) {
deps = [ deps = [
"api:compile_all_headers", "api:compile_all_headers",
"api:rtc_api_unittests", "api:rtc_api_unittests",
"api/audio/test:audio_api_unittests", "api/audio:audio_api_unittests",
"api/audio_codecs/test:audio_codecs_api_unittests", "api/audio_codecs/test:audio_codecs_api_unittests",
"api/numerics:numerics_unittests", "api/numerics:numerics_unittests",
"api/task_queue:pending_task_safety_flag_unittests", "api/task_queue:pending_task_safety_flag_unittests",
@ -672,6 +664,7 @@ if (rtc_include_tests && !build_with_chromium) {
"p2p:rtc_p2p_unittests", "p2p:rtc_p2p_unittests",
"rtc_base:async_dns_resolver_unittests", "rtc_base:async_dns_resolver_unittests",
"rtc_base:async_packet_socket_unittest", "rtc_base:async_packet_socket_unittest",
"rtc_base:async_udp_socket_unittest",
"rtc_base:callback_list_unittests", "rtc_base:callback_list_unittests",
"rtc_base:rtc_base_approved_unittests", "rtc_base:rtc_base_approved_unittests",
"rtc_base:rtc_base_unittests", "rtc_base:rtc_base_unittests",
@ -731,6 +724,7 @@ if (rtc_include_tests && !build_with_chromium) {
# TODO(pbos): Rename test suite, this is no longer "just" for video targets. # TODO(pbos): Rename test suite, this is no longer "just" for video targets.
video_engine_tests_resources = [ video_engine_tests_resources = [
"resources/ConferenceMotion_1280_720_50.yuv",
"resources/foreman_cif_short.yuv", "resources/foreman_cif_short.yuv",
"resources/voice_engine/audio_long16.pcm", "resources/voice_engine/audio_long16.pcm",
] ]

151
DEPS
View file

@ -10,7 +10,7 @@ vars = {
# chromium waterfalls. More info at: crbug.com/570091. # chromium waterfalls. More info at: crbug.com/570091.
'checkout_configuration': 'default', 'checkout_configuration': 'default',
'checkout_instrumented_libraries': 'checkout_linux and checkout_configuration == "default"', 'checkout_instrumented_libraries': 'checkout_linux and checkout_configuration == "default"',
'chromium_revision': '3b70d6f26cf7a1f53bcf227a621506727653902f', 'chromium_revision': '030af8fbf08f2bb06397304628f15b2d3bdb90d0',
# Fetch the prebuilt binaries for llvm-cov and llvm-profdata. Needed to # Fetch the prebuilt binaries for llvm-cov and llvm-profdata. Needed to
# process the raw profiles produced by instrumented targets (built with # process the raw profiles produced by instrumented targets (built with
@ -20,6 +20,9 @@ vars = {
# Fetch clangd into the same bin/ directory as our clang binary. # Fetch clangd into the same bin/ directory as our clang binary.
'checkout_clangd': False, 'checkout_clangd': False,
# Fetch libraries required to compile and run fuzzer tests.
'checkout_fuzzer': False,
'chromium_git': 'https://chromium.googlesource.com', 'chromium_git': 'https://chromium.googlesource.com',
# Keep the Chromium default of generating location tags. # Keep the Chromium default of generating location tags.
@ -30,7 +33,7 @@ vars = {
# By default, download the fuchsia sdk from the public sdk directory. # By default, download the fuchsia sdk from the public sdk directory.
'fuchsia_sdk_cipd_prefix': 'fuchsia/sdk/core/', 'fuchsia_sdk_cipd_prefix': 'fuchsia/sdk/core/',
'fuchsia_version': 'version:24.20240906.3.1', 'fuchsia_version': 'version:24.20241014.3.1',
# By default, download the fuchsia images from the fuchsia GCS bucket. # By default, download the fuchsia images from the fuchsia GCS bucket.
'fuchsia_images_bucket': 'fuchsia', 'fuchsia_images_bucket': 'fuchsia',
'checkout_fuchsia': False, 'checkout_fuchsia': False,
@ -45,14 +48,14 @@ vars = {
# RBE instance to use for running remote builds # RBE instance to use for running remote builds
'rbe_instance': 'projects/rbe-webrtc-developer/instances/default_instance', 'rbe_instance': 'projects/rbe-webrtc-developer/instances/default_instance',
# reclient CIPD package version # reclient CIPD package version
'reclient_version': 're_client_version:0.163.0.d27158ab-gomaip', 'reclient_version': 're_client_version:0.168.0.c46e68bc-gomaip',
# ninja CIPD package. # ninja CIPD package.
'ninja_package': 'infra/3pp/tools/ninja/', 'ninja_package': 'infra/3pp/tools/ninja/',
# ninja CIPD package version # ninja CIPD package version
# https://chrome-infra-packages.appspot.com/p/infra/3pp/tools/ninja # https://chrome-infra-packages.appspot.com/p/infra/3pp/tools/ninja
'ninja_version': 'version:2@1.12.1.chromium.4', 'ninja_version': 'version:3@1.12.1.chromium.4',
# condition to allowlist deps for non-git-source processing. # condition to allowlist deps for non-git-source processing.
'non_git_source': 'True', 'non_git_source': 'True',
@ -71,30 +74,30 @@ deps = {
# TODO(kjellander): Move this to be Android-only. # TODO(kjellander): Move this to be Android-only.
'src/base': 'src/base':
'https://chromium.googlesource.com/chromium/src/base@7f2a56694b330c2cb2954eee78469ffc69952448', 'https://chromium.googlesource.com/chromium/src/base@69f3676cdbd05660c136a6cc3b23383cbabe53d8',
'src/build': 'src/build':
'https://chromium.googlesource.com/chromium/src/build@8e0612cd2c4e4d7c15a456384760815bdbd64ef1', 'https://chromium.googlesource.com/chromium/src/build@05874e6c9429039f1747034af61de1fe2ea1ed06',
'src/buildtools': 'src/buildtools':
'https://chromium.googlesource.com/chromium/src/buildtools@e4f992c0660e6cee637c7b97aabf04d0a58d5555', 'https://chromium.googlesource.com/chromium/src/buildtools@db0eae9640184fb132061f248f6108771a6ea2d4',
# Gradle 6.6.1. Used for testing Android Studio project generation for WebRTC. # Gradle 6.6.1. Used for testing Android Studio project generation for WebRTC.
'src/examples/androidtests/third_party/gradle': { 'src/examples/androidtests/third_party/gradle': {
'url': 'https://chromium.googlesource.com/external/github.com/gradle/gradle.git@f2d1fb54a951d8b11d25748e4711bec8d128d7e3', 'url': 'https://chromium.googlesource.com/external/github.com/gradle/gradle.git@f2d1fb54a951d8b11d25748e4711bec8d128d7e3',
'condition': 'checkout_android', 'condition': 'checkout_android',
}, },
'src/ios': { 'src/ios': {
'url': 'https://chromium.googlesource.com/chromium/src/ios@8e01efd2a9dba90f0094ed0fa908a6e907410d74', 'url': 'https://chromium.googlesource.com/chromium/src/ios@452c8ab2166e50fe43484dd3da5e19ce14a68e6b',
'condition': 'checkout_ios', 'condition': 'checkout_ios',
}, },
'src/testing': 'src/testing':
'https://chromium.googlesource.com/chromium/src/testing@3f4138fcb15362469527d9310e21600dfdfab691', 'https://chromium.googlesource.com/chromium/src/testing@eac4c18f749488d7232af275405e0e1b67d84cb3',
'src/third_party': 'src/third_party':
'https://chromium.googlesource.com/chromium/src/third_party@27c9b4efc25d7ae5479b884a7d818058c6066d92', 'https://chromium.googlesource.com/chromium/src/third_party@9d80a193fbfe8e2f2a29be2efeee93de9a826dcb',
'src/buildtools/linux64': { 'src/buildtools/linux64': {
'packages': [ 'packages': [
{ {
'package': 'gn/gn/linux-${{arch}}', 'package': 'gn/gn/linux-${{arch}}',
'version': 'git_revision:20806f79c6b4ba295274e3a589d85db41a02fdaa', 'version': 'git_revision:feafd1012a32c05ec6095f69ddc3850afb621f3a',
} }
], ],
'dep_type': 'cipd', 'dep_type': 'cipd',
@ -104,7 +107,7 @@ deps = {
'packages': [ 'packages': [
{ {
'package': 'gn/gn/mac-${{arch}}', 'package': 'gn/gn/mac-${{arch}}',
'version': 'git_revision:20806f79c6b4ba295274e3a589d85db41a02fdaa', 'version': 'git_revision:feafd1012a32c05ec6095f69ddc3850afb621f3a',
} }
], ],
'dep_type': 'cipd', 'dep_type': 'cipd',
@ -114,7 +117,7 @@ deps = {
'packages': [ 'packages': [
{ {
'package': 'gn/gn/windows-amd64', 'package': 'gn/gn/windows-amd64',
'version': 'git_revision:20806f79c6b4ba295274e3a589d85db41a02fdaa', 'version': 'git_revision:feafd1012a32c05ec6095f69ddc3850afb621f3a',
} }
], ],
'dep_type': 'cipd', 'dep_type': 'cipd',
@ -133,14 +136,56 @@ deps = {
'condition': 'not (host_os == "linux" and host_cpu == "arm64")', 'condition': 'not (host_os == "linux" and host_cpu == "arm64")',
}, },
'third_party/rust': {
'url': Var('chromium_git') + '/chromium/src/third_party/rust@0e0ef14876a32128574eaf80bc7fc1c7cde92006',
'condition': 'checkout_android or checkout_fuzzer',
},
'third_party/rust-toolchain': {
'dep_type': 'gcs',
'bucket': 'chromium-browser-clang',
'objects': [
{
'object_name': 'Linux_x64/rust-toolchain-009e73825af0e59ad4fc603562e038b3dbd6593a-2-llvmorg-20-init-3847-g69c43468.tar.xz',
'sha256sum': '043bc520520424fad9fdfc87102e3af7c8f1ca4da3f7885e18f54fd29fc783e4',
'size_bytes': 115068636,
'generation': 1725552307196828,
'condition': 'host_os == "linux" and non_git_source',
},
{
'object_name': 'Mac/rust-toolchain-009e73825af0e59ad4fc603562e038b3dbd6593a-2-llvmorg-20-init-3847-g69c43468.tar.xz',
'sha256sum': '100befb02da0940fdede41a0ad0e28ded1ce4b6794b5e488bccc91ba1d27348a',
'size_bytes': 108415524,
'generation': 1725552308530261,
'condition': 'host_os == "mac" and host_cpu == "x64"',
},
{
'object_name': 'Mac_arm64/rust-toolchain-009e73825af0e59ad4fc603562e038b3dbd6593a-2-llvmorg-20-init-3847-g69c43468.tar.xz',
'sha256sum': '6f3ba8fe5a9590b476c087b412bd60e7e46ec59bc37aac76d9f7894c6bc34a75',
'size_bytes': 97820200,
'generation': 1725552309875662,
'condition': 'host_os == "mac" and host_cpu == "arm64"',
},
{
'object_name': 'Win/rust-toolchain-009e73825af0e59ad4fc603562e038b3dbd6593a-2-llvmorg-20-init-3847-g69c43468.tar.xz',
'sha256sum': '1d04274c7a96aa0148a9bb5b29fa5b33c24b97971e33634bed62ce504b1cb346',
'size_bytes': 172453420,
'generation': 1725552311180142,
'condition': 'host_os == "win"',
},
],
},
'src/third_party/clang-format/script': 'src/third_party/clang-format/script':
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/clang/tools/clang-format.git@3c0acd2d4e73dd911309d9e970ba09d58bf23a62', 'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/clang/tools/clang-format.git@3c0acd2d4e73dd911309d9e970ba09d58bf23a62',
'src/third_party/libc++/src': 'src/third_party/libc++/src':
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxx.git@887f732df07adac7a67997ff0a91baa12081e5a2', 'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxx.git@6a68fd412b9aecd515a20a7cf84d11b598bfaf96',
'src/third_party/libc++abi/src': 'src/third_party/libc++abi/src':
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxxabi.git@29b2e9a0f48688da116692cb04758393053d269c', 'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxxabi.git@9a1d90c3b412d5ebeb97a6e33d98e1d0dd923221',
'src/third_party/llvm-libc/src':
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libc.git@98ed09318387deb45282ca1c92a384499860b76a',
'src/third_party/libunwind/src': 'src/third_party/libunwind/src':
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libunwind.git@dc70138c3e68e2f946585f134e20815851e26263', 'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libunwind.git@efc3baa2d1ece3630fcfa72bef93ed831bcaec4c',
'src/third_party/test_fonts/test_fonts': { 'src/third_party/test_fonts/test_fonts': {
'dep_type': 'gcs', 'dep_type': 'gcs',
@ -214,7 +259,7 @@ deps = {
'packages': [ 'packages': [
{ {
'package': 'chromium/third_party/android_build_tools/error_prone', 'package': 'chromium/third_party/android_build_tools/error_prone',
'version': 'fNCLAzE8NSvOXTryvUGT3NmX8no8lyRHR1yfY0zbv8YC', 'version': 'hUxlP8GvC1xhmZ6r9xjYau2laPlzHbs_P2emx4ZL4jgC',
}, },
], ],
'condition': 'checkout_android', 'condition': 'checkout_android',
@ -244,11 +289,11 @@ deps = {
}, },
'src/third_party/boringssl/src': 'src/third_party/boringssl/src':
'https://boringssl.googlesource.com/boringssl.git@e724ef02089bf2bb494203231fc5cb62acc2fad6', 'https://boringssl.googlesource.com/boringssl.git@0fa9014d861f024e28fb491ed7b1cfd44103dee7',
'src/third_party/breakpad/breakpad': 'src/third_party/breakpad/breakpad':
'https://chromium.googlesource.com/breakpad/breakpad.git@6b0c5b7ee1988a14a4af94564e8ae8bba8a94374', 'https://chromium.googlesource.com/breakpad/breakpad.git@6b0c5b7ee1988a14a4af94564e8ae8bba8a94374',
'src/third_party/catapult': 'src/third_party/catapult':
'https://chromium.googlesource.com/catapult.git@296226a4a0067c8cffeb8831fb87526a8035f3cc', 'https://chromium.googlesource.com/catapult.git@44791916611acec1cd74c492c7453e46d9b0dbd2',
'src/third_party/ced/src': { 'src/third_party/ced/src': {
'url': 'https://chromium.googlesource.com/external/github.com/google/compact_enc_det.git@ba412eaaacd3186085babcd901679a48863c7dd5', 'url': 'https://chromium.googlesource.com/external/github.com/google/compact_enc_det.git@ba412eaaacd3186085babcd901679a48863c7dd5',
}, },
@ -261,9 +306,9 @@ deps = {
'src/third_party/crc32c/src': 'src/third_party/crc32c/src':
'https://chromium.googlesource.com/external/github.com/google/crc32c.git@d3d60ac6e0f16780bcfcc825385e1d338801a558', 'https://chromium.googlesource.com/external/github.com/google/crc32c.git@d3d60ac6e0f16780bcfcc825385e1d338801a558',
'src/third_party/depot_tools': 'src/third_party/depot_tools':
'https://chromium.googlesource.com/chromium/tools/depot_tools.git@d43a3eb748e40838c41e7a3ca53a3c6cbee0ea7a', 'https://chromium.googlesource.com/chromium/tools/depot_tools.git@20b9bdcace7ed561d6a75728c85373503473cb6b',
'src/third_party/ffmpeg': 'src/third_party/ffmpeg':
'https://chromium.googlesource.com/chromium/third_party/ffmpeg.git@91903c28af60a732a051c343b496e1188eec9b05', 'https://chromium.googlesource.com/chromium/third_party/ffmpeg.git@686d6944501a6ee9c849581e3fe343273d4af3f6',
'src/third_party/flatbuffers/src': 'src/third_party/flatbuffers/src':
'https://chromium.googlesource.com/external/github.com/google/flatbuffers.git@8db59321d9f02cdffa30126654059c7d02f70c32', 'https://chromium.googlesource.com/external/github.com/google/flatbuffers.git@8db59321d9f02cdffa30126654059c7d02f70c32',
'src/third_party/grpc/src': { 'src/third_party/grpc/src': {
@ -275,7 +320,7 @@ deps = {
'condition': 'checkout_linux', 'condition': 'checkout_linux',
}, },
'src/third_party/freetype/src': 'src/third_party/freetype/src':
'https://chromium.googlesource.com/chromium/src/third_party/freetype2.git@83af801b552111e37d9466a887e1783a0fb5f196', 'https://chromium.googlesource.com/chromium/src/third_party/freetype2.git@f02bffad0fd57f3acfa835c3f2899c5b71ff8be0',
'src/third_party/harfbuzz-ng/src': 'src/third_party/harfbuzz-ng/src':
'https://chromium.googlesource.com/external/github.com/harfbuzz/harfbuzz.git@1da053e87f0487382404656edca98b85fe51f2fd', 'https://chromium.googlesource.com/external/github.com/harfbuzz/harfbuzz.git@1da053e87f0487382404656edca98b85fe51f2fd',
'src/third_party/google_benchmark/src': { 'src/third_party/google_benchmark/src': {
@ -289,9 +334,9 @@ deps = {
'condition': 'checkout_android', 'condition': 'checkout_android',
}, },
'src/third_party/googletest/src': 'src/third_party/googletest/src':
'https://chromium.googlesource.com/external/github.com/google/googletest.git@0953a17a4281fc26831da647ad3fcd5e21e6473b', 'https://chromium.googlesource.com/external/github.com/google/googletest.git@62df7bdbc10887e094661e07ec2595b7920376fd',
'src/third_party/icu': { 'src/third_party/icu': {
'url': 'https://chromium.googlesource.com/chromium/deps/icu.git@9408c6fd4a39e6fef0e1c4077602e1c83b15f3fb', 'url': 'https://chromium.googlesource.com/chromium/deps/icu.git@4239b1559d11d4fa66c100543eda4161e060311e',
}, },
'src/third_party/jdk/current': { 'src/third_party/jdk/current': {
'packages': [ 'packages': [
@ -326,7 +371,7 @@ deps = {
'packages': [ 'packages': [
{ {
'package': 'chromium/third_party/kotlin_stdlib', 'package': 'chromium/third_party/kotlin_stdlib',
'version': 'b48PGccyaRl9kI3MLdJ36I-z5Zcj9NOCjsUg02Bl-EIC', 'version': 'XJ7_doI-Qt7GFaSQ9BNo-3qF7Gv2--9Sa8GEUdjxMTUC',
}, },
], ],
'condition': 'checkout_android', 'condition': 'checkout_android',
@ -337,37 +382,39 @@ deps = {
'packages': [ 'packages': [
{ {
'package': 'chromium/third_party/kotlinc', 'package': 'chromium/third_party/kotlinc',
'version': 'PKwXlOC2iNJx0ELcmUpSTk0GHbNMEM-HZwhs2AWl1WUC', 'version': 'FNZSCjJ6yKsi6oRcgQrt-lX0MDlaWoxT7gPTz0CjLhMC',
}, },
], ],
'condition': 'checkout_android', 'condition': 'checkout_android',
'dep_type': 'cipd', 'dep_type': 'cipd',
}, },
# Used for building libFuzzers (only supports Linux). # Used for building libFuzzers (only supports Linux).
'src/third_party/libFuzzer/src': 'src/third_party/libFuzzer/src': {
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/compiler-rt/lib/fuzzer.git@487e79376394754705984c5de7c4ce7f82f2bd7c', 'url': 'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/compiler-rt/lib/fuzzer.git@487e79376394754705984c5de7c4ce7f82f2bd7c',
'condition': 'checkout_fuzzer',
},
'src/third_party/fuzztest/src': 'src/third_party/fuzztest/src':
'https://chromium.googlesource.com/external/github.com/google/fuzztest.git@a29e31cb00ec9b123dec5a0c6b8d4bc12c2480c8', 'https://chromium.googlesource.com/external/github.com/google/fuzztest.git@0021f30508bc7f73fa5270962d022acb480d242f',
'src/third_party/libjpeg_turbo': 'src/third_party/libjpeg_turbo':
'https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git@927aabfcd26897abb9776ecf2a6c38ea5bb52ab6', 'https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git@927aabfcd26897abb9776ecf2a6c38ea5bb52ab6',
'src/third_party/libsrtp': 'src/third_party/libsrtp':
'https://chromium.googlesource.com/chromium/deps/libsrtp.git@000edd791434c8738455f10e0dd6b268a4852c0b', 'https://chromium.googlesource.com/chromium/deps/libsrtp.git@000edd791434c8738455f10e0dd6b268a4852c0b',
'src/third_party/dav1d/libdav1d': 'src/third_party/dav1d/libdav1d':
'https://chromium.googlesource.com/external/github.com/videolan/dav1d.git@6b3c489a2ee2c030f351f21987c27611b4cbe725', 'https://chromium.googlesource.com/external/github.com/videolan/dav1d.git@389450f61ea0b2057fc9ea393d3065859c4ba7f2',
'src/third_party/libaom/source/libaom': 'src/third_party/libaom/source/libaom':
'https://aomedia.googlesource.com/aom.git@d5265b173616ce62de231cd1b1eae853ad03641e', 'https://aomedia.googlesource.com/aom.git@840f8797871cc587f7113ea9d2483a1156d57c0e',
'src/third_party/libunwindstack': { 'src/third_party/libunwindstack': {
'url': 'https://chromium.googlesource.com/chromium/src/third_party/libunwindstack.git@a3bb4cd02e0e984a235069f812cbef2b37c389e5', 'url': 'https://chromium.googlesource.com/chromium/src/third_party/libunwindstack.git@a3bb4cd02e0e984a235069f812cbef2b37c389e5',
'condition': 'checkout_android', 'condition': 'checkout_android',
}, },
'src/third_party/perfetto': 'src/third_party/perfetto':
'https://android.googlesource.com/platform/external/perfetto.git@97a5d7ed4d7ddb3844a5cbd184e241b99fe6ebcc', 'https://android.googlesource.com/platform/external/perfetto.git@e57316a6ae4e85e9bc8ba82a6c6a93eb5d9a72aa',
'src/third_party/protobuf-javascript/src': 'src/third_party/protobuf-javascript/src':
Var('chromium_git') + '/external/github.com/protocolbuffers/protobuf-javascript' + '@' + 'e34549db516f8712f678fcd4bc411613b5cc5295', Var('chromium_git') + '/external/github.com/protocolbuffers/protobuf-javascript' + '@' + 'e34549db516f8712f678fcd4bc411613b5cc5295',
'src/third_party/libvpx/source/libvpx': 'src/third_party/libvpx/source/libvpx':
'https://chromium.googlesource.com/webm/libvpx.git@fbf63dff1f528d44f24bd662abb89fd01a4a1c25', 'https://chromium.googlesource.com/webm/libvpx.git@906334ac1de2b0afa666472dce5545b82c1251fb',
'src/third_party/libyuv': 'src/third_party/libyuv':
'https://chromium.googlesource.com/libyuv/libyuv.git@874f391dbf13dcc84e13a494daed57539ffe2935', 'https://chromium.googlesource.com/libyuv/libyuv.git@a8e59d207483f75b87dd5fc670e937672cdf5776',
'src/third_party/lss': { 'src/third_party/lss': {
'url': 'https://chromium.googlesource.com/linux-syscall-support.git@ce877209e11aa69dcfffbd53ef90ea1d07136521', 'url': 'https://chromium.googlesource.com/linux-syscall-support.git@ce877209e11aa69dcfffbd53ef90ea1d07136521',
'condition': 'checkout_android or checkout_linux', 'condition': 'checkout_android or checkout_linux',
@ -396,7 +443,7 @@ deps = {
'packages': [ 'packages': [
{ {
'package': 'chromium/third_party/r8', 'package': 'chromium/third_party/r8',
'version': 'mqzE1g-dbf23PQ04w-4TpmupGkMOnZljVa993-MkzhIC', 'version': '-i5fwP_NzM6Ylg5AsSGEotYN7hQgV852gXCslvXIrRwC',
}, },
], ],
'condition': 'checkout_android', 'condition': 'checkout_android',
@ -409,7 +456,7 @@ deps = {
'packages': [ 'packages': [
{ {
'package': 'chromium/third_party/r8', 'package': 'chromium/third_party/r8',
'version': 'vw5kLlW3-suSlCKSO9OQpFWpR8oDnvQ8k1RgKNUapQYC', 'version': '3KCj5eRYCvGGYs5i90pRaeihkzsqgUGc4OkICT8AOlIC',
}, },
], ],
'condition': 'checkout_android', 'condition': 'checkout_android',
@ -420,7 +467,7 @@ deps = {
'condition': 'checkout_android', 'condition': 'checkout_android',
}, },
'src/tools': 'src/tools':
'https://chromium.googlesource.com/chromium/src/tools@453f7ad001cd0d341ecb437eb164fd6c4b5cc08d', 'https://chromium.googlesource.com/chromium/src/tools@c809c4133185094fbd75508202221ff14fc92f7c',
'src/third_party/espresso': { 'src/third_party/espresso': {
'packages': [ 'packages': [
@ -459,7 +506,7 @@ deps = {
'packages': [ 'packages': [
{ {
'package': 'chromium/third_party/androidx', 'package': 'chromium/third_party/androidx',
'version': '-HPg6kSZtheePVbklOqBtMGHIYS9d0uoR7S-NfR5kGoC', 'version': 'k1wif7sS51pJGSFGN7FAeGWDorxgPart9E1f383TQL4C',
}, },
], ],
'condition': 'checkout_android and non_git_source', 'condition': 'checkout_android and non_git_source',
@ -470,7 +517,7 @@ deps = {
'packages': [ 'packages': [
{ {
'package': 'chromium/third_party/android_build_tools/manifest_merger', 'package': 'chromium/third_party/android_build_tools/manifest_merger',
'version': 'JnUHT3SsYpv4WBlOV5VrBkuj2Q9SJ3cXlNHZ-u78L5IC', 'version': 'rnIeJMlGw7adxOKZofLsm7tdYaOy1nHivJn9ck7ocVkC',
}, },
], ],
'condition': 'checkout_android', 'condition': 'checkout_android',
@ -541,7 +588,7 @@ deps = {
'packages': [ 'packages': [
{ {
'package': 'chromium/third_party/turbine', 'package': 'chromium/third_party/turbine',
'version': 'aLKJszAm9PXh5T9KNcDH0MQJeEAIpEiFAYVEimlKdDsC', 'version': 'vSia3h9tzpwpP_goLj4HMdl7_FEB5iVCv9nU5ZXOfIMC',
}, },
], ],
'condition': 'checkout_android', 'condition': 'checkout_android',
@ -552,11 +599,11 @@ deps = {
'packages': [ 'packages': [
{ {
'package': 'infra/tools/luci/isolate/${{platform}}', 'package': 'infra/tools/luci/isolate/${{platform}}',
'version': 'git_revision:1aca70b6bf116c1bd8fbf0526c9a89e9be308718', 'version': 'git_revision:7dd39503276dfa4a920102ca77a2f409f2f67655',
}, },
{ {
'package': 'infra/tools/luci/swarming/${{platform}}', 'package': 'infra/tools/luci/swarming/${{platform}}',
'version': 'git_revision:1aca70b6bf116c1bd8fbf0526c9a89e9be308718', 'version': 'git_revision:7dd39503276dfa4a920102ca77a2f409f2f67655',
}, },
], ],
'dep_type': 'cipd', 'dep_type': 'cipd',
@ -881,7 +928,7 @@ deps = {
'packages': [ 'packages': [
{ {
'package': 'chromium/third_party/android_deps/libs/com_google_android_material_material', 'package': 'chromium/third_party/android_deps/libs/com_google_android_material_material',
'version': 'version:2@1.11.0-beta01.cr1', 'version': 'version:2@1.13.0-alpha05.cr1',
}, },
], ],
'condition': 'checkout_android and non_git_source', 'condition': 'checkout_android and non_git_source',
@ -1559,6 +1606,17 @@ deps = {
'dep_type': 'cipd', 'dep_type': 'cipd',
}, },
'src/third_party/android_deps/cipd/libs/org_jspecify_jspecify': {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/org_jspecify_jspecify',
'version': 'version:2@1.0.0.cr1',
},
],
'condition': 'checkout_android and non_git_source',
'dep_type': 'cipd',
},
'src/third_party/android_deps/cipd/libs/org_mockito_mockito_android': { 'src/third_party/android_deps/cipd/libs/org_mockito_mockito_android': {
'packages': [ 'packages': [
{ {
@ -1952,6 +2010,12 @@ hooks = [
'action': ['vpython3', 'src/tools/clang/scripts/update.py', 'action': ['vpython3', 'src/tools/clang/scripts/update.py',
'--package=clangd'], '--package=clangd'],
}, },
{
'name': 'rust',
'pattern': '.',
'condition': 'checkout_android or checkout_fuzzer',
'action': ['python3', 'src/tools/rust/update_rust.py'],
},
{ {
# Update LASTCHANGE. # Update LASTCHANGE.
'name': 'lastchange', 'name': 'lastchange',
@ -2124,6 +2188,7 @@ include_rules = [
"+absl/strings/ascii.h", "+absl/strings/ascii.h",
"+absl/strings/escaping.h", "+absl/strings/escaping.h",
"+absl/strings/match.h", "+absl/strings/match.h",
"+absl/strings/str_cat.h", # note - allowed for single argument version only
"+absl/strings/str_replace.h", "+absl/strings/str_replace.h",
"+absl/strings/string_view.h", "+absl/strings/string_view.h",
"+absl/types/variant.h", "+absl/types/variant.h",

View file

@ -168,7 +168,8 @@ API_CHANGE_MSG = """
You seem to be changing native API header files. Please make sure that you: You seem to be changing native API header files. Please make sure that you:
1. Make compatible changes that don't break existing clients. Usually 1. Make compatible changes that don't break existing clients. Usually
this is done by keeping the existing method signatures unchanged. this is done by keeping the existing method signatures unchanged.
2. Mark the old stuff as deprecated (use the ABSL_DEPRECATED macro). 2. Mark the old stuff as deprecated (use the [[deprecated]] attribute or
the ABSL_DEPRECATE_AND_INLINE macro).
3. Create a timeline and plan for when the deprecated stuff will be 3. Create a timeline and plan for when the deprecated stuff will be
removed. (The amount of time we give users to change their code removed. (The amount of time we give users to change their code
should be informed by how much work it is for them. If they just should be informed by how much work it is for them. If they just
@ -186,7 +187,7 @@ Related files:
def CheckNativeApiHeaderChanges(input_api, output_api): def CheckNativeApiHeaderChanges(input_api, output_api):
"""Checks to remind proper changing of native APIs.""" """Checks to remind proper changing of native APIs."""
files = [] files = set()
source_file_filter = lambda x: input_api.FilterSourceFile( source_file_filter = lambda x: input_api.FilterSourceFile(
x, files_to_check=[r'.+\.(gn|gni|h)$']) x, files_to_check=[r'.+\.(gn|gni|h)$'])
for f in input_api.AffectedSourceFiles(source_file_filter): for f in input_api.AffectedSourceFiles(source_file_filter):
@ -195,20 +196,20 @@ def CheckNativeApiHeaderChanges(input_api, output_api):
if path == 'api': if path == 'api':
# Special case: Subdirectories included. # Special case: Subdirectories included.
if dn == 'api' or dn.startswith('api/'): if dn == 'api' or dn.startswith('api/'):
files.append(f.LocalPath()) files.add(f.LocalPath())
else: else:
# Normal case: Subdirectories not included. # Normal case: Subdirectories not included.
if dn == path: if dn == path:
files.append(f.LocalPath()) files.add(f.LocalPath())
if files: if files:
return [output_api.PresubmitNotifyResult(API_CHANGE_MSG, files)] return [output_api.PresubmitNotifyResult(API_CHANGE_MSG, list(files))]
return [] return []
def CheckNoIOStreamInHeaders(input_api, output_api, source_file_filter): def CheckNoIOStreamInHeaders(input_api, output_api, source_file_filter):
"""Checks to make sure no .h files include <iostream>.""" """Checks to make sure no .h files include <iostream>."""
files = [] files = set()
pattern = input_api.re.compile(r'^#include\s*<iostream>', pattern = input_api.re.compile(r'^#include\s*<iostream>',
input_api.re.MULTILINE) input_api.re.MULTILINE)
file_filter = lambda x: (input_api.FilterSourceFile(x) and file_filter = lambda x: (input_api.FilterSourceFile(x) and
@ -218,7 +219,7 @@ def CheckNoIOStreamInHeaders(input_api, output_api, source_file_filter):
continue continue
contents = input_api.ReadFile(f) contents = input_api.ReadFile(f)
if pattern.search(contents): if pattern.search(contents):
files.append(f) files.add(f)
if len(files) > 0: if len(files) > 0:
return [ return [
@ -226,14 +227,14 @@ def CheckNoIOStreamInHeaders(input_api, output_api, source_file_filter):
'Do not #include <iostream> in header files, since it inserts ' 'Do not #include <iostream> in header files, since it inserts '
'static initialization into every file including the header. ' 'static initialization into every file including the header. '
'Instead, #include <ostream>. See http://crbug.com/94794', 'Instead, #include <ostream>. See http://crbug.com/94794',
files) list(files))
] ]
return [] return []
def CheckNoPragmaOnce(input_api, output_api, source_file_filter): def CheckNoPragmaOnce(input_api, output_api, source_file_filter):
"""Make sure that banned functions are not used.""" """Make sure that banned functions are not used."""
files = [] files = set()
pattern = input_api.re.compile(r'^#pragma\s+once', input_api.re.MULTILINE) pattern = input_api.re.compile(r'^#pragma\s+once', input_api.re.MULTILINE)
file_filter = lambda x: (input_api.FilterSourceFile(x) and file_filter = lambda x: (input_api.FilterSourceFile(x) and
source_file_filter(x)) source_file_filter(x))
@ -242,14 +243,14 @@ def CheckNoPragmaOnce(input_api, output_api, source_file_filter):
continue continue
contents = input_api.ReadFile(f) contents = input_api.ReadFile(f)
if pattern.search(contents): if pattern.search(contents):
files.append(f) files.add(f)
if files: if files:
return [ return [
output_api.PresubmitError( output_api.PresubmitError(
'Do not use #pragma once in header files.\n' 'Do not use #pragma once in header files.\n'
'See http://www.chromium.org/developers/coding-style' 'See http://www.chromium.org/developers/coding-style'
'#TOC-File-headers', files) '#TOC-File-headers', list(files))
] ]
return [] return []
@ -316,12 +317,12 @@ def CheckApprovedFilesLintClean(input_api, output_api,
# work with not-yet-converted code, we're only applying it to new (or # work with not-yet-converted code, we're only applying it to new (or
# moved/renamed) files and files not listed in CPPLINT_EXCEPTIONS. # moved/renamed) files and files not listed in CPPLINT_EXCEPTIONS.
verbosity_level = 1 verbosity_level = 1
files = [] files = set()
for f in input_api.AffectedSourceFiles(source_file_filter): for f in input_api.AffectedSourceFiles(source_file_filter):
# Note that moved/renamed files also count as added. # Note that moved/renamed files also count as added.
if f.Action() == 'A' or not IsLintDisabled(disabled_paths, if f.Action() == 'A' or not IsLintDisabled(disabled_paths,
f.LocalPath()): f.LocalPath()):
files.append(f.AbsoluteLocalPath()) files.add(f.AbsoluteLocalPath())
for file_name in files: for file_name in files:
cpplint.ProcessFile(file_name, verbosity_level) cpplint.ProcessFile(file_name, verbosity_level)
@ -342,7 +343,7 @@ def CheckNoSourcesAbove(input_api, gn_files, output_api):
re.MULTILINE | re.DOTALL) re.MULTILINE | re.DOTALL)
file_pattern = input_api.re.compile(r'"((\.\./.*?)|(//.*?))"') file_pattern = input_api.re.compile(r'"((\.\./.*?)|(//.*?))"')
violating_gn_files = set() violating_gn_files = set()
violating_source_entries = [] violating_source_entries = set()
for gn_file in gn_files: for gn_file in gn_files:
contents = input_api.ReadFile(gn_file) contents = input_api.ReadFile(gn_file)
for source_block_match in source_pattern.finditer(contents): for source_block_match in source_pattern.finditer(contents):
@ -352,7 +353,7 @@ def CheckNoSourcesAbove(input_api, gn_files, output_api):
source_block_match.group(1)): source_block_match.group(1)):
source_file = file_list_match.group(1) source_file = file_list_match.group(1)
if 'overrides/' not in source_file: if 'overrides/' not in source_file:
violating_source_entries.append(source_file) violating_source_entries.add(source_file)
violating_gn_files.add(gn_file) violating_gn_files.add(gn_file)
if violating_gn_files: if violating_gn_files:
return [ return [
@ -363,7 +364,7 @@ def CheckNoSourcesAbove(input_api, gn_files, output_api):
'Invalid source entries:\n' 'Invalid source entries:\n'
'%s\n' '%s\n'
'Violating GN files:' % '\n'.join(violating_source_entries), 'Violating GN files:' % '\n'.join(violating_source_entries),
items=violating_gn_files) items=list(violating_gn_files))
] ]
return [] return []
@ -622,9 +623,9 @@ def CheckGnChanges(input_api, output_api):
files_to_check=(r'.+\.(gn|gni)$', ), files_to_check=(r'.+\.(gn|gni)$', ),
files_to_skip=(r'.*/presubmit_checks_lib/testdata/.*', ))) files_to_skip=(r'.*/presubmit_checks_lib/testdata/.*', )))
gn_files = [] gn_files = set()
for f in input_api.AffectedSourceFiles(file_filter): for f in input_api.AffectedSourceFiles(file_filter):
gn_files.append(f) gn_files.add(f)
result = [] result = []
if gn_files: if gn_files:
@ -840,7 +841,7 @@ def RunPythonTests(input_api, output_api):
def CheckUsageOfGoogleProtobufNamespace(input_api, output_api, def CheckUsageOfGoogleProtobufNamespace(input_api, output_api,
source_file_filter): source_file_filter):
"""Checks that the namespace google::protobuf has not been used.""" """Checks that the namespace google::protobuf has not been used."""
files = [] files = set()
pattern = input_api.re.compile(r'google::protobuf') pattern = input_api.re.compile(r'google::protobuf')
proto_utils_path = os.path.join('rtc_base', 'protobuf_utils.h') proto_utils_path = os.path.join('rtc_base', 'protobuf_utils.h')
file_filter = lambda x: (input_api.FilterSourceFile(x) and file_filter = lambda x: (input_api.FilterSourceFile(x) and
@ -850,14 +851,14 @@ def CheckUsageOfGoogleProtobufNamespace(input_api, output_api,
continue continue
contents = input_api.ReadFile(f) contents = input_api.ReadFile(f)
if pattern.search(contents): if pattern.search(contents):
files.append(f) files.add(f)
if files: if files:
return [ return [
output_api.PresubmitError( output_api.PresubmitError(
'Please avoid to use namespace `google::protobuf` directly.\n' 'Please avoid to use namespace `google::protobuf` directly.\n'
'Add a using directive in `%s` and include that header instead.' 'Add a using directive in `%s` and include that header instead.'
% proto_utils_path, files) % proto_utils_path, list(files))
] ]
return [] return []
@ -1117,19 +1118,19 @@ def CheckBannedAbslMakeUnique(input_api, output_api, source_file_filter):
file_filter = lambda f: (f.LocalPath().endswith( file_filter = lambda f: (f.LocalPath().endswith(
('.cc', '.h')) and source_file_filter(f)) ('.cc', '.h')) and source_file_filter(f))
files = [] files = set()
for f in input_api.AffectedFiles(include_deletes=False, for f in input_api.AffectedFiles(include_deletes=False,
file_filter=file_filter): file_filter=file_filter):
for _, line in f.ChangedContents(): for _, line in f.ChangedContents():
if 'absl::make_unique' in line: if 'absl::make_unique' in line:
files.append(f) files.add(f)
break break
if files: if files:
return [ return [
output_api.PresubmitError( output_api.PresubmitError(
'Please use std::make_unique instead of absl::make_unique.\n' 'Please use std::make_unique instead of absl::make_unique.\n'
'Affected files:', files) 'Affected files:', list(files))
] ]
return [] return []
@ -1142,20 +1143,20 @@ def CheckBannedAbslOptional(input_api, output_api, source_file_filter):
file_filter = lambda f: (f.LocalPath().endswith( file_filter = lambda f: (f.LocalPath().endswith(
('.cc', '.h')) and source_file_filter(f)) ('.cc', '.h')) and source_file_filter(f))
files = [] files = set()
for f in input_api.AffectedFiles(include_deletes=False, for f in input_api.AffectedFiles(include_deletes=False,
file_filter=file_filter): file_filter=file_filter):
for _, line in f.ChangedContents(): for _, line in f.ChangedContents():
if absl_optional.search(line) or absl_optional_include.search( if absl_optional.search(line) or absl_optional_include.search(
line): line):
files.append(f.LocalPath()) files.add(f.LocalPath())
break break
if files: if files:
return [ return [
output_api.PresubmitError( output_api.PresubmitError(
'Please use std::optional instead of absl::optional.\n' 'Please use std::optional instead of absl::optional.\n'
'Affected files:', files) 'Affected files:', list(files))
] ]
return [] return []
@ -1171,19 +1172,19 @@ def CheckConditionalIncludes(input_api, output_api, source_file_filter):
for key, value in conditional_includes.items(): for key, value in conditional_includes.items():
include_regex = re.compile('^#include ' + key + include_regex = re.compile('^#include ' + key +
'((?!IWYU pragma|no-presubmit-check).)*$') '((?!IWYU pragma|no-presubmit-check).)*$')
files = [] files = set()
for f in input_api.AffectedFiles(include_deletes=False, for f in input_api.AffectedFiles(include_deletes=False,
file_filter=file_filter): file_filter=file_filter):
for _, line in f.ChangedContents(): for _, line in f.ChangedContents():
if include_regex.search(line): if include_regex.search(line):
files.append(f.LocalPath()) files.add(f.LocalPath())
break break
if files: if files:
results.append( results.append(
output_api.PresubmitError( output_api.PresubmitError(
'Please include ' + value + ' instead of ' + key + 'Please include ' + value + ' instead of ' + key +
'.\nAffected files:', files)) '.\nAffected files:', list(files)))
return results return results
@ -1193,7 +1194,7 @@ def CheckObjcApiSymbols(input_api, output_api, source_file_filter):
file_filter = lambda f: (f.LocalPath().endswith( file_filter = lambda f: (f.LocalPath().endswith(
('.h')) and source_file_filter(f)) ('.h')) and source_file_filter(f))
files = [] files = set()
file_filter = lambda x: (input_api.FilterSourceFile(x) and file_filter = lambda x: (input_api.FilterSourceFile(x) and
source_file_filter(x)) source_file_filter(x))
for f in input_api.AffectedSourceFiles(file_filter): for f in input_api.AffectedSourceFiles(file_filter):
@ -1205,7 +1206,7 @@ def CheckObjcApiSymbols(input_api, output_api, source_file_filter):
for match in rtc_objc_export.finditer(contents): for match in rtc_objc_export.finditer(contents):
export_block = match.group(0) export_block = match.group(0)
if 'RTC_OBJC_TYPE' not in export_block: if 'RTC_OBJC_TYPE' not in export_block:
files.append(f.LocalPath()) files.add(f.LocalPath())
if len(files) > 0: if len(files) > 0:
return [ return [
@ -1214,7 +1215,7 @@ def CheckObjcApiSymbols(input_api, output_api, source_file_filter):
+ 'macro.\n\n' + 'For example:\n' + + 'macro.\n\n' + 'For example:\n' +
'RTC_OBJC_EXPORT @protocol RTC_OBJC_TYPE(RtcFoo)\n\n' + 'RTC_OBJC_EXPORT @protocol RTC_OBJC_TYPE(RtcFoo)\n\n' +
'RTC_OBJC_EXPORT @interface RTC_OBJC_TYPE(RtcFoo)\n\n' + 'RTC_OBJC_EXPORT @interface RTC_OBJC_TYPE(RtcFoo)\n\n' +
'Please fix the following files:', files) 'Please fix the following files:', list(files))
] ]
return [] return []
@ -1224,19 +1225,19 @@ def CheckAssertUsage(input_api, output_api, source_file_filter):
file_filter = lambda f: (f.LocalPath().endswith( file_filter = lambda f: (f.LocalPath().endswith(
('.cc', '.h', '.m', '.mm')) and source_file_filter(f)) ('.cc', '.h', '.m', '.mm')) and source_file_filter(f))
files = [] files = set()
for f in input_api.AffectedFiles(include_deletes=False, for f in input_api.AffectedFiles(include_deletes=False,
file_filter=file_filter): file_filter=file_filter):
for _, line in f.ChangedContents(): for _, line in f.ChangedContents():
if pattern.search(line): if pattern.search(line):
files.append(f.LocalPath()) files.add(f.LocalPath())
break break
if len(files) > 0: if len(files) > 0:
return [ return [
output_api.PresubmitError( output_api.PresubmitError(
'Usage of assert() has been detected in the following files, ' 'Usage of assert() has been detected in the following files, '
'please use RTC_DCHECK() instead.\n Files:', files) 'please use RTC_DCHECK() instead.\n Files:', list(files))
] ]
return [] return []
@ -1247,7 +1248,7 @@ def CheckAbslMemoryInclude(input_api, output_api, source_file_filter):
file_filter = lambda f: (f.LocalPath().endswith( file_filter = lambda f: (f.LocalPath().endswith(
('.cc', '.h')) and source_file_filter(f)) ('.cc', '.h')) and source_file_filter(f))
files = [] files = set()
for f in input_api.AffectedFiles(include_deletes=False, for f in input_api.AffectedFiles(include_deletes=False,
file_filter=file_filter): file_filter=file_filter):
contents = input_api.ReadFile(f) contents = input_api.ReadFile(f)
@ -1255,7 +1256,7 @@ def CheckAbslMemoryInclude(input_api, output_api, source_file_filter):
continue continue
for _, line in f.ChangedContents(): for _, line in f.ChangedContents():
if 'absl::WrapUnique' in line: if 'absl::WrapUnique' in line:
files.append(f) files.add(f)
break break
if len(files) > 0: if len(files) > 0:
@ -1263,7 +1264,8 @@ def CheckAbslMemoryInclude(input_api, output_api, source_file_filter):
output_api.PresubmitError( output_api.PresubmitError(
'Please include "absl/memory/memory.h" header for ' 'Please include "absl/memory/memory.h" header for '
'absl::WrapUnique.\nThis header may or may not be included ' 'absl::WrapUnique.\nThis header may or may not be included '
'transitively depending on the C++ standard version.', files) 'transitively depending on the C++ standard version.',
list(files))
] ]
return [] return []

View file

@ -42,6 +42,7 @@ rtc_source_set("enable_media") {
"../pc:media_factory", "../pc:media_factory",
"../rtc_base/system:rtc_export", "../rtc_base/system:rtc_export",
"environment", "environment",
"//third_party/abseil-cpp/absl/base:nullability",
] ]
} }
@ -61,17 +62,12 @@ rtc_source_set("enable_media_with_defaults") {
":libjingle_peerconnection_api", ":libjingle_peerconnection_api",
":scoped_refptr", ":scoped_refptr",
"../rtc_base/system:rtc_export", "../rtc_base/system:rtc_export",
"audio:audio_processing", "audio:builtin_audio_processing_builder",
"audio_codecs:audio_codecs_api",
"audio_codecs:audio_codecs_api",
"audio_codecs:builtin_audio_decoder_factory", "audio_codecs:builtin_audio_decoder_factory",
"audio_codecs:builtin_audio_encoder_factory", "audio_codecs:builtin_audio_encoder_factory",
"task_queue:default_task_queue_factory", "task_queue:default_task_queue_factory",
"task_queue:task_queue",
"video_codecs:builtin_video_decoder_factory", "video_codecs:builtin_video_decoder_factory",
"video_codecs:builtin_video_encoder_factory", "video_codecs:builtin_video_encoder_factory",
"video_codecs:video_codecs_api",
"video_codecs:video_codecs_api",
] ]
} }
@ -98,6 +94,7 @@ if (!build_with_chromium) {
"audio:audio_device", "audio:audio_device",
"audio:audio_mixer_api", "audio:audio_mixer_api",
"audio:audio_processing", "audio:audio_processing",
"audio:builtin_audio_processing_builder",
"audio_codecs:audio_codecs_api", "audio_codecs:audio_codecs_api",
"video_codecs:video_codecs_api", "video_codecs:video_codecs_api",
] ]
@ -468,6 +465,7 @@ rtc_source_set("ref_count") {
rtc_source_set("scoped_refptr") { rtc_source_set("scoped_refptr") {
visibility = [ "*" ] visibility = [ "*" ]
sources = [ "scoped_refptr.h" ] sources = [ "scoped_refptr.h" ]
deps = [ "//third_party/abseil-cpp/absl/base:nullability" ]
} }
rtc_source_set("make_ref_counted") { rtc_source_set("make_ref_counted") {
@ -477,6 +475,7 @@ rtc_source_set("make_ref_counted") {
":ref_count", ":ref_count",
":scoped_refptr", ":scoped_refptr",
"../rtc_base:refcount", "../rtc_base:refcount",
"//third_party/abseil-cpp/absl/base:nullability",
] ]
} }
@ -1021,6 +1020,8 @@ if (rtc_include_tests) {
"../modules/audio_processing", "../modules/audio_processing",
"../modules/audio_processing:audioproc_f_impl", "../modules/audio_processing:audioproc_f_impl",
"audio:audio_processing", "audio:audio_processing",
"audio:builtin_audio_processing_builder",
"//third_party/abseil-cpp/absl/base:nullability",
] ]
} }
@ -1542,6 +1543,7 @@ if (rtc_include_tests) {
"candidate_unittest.cc", "candidate_unittest.cc",
"field_trials_unittest.cc", "field_trials_unittest.cc",
"function_view_unittest.cc", "function_view_unittest.cc",
"jsep_unittest.cc",
"rtc_error_unittest.cc", "rtc_error_unittest.cc",
"rtc_event_log_output_file_unittest.cc", "rtc_event_log_output_file_unittest.cc",
"rtp_packet_info_unittest.cc", "rtp_packet_info_unittest.cc",
@ -1575,6 +1577,7 @@ if (rtc_include_tests) {
"../rtc_base:buffer", "../rtc_base:buffer",
"../rtc_base:checks", "../rtc_base:checks",
"../rtc_base:gunit_helpers", "../rtc_base:gunit_helpers",
"../rtc_base:logging",
"../rtc_base:macromagic", "../rtc_base:macromagic",
"../rtc_base:platform_thread", "../rtc_base:platform_thread",
"../rtc_base:rtc_event", "../rtc_base:rtc_event",
@ -1607,6 +1610,10 @@ if (rtc_include_tests) {
"//third_party/abseil-cpp/absl/strings", "//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/strings:string_view", "//third_party/abseil-cpp/absl/strings:string_view",
] ]
if (rtc_use_h265) {
deps += [ "video:rtp_video_frame_h265_assembler_unittests" ]
}
} }
rtc_library("compile_all_headers") { rtc_library("compile_all_headers") {

View file

@ -97,7 +97,7 @@ class ArrayViewBase {
static_assert(Size > 0, "ArrayView size must be variable or non-negative"); static_assert(Size > 0, "ArrayView size must be variable or non-negative");
public: public:
ArrayViewBase(T* data, size_t size) : data_(data) {} ArrayViewBase(T* data, size_t /* size */) : data_(data) {}
static constexpr size_t size() { return Size; } static constexpr size_t size() { return Size; }
static constexpr bool empty() { return false; } static constexpr bool empty() { return false; }
@ -114,7 +114,7 @@ class ArrayViewBase {
template <typename T> template <typename T>
class ArrayViewBase<T, 0> { class ArrayViewBase<T, 0> {
public: public:
explicit ArrayViewBase(T* data, size_t size) {} explicit ArrayViewBase(T* /* data */, size_t /* size */) {}
static constexpr size_t size() { return 0; } static constexpr size_t size() { return 0; }
static constexpr bool empty() { return true; } static constexpr bool empty() { return true; }

View file

@ -36,7 +36,7 @@ size_t Call(ArrayView<T> av) {
} }
template <typename T, size_t N> template <typename T, size_t N>
void CallFixed(ArrayView<T, N> av) {} void CallFixed(ArrayView<T, N> /* av */) {}
} // namespace } // namespace

View file

@ -78,12 +78,33 @@ rtc_source_set("audio_processing") {
"../../rtc_base/system:arch", "../../rtc_base/system:arch",
"../../rtc_base/system:file_wrapper", "../../rtc_base/system:file_wrapper",
"../../rtc_base/system:rtc_export", "../../rtc_base/system:rtc_export",
"../environment",
"../task_queue", "../task_queue",
"//third_party/abseil-cpp/absl/base:nullability", "//third_party/abseil-cpp/absl/base:nullability",
"//third_party/abseil-cpp/absl/strings:string_view", "//third_party/abseil-cpp/absl/strings:string_view",
] ]
} }
rtc_library("builtin_audio_processing_builder") {
visibility = [ "*" ]
configs += [ "../../modules/audio_processing:apm_debug_dump" ]
sources = [
"builtin_audio_processing_builder.cc",
"builtin_audio_processing_builder.h",
]
deps = [
":audio_processing",
":echo_control",
"..:make_ref_counted",
"..:scoped_refptr",
"../../modules/audio_processing",
"../../rtc_base:logging",
"../../rtc_base/system:rtc_export",
"../environment",
"//third_party/abseil-cpp/absl/base:nullability",
]
}
rtc_source_set("audio_processing_statistics") { rtc_source_set("audio_processing_statistics") {
visibility = [ "*" ] visibility = [ "*" ]
sources = [ sources = [
@ -142,3 +163,24 @@ rtc_source_set("echo_detector_creator") {
"../../modules/audio_processing:residual_echo_detector", "../../modules/audio_processing:residual_echo_detector",
] ]
} }
if (rtc_include_tests) {
rtc_library("audio_api_unittests") {
testonly = true
sources = [
"audio_processing_unittest.cc",
"builtin_audio_processing_builder_unittest.cc",
]
deps = [
":audio_processing",
":builtin_audio_processing_builder",
"..:make_ref_counted",
"..:scoped_refptr",
"../../modules/audio_processing:mocks",
"../../test:test_support",
"../environment",
"../environment:environment_factory",
"test:audio_api_unittests",
]
}
}

View file

@ -57,7 +57,7 @@ class AudioTransport {
uint32_t currentMicLevel, uint32_t currentMicLevel,
bool keyPressed, bool keyPressed,
uint32_t& newMicLevel, uint32_t& newMicLevel,
std::optional<int64_t> estimatedCaptureTimeNS) { // NOLINT std::optional<int64_t> /* estimatedCaptureTimeNS */) { // NOLINT
// TODO(webrtc:13620) Make the default behaver of the new API to behave as // TODO(webrtc:13620) Make the default behaver of the new API to behave as
// the old API. This can be pure virtual if all uses of the old API is // the old API. This can be pure virtual if all uses of the old API is
// removed. // removed.

View file

@ -9,8 +9,14 @@
*/ */
#include "api/audio/audio_processing.h" #include "api/audio/audio_processing.h"
#include <string>
#include <memory>
#include <string>
#include <utility>
#include "absl/base/nullability.h"
#include "api/environment/environment.h"
#include "api/scoped_refptr.h"
#include "rtc_base/checks.h" #include "rtc_base/checks.h"
#include "rtc_base/strings/string_builder.h" #include "rtc_base/strings/string_builder.h"
@ -52,7 +58,7 @@ std::string GainController1ModeToString(const Agc1Config::Mode& mode) {
constexpr int AudioProcessing::kNativeSampleRatesHz[]; constexpr int AudioProcessing::kNativeSampleRatesHz[];
void CustomProcessing::SetRuntimeSetting( void CustomProcessing::SetRuntimeSetting(
AudioProcessing::RuntimeSetting setting) {} AudioProcessing::RuntimeSetting /* setting */) {}
bool Agc1Config::operator==(const Agc1Config& rhs) const { bool Agc1Config::operator==(const Agc1Config& rhs) const {
const auto& analog_lhs = analog_gain_controller; const auto& analog_lhs = analog_gain_controller;
@ -208,4 +214,25 @@ std::string AudioProcessing::Config::ToString() const {
return builder.str(); return builder.str();
} }
absl::Nonnull<std::unique_ptr<AudioProcessingBuilderInterface>>
CustomAudioProcessing(
absl::Nonnull<scoped_refptr<AudioProcessing>> audio_processing) {
class Builder : public AudioProcessingBuilderInterface {
public:
explicit Builder(absl::Nonnull<scoped_refptr<AudioProcessing>> ap)
: ap_(std::move(ap)) {}
absl::Nullable<scoped_refptr<AudioProcessing>> Build(
const Environment& /*env*/) override {
return std::move(ap_);
}
private:
absl::Nonnull<scoped_refptr<AudioProcessing>> ap_;
};
RTC_CHECK(audio_processing);
return std::make_unique<Builder>(std::move(audio_processing));
}
} // namespace webrtc } // namespace webrtc

View file

@ -33,6 +33,7 @@
#include "api/array_view.h" #include "api/array_view.h"
#include "api/audio/audio_processing_statistics.h" #include "api/audio/audio_processing_statistics.h"
#include "api/audio/echo_control.h" #include "api/audio/echo_control.h"
#include "api/environment/environment.h"
#include "api/ref_count.h" #include "api/ref_count.h"
#include "api/scoped_refptr.h" #include "api/scoped_refptr.h"
#include "api/task_queue/task_queue_base.h" #include "api/task_queue/task_queue_base.h"
@ -85,7 +86,6 @@ class EchoDetector;
// float interfaces use deinterleaved data. // float interfaces use deinterleaved data.
// //
// Usage example, omitting error checking: // Usage example, omitting error checking:
// rtc::scoped_refptr<AudioProcessing> apm = AudioProcessingBuilder().Create();
// //
// AudioProcessing::Config config; // AudioProcessing::Config config;
// config.echo_canceller.enabled = true; // config.echo_canceller.enabled = true;
@ -101,7 +101,8 @@ class EchoDetector;
// //
// config.high_pass_filter.enabled = true; // config.high_pass_filter.enabled = true;
// //
// apm->ApplyConfig(config) // scoped_refptr<AudioProcessing> apm =
// BuiltinAudioProcessingBuilder(config).Build(CreateEnvironment());
// //
// // Start a voice call... // // Start a voice call...
// //
@ -743,6 +744,23 @@ class RTC_EXPORT AudioProcessing : public RefCountInterface {
static int GetFrameSize(int sample_rate_hz) { return sample_rate_hz / 100; } static int GetFrameSize(int sample_rate_hz) { return sample_rate_hz / 100; }
}; };
class AudioProcessingBuilderInterface {
public:
virtual ~AudioProcessingBuilderInterface() = default;
virtual absl::Nullable<scoped_refptr<AudioProcessing>> Build(
const Environment& env) = 0;
};
// Returns builder that returns the `audio_processing` ignoring the extra
// construction parameter `env`.
// nullptr `audio_processing` is not supported as in some scenarios that imply
// no audio processing, while in others - default builtin audio processing.
// Callers should be explicit which of these two behaviors they want.
absl::Nonnull<std::unique_ptr<AudioProcessingBuilderInterface>>
CustomAudioProcessing(
absl::Nonnull<scoped_refptr<AudioProcessing>> audio_processing);
// Experimental interface for a custom analysis submodule. // Experimental interface for a custom analysis submodule.
class CustomAudioAnalyzer { class CustomAudioAnalyzer {
public: public:
@ -772,7 +790,8 @@ class CustomProcessing {
virtual ~CustomProcessing() {} virtual ~CustomProcessing() {}
}; };
class RTC_EXPORT AudioProcessingBuilder { // Use BuiltinAudioProcessingBuilder instead, see bugs.webrtc.org/369904700
class RTC_EXPORT [[deprecated]] AudioProcessingBuilder {
public: public:
AudioProcessingBuilder(); AudioProcessingBuilder();
AudioProcessingBuilder(const AudioProcessingBuilder&) = delete; AudioProcessingBuilder(const AudioProcessingBuilder&) = delete;

View file

@ -0,0 +1,47 @@
/*
* Copyright (c) 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.
*/
#include "api/audio/audio_processing.h"
#include <memory>
#include "api/environment/environment_factory.h"
#include "api/make_ref_counted.h"
#include "api/scoped_refptr.h"
#include "modules/audio_processing/include/mock_audio_processing.h"
#include "test/gmock.h"
#include "test/gtest.h"
namespace webrtc {
using ::testing::_;
using ::testing::NotNull;
TEST(CustomAudioProcessingTest, ReturnsPassedAudioProcessing) {
scoped_refptr<AudioProcessing> ap =
make_ref_counted<test::MockAudioProcessing>();
std::unique_ptr<AudioProcessingBuilderInterface> builder =
CustomAudioProcessing(ap);
ASSERT_THAT(builder, NotNull());
EXPECT_EQ(builder->Build(CreateEnvironment()), ap);
}
#if GTEST_HAS_DEATH_TEST
TEST(CustomAudioProcessingTest, NullptrAudioProcessingIsUnsupported) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnonnull"
EXPECT_DEATH(CustomAudioProcessing(nullptr), _);
#pragma clang diagnostic pop
}
#endif
} // namespace webrtc

View file

@ -167,7 +167,7 @@ class DeinterleavedView {
}; };
template <typename T> template <typename T>
constexpr size_t NumChannels(const MonoView<T>& view) { constexpr size_t NumChannels(const MonoView<T>& /* view */) {
return 1u; return 1u;
} }
@ -182,22 +182,22 @@ size_t NumChannels(const DeinterleavedView<T>& view) {
} }
template <typename T> template <typename T>
constexpr bool IsMono(const MonoView<T>& view) { constexpr bool IsMono(const MonoView<T>& /* view */) {
return true; return true;
} }
template <typename T> template <typename T>
constexpr bool IsInterleavedView(const MonoView<T>& view) { constexpr bool IsInterleavedView(const MonoView<T>& /* view */) {
return true; return true;
} }
template <typename T> template <typename T>
constexpr bool IsInterleavedView(const InterleavedView<T>& view) { constexpr bool IsInterleavedView(const InterleavedView<T>& /* view */) {
return true; return true;
} }
template <typename T> template <typename T>
constexpr bool IsInterleavedView(const DeinterleavedView<const T>& view) { constexpr bool IsInterleavedView(const DeinterleavedView<const T>& /* view */) {
return false; return false;
} }

View file

@ -0,0 +1,34 @@
/*
* Copyright (c) 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.
*/
#include "api/audio/builtin_audio_processing_builder.h"
#include <utility>
#include "absl/base/nullability.h"
#include "api/audio/audio_processing.h"
#include "api/environment/environment.h"
#include "api/make_ref_counted.h"
#include "api/scoped_refptr.h"
#include "modules/audio_processing/audio_processing_impl.h"
#include "rtc_base/logging.h"
namespace webrtc {
absl::Nullable<scoped_refptr<AudioProcessing>>
BuiltinAudioProcessingBuilder::Build(const Environment& /*env*/) {
// TODO: bugs.webrtc.org/369904700 - Pass `env` when AudioProcessingImpl gets
// constructor that accepts it.
return make_ref_counted<AudioProcessingImpl>(
config_, std::move(capture_post_processing_),
std::move(render_pre_processing_), std::move(echo_control_factory_),
std::move(echo_detector_), std::move(capture_analyzer_));
}
} // namespace webrtc

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020 The WebRTC project authors. All Rights Reserved. * Copyright (c) 2024 The WebRTC project authors. All Rights Reserved.
* *
* Use of this source code is governed by a BSD-style license * 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 * that can be found in the LICENSE file in the root of the source
@ -8,65 +8,69 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#ifndef MODULES_AUDIO_PROCESSING_TEST_AUDIO_PROCESSING_BUILDER_FOR_TESTING_H_ #ifndef API_AUDIO_BUILTIN_AUDIO_PROCESSING_BUILDER_H_
#define MODULES_AUDIO_PROCESSING_TEST_AUDIO_PROCESSING_BUILDER_FOR_TESTING_H_ #define API_AUDIO_BUILTIN_AUDIO_PROCESSING_BUILDER_H_
#include <list>
#include <memory> #include <memory>
#include <utility> #include <utility>
#include <vector>
#include "absl/base/nullability.h"
#include "api/audio/audio_processing.h" #include "api/audio/audio_processing.h"
#include "api/audio/echo_control.h"
#include "api/environment/environment.h"
#include "api/scoped_refptr.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc { namespace webrtc {
// Facilitates building of AudioProcessingImp for the tests. class RTC_EXPORT BuiltinAudioProcessingBuilder
class AudioProcessingBuilderForTesting { : public AudioProcessingBuilderInterface {
public: public:
AudioProcessingBuilderForTesting(); BuiltinAudioProcessingBuilder() = default;
AudioProcessingBuilderForTesting(const AudioProcessingBuilderForTesting&) = explicit BuiltinAudioProcessingBuilder(const AudioProcessing::Config& config)
delete; : config_(config) {}
AudioProcessingBuilderForTesting& operator=( BuiltinAudioProcessingBuilder(const BuiltinAudioProcessingBuilder&) = delete;
const AudioProcessingBuilderForTesting&) = delete; BuiltinAudioProcessingBuilder& operator=(
~AudioProcessingBuilderForTesting(); const BuiltinAudioProcessingBuilder&) = delete;
~BuiltinAudioProcessingBuilder() override = default;
// Sets the APM configuration. // Sets the APM configuration.
AudioProcessingBuilderForTesting& SetConfig( BuiltinAudioProcessingBuilder& SetConfig(
const AudioProcessing::Config& config) { const AudioProcessing::Config& config) {
config_ = config; config_ = config;
return *this; return *this;
} }
// Sets the echo controller factory to inject when APM is created. // Sets the echo controller factory to inject when APM is created.
AudioProcessingBuilderForTesting& SetEchoControlFactory( BuiltinAudioProcessingBuilder& SetEchoControlFactory(
std::unique_ptr<EchoControlFactory> echo_control_factory) { std::unique_ptr<EchoControlFactory> echo_control_factory) {
echo_control_factory_ = std::move(echo_control_factory); echo_control_factory_ = std::move(echo_control_factory);
return *this; return *this;
} }
// Sets the capture post-processing sub-module to inject when APM is created. // Sets the capture post-processing sub-module to inject when APM is created.
AudioProcessingBuilderForTesting& SetCapturePostProcessing( BuiltinAudioProcessingBuilder& SetCapturePostProcessing(
std::unique_ptr<CustomProcessing> capture_post_processing) { std::unique_ptr<CustomProcessing> capture_post_processing) {
capture_post_processing_ = std::move(capture_post_processing); capture_post_processing_ = std::move(capture_post_processing);
return *this; return *this;
} }
// Sets the render pre-processing sub-module to inject when APM is created. // Sets the render pre-processing sub-module to inject when APM is created.
AudioProcessingBuilderForTesting& SetRenderPreProcessing( BuiltinAudioProcessingBuilder& SetRenderPreProcessing(
std::unique_ptr<CustomProcessing> render_pre_processing) { std::unique_ptr<CustomProcessing> render_pre_processing) {
render_pre_processing_ = std::move(render_pre_processing); render_pre_processing_ = std::move(render_pre_processing);
return *this; return *this;
} }
// Sets the echo detector to inject when APM is created. // Sets the echo detector to inject when APM is created.
AudioProcessingBuilderForTesting& SetEchoDetector( BuiltinAudioProcessingBuilder& SetEchoDetector(
rtc::scoped_refptr<EchoDetector> echo_detector) { rtc::scoped_refptr<EchoDetector> echo_detector) {
echo_detector_ = std::move(echo_detector); echo_detector_ = std::move(echo_detector);
return *this; return *this;
} }
// Sets the capture analyzer sub-module to inject when APM is created. // Sets the capture analyzer sub-module to inject when APM is created.
AudioProcessingBuilderForTesting& SetCaptureAnalyzer( BuiltinAudioProcessingBuilder& SetCaptureAnalyzer(
std::unique_ptr<CustomAudioAnalyzer> capture_analyzer) { std::unique_ptr<CustomAudioAnalyzer> capture_analyzer) {
capture_analyzer_ = std::move(capture_analyzer); capture_analyzer_ = std::move(capture_analyzer);
return *this; return *this;
@ -74,22 +78,19 @@ class AudioProcessingBuilderForTesting {
// Creates an APM instance with the specified config or the default one if // Creates an APM instance with the specified config or the default one if
// unspecified. Injects the specified components transferring the ownership // unspecified. Injects the specified components transferring the ownership
// to the newly created APM instance - i.e., except for the config, the // to the newly created APM instance.
// builder is reset to its initial state. absl::Nullable<scoped_refptr<AudioProcessing>> Build(
rtc::scoped_refptr<AudioProcessing> Create(); const Environment& env) override;
private: private:
// Transfers the ownership to a non-testing builder.
void TransferOwnershipsToBuilder(AudioProcessingBuilder* builder);
AudioProcessing::Config config_; AudioProcessing::Config config_;
std::unique_ptr<EchoControlFactory> echo_control_factory_; std::unique_ptr<EchoControlFactory> echo_control_factory_;
std::unique_ptr<CustomProcessing> capture_post_processing_; std::unique_ptr<CustomProcessing> capture_post_processing_;
std::unique_ptr<CustomProcessing> render_pre_processing_; std::unique_ptr<CustomProcessing> render_pre_processing_;
rtc::scoped_refptr<EchoDetector> echo_detector_; scoped_refptr<EchoDetector> echo_detector_;
std::unique_ptr<CustomAudioAnalyzer> capture_analyzer_; std::unique_ptr<CustomAudioAnalyzer> capture_analyzer_;
}; };
} // namespace webrtc } // namespace webrtc
#endif // MODULES_AUDIO_PROCESSING_TEST_AUDIO_PROCESSING_BUILDER_FOR_TESTING_H_ #endif // API_AUDIO_BUILTIN_AUDIO_PROCESSING_BUILDER_H_

View file

@ -0,0 +1,48 @@
/*
* Copyright (c) 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.
*/
#include "api/audio/builtin_audio_processing_builder.h"
#include "api/audio/audio_processing.h"
#include "api/environment/environment.h"
#include "api/environment/environment_factory.h"
#include "api/scoped_refptr.h"
#include "test/gmock.h"
#include "test/gtest.h"
namespace webrtc {
using ::testing::NotNull;
TEST(BuiltinAudioProcessingBuilderTest, CreatesWithDefaults) {
EXPECT_THAT(BuiltinAudioProcessingBuilder().Build(CreateEnvironment()),
NotNull());
}
TEST(BuiltinAudioProcessingBuilderTest, CreatesWithConfig) {
const Environment env = CreateEnvironment();
AudioProcessing::Config config;
// Change a field to make config different to default one.
config.gain_controller1.enabled = !config.gain_controller1.enabled;
scoped_refptr<AudioProcessing> ap1 =
BuiltinAudioProcessingBuilder(config).Build(env);
ASSERT_THAT(ap1, NotNull());
EXPECT_EQ(ap1->GetConfig().gain_controller1.enabled,
config.gain_controller1.enabled);
scoped_refptr<AudioProcessing> ap2 =
BuiltinAudioProcessingBuilder().SetConfig(config).Build(env);
ASSERT_THAT(ap2, NotNull());
EXPECT_EQ(ap2->GetConfig().gain_controller1.enabled,
config.gain_controller1.enabled);
}
} // namespace webrtc

View file

@ -53,7 +53,7 @@ class EchoControl {
// resulting output is anyway not used, for instance when the endpoint is // resulting output is anyway not used, for instance when the endpoint is
// muted. // muted.
// TODO(b/177830919): Make pure virtual. // TODO(b/177830919): Make pure virtual.
virtual void SetCaptureOutputUsage(bool capture_output_used) {} virtual void SetCaptureOutputUsage(bool /* capture_output_used */) {}
// Returns wheter the signal is altered. // Returns wheter the signal is altered.
virtual bool ActiveProcessing() const = 0; virtual bool ActiveProcessing() const = 0;

View file

@ -17,9 +17,9 @@
namespace webrtc { namespace webrtc {
// Returns an instance of the WebRTC implementation of a residual echo detector. // Returns an instance of the WebRTC implementation of a residual echo detector.
// It can be provided to the webrtc::AudioProcessingBuilder to obtain the // It can be provided to the webrtc::BuiltinAudioProcessingBuilder to obtain the
// usual residual echo metrics. // usual residual echo metrics.
rtc::scoped_refptr<EchoDetector> CreateEchoDetector(); scoped_refptr<EchoDetector> CreateEchoDetector();
} // namespace webrtc } // namespace webrtc

View file

@ -66,12 +66,6 @@ rtc_library("builtin_audio_decoder_factory") {
"g722:audio_decoder_g722", "g722:audio_decoder_g722",
] ]
defines = [] defines = []
if (rtc_include_ilbc) {
deps += [ "ilbc:audio_decoder_ilbc" ]
defines += [ "WEBRTC_USE_BUILTIN_ILBC=1" ]
} else {
defines += [ "WEBRTC_USE_BUILTIN_ILBC=0" ]
}
if (rtc_include_opus) { if (rtc_include_opus) {
deps += [ deps += [
"opus:audio_decoder_multiopus", "opus:audio_decoder_multiopus",
@ -99,15 +93,6 @@ rtc_library("builtin_audio_encoder_factory") {
"g722:audio_encoder_g722", "g722:audio_encoder_g722",
] ]
defines = [] defines = []
if (rtc_include_ilbc) {
deps += [
"..:field_trials_view",
"ilbc:audio_encoder_ilbc",
]
defines += [ "WEBRTC_USE_BUILTIN_ILBC=1" ]
} else {
defines += [ "WEBRTC_USE_BUILTIN_ILBC=0" ]
}
if (rtc_include_opus) { if (rtc_include_opus) {
deps += [ deps += [
"..:field_trials_view", "..:field_trials_view",

View file

@ -45,7 +45,7 @@ void AudioDecoderL16::AppendSupportedDecoders(
std::unique_ptr<AudioDecoder> AudioDecoderL16::MakeAudioDecoder( std::unique_ptr<AudioDecoder> AudioDecoderL16::MakeAudioDecoder(
const Config& config, const Config& config,
std::optional<AudioCodecPairId> /*codec_pair_id*/, std::optional<AudioCodecPairId> /*codec_pair_id*/,
const FieldTrialsView* field_trials) { const FieldTrialsView* /* field_trials */) {
if (!config.IsOk()) { if (!config.IsOk()) {
return nullptr; return nullptr;
} }

View file

@ -72,7 +72,7 @@ std::unique_ptr<AudioEncoder> AudioEncoderL16::MakeAudioEncoder(
const AudioEncoderL16::Config& config, const AudioEncoderL16::Config& config,
int payload_type, int payload_type,
std::optional<AudioCodecPairId> /*codec_pair_id*/, std::optional<AudioCodecPairId> /*codec_pair_id*/,
const FieldTrialsView* field_trials) { const FieldTrialsView* /* field_trials */) {
AudioEncoderPcm16B::Config c; AudioEncoderPcm16B::Config c;
c.sample_rate_hz = config.sample_rate_hz; c.sample_rate_hz = config.sample_rate_hz;
c.num_channels = config.num_channels; c.num_channels = config.num_channels;

View file

@ -130,7 +130,8 @@ bool AudioDecoder::HasDecodePlc() const {
return false; return false;
} }
size_t AudioDecoder::DecodePlc(size_t num_frames, int16_t* decoded) { size_t AudioDecoder::DecodePlc(size_t /* num_frames */,
int16_t* /* decoded */) {
return 0; return 0;
} }
@ -142,18 +143,18 @@ int AudioDecoder::ErrorCode() {
return 0; return 0;
} }
int AudioDecoder::PacketDuration(const uint8_t* encoded, int AudioDecoder::PacketDuration(const uint8_t* /* encoded */,
size_t encoded_len) const { size_t /* encoded_len */) const {
return kNotImplemented; return kNotImplemented;
} }
int AudioDecoder::PacketDurationRedundant(const uint8_t* encoded, int AudioDecoder::PacketDurationRedundant(const uint8_t* /* encoded */,
size_t encoded_len) const { size_t /* encoded_len */) const {
return kNotImplemented; return kNotImplemented;
} }
bool AudioDecoder::PacketHasFec(const uint8_t* encoded, bool AudioDecoder::PacketHasFec(const uint8_t* /* encoded */,
size_t encoded_len) const { size_t /* encoded_len */) const {
return false; return false;
} }

View file

@ -34,13 +34,16 @@ struct Helper;
// Base case: 0 template parameters. // Base case: 0 template parameters.
template <> template <>
struct Helper<> { struct Helper<> {
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs) {} static void AppendSupportedDecoders(
static bool IsSupportedDecoder(const SdpAudioFormat& format) { return false; } std::vector<AudioCodecSpec>* /* specs */) {}
static bool IsSupportedDecoder(const SdpAudioFormat& /* format */) {
return false;
}
static absl::Nullable<std::unique_ptr<AudioDecoder>> MakeAudioDecoder( static absl::Nullable<std::unique_ptr<AudioDecoder>> MakeAudioDecoder(
const Environment& env, const Environment& /* env */,
const SdpAudioFormat& format, const SdpAudioFormat& /* format */,
std::optional<AudioCodecPairId> codec_pair_id) { std::optional<AudioCodecPairId> /* codec_pair_id */) {
return nullptr; return nullptr;
} }
}; };
@ -72,7 +75,7 @@ template <typename Trait,
std::unique_ptr<AudioDecoder>>>> std::unique_ptr<AudioDecoder>>>>
absl::Nullable<std::unique_ptr<AudioDecoder>> CreateDecoder( absl::Nullable<std::unique_ptr<AudioDecoder>> CreateDecoder(
Rank0, Rank0,
const Environment& env, const Environment& /* env */,
const typename Trait::Config& config, const typename Trait::Config& config,
std::optional<AudioCodecPairId> codec_pair_id) { std::optional<AudioCodecPairId> codec_pair_id) {
return Trait::MakeAudioDecoder(config, codec_pair_id); return Trait::MakeAudioDecoder(config, codec_pair_id);

View file

@ -67,31 +67,32 @@ bool AudioEncoder::GetDtx() const {
return false; return false;
} }
bool AudioEncoder::SetApplication(Application application) { bool AudioEncoder::SetApplication(Application /* application */) {
return false; return false;
} }
void AudioEncoder::SetMaxPlaybackRate(int frequency_hz) {} void AudioEncoder::SetMaxPlaybackRate(int /* frequency_hz */) {}
void AudioEncoder::SetTargetBitrate(int target_bps) {} void AudioEncoder::SetTargetBitrate(int /* target_bps */) {}
rtc::ArrayView<std::unique_ptr<AudioEncoder>> rtc::ArrayView<std::unique_ptr<AudioEncoder>>
AudioEncoder::ReclaimContainedEncoders() { AudioEncoder::ReclaimContainedEncoders() {
return nullptr; return nullptr;
} }
bool AudioEncoder::EnableAudioNetworkAdaptor(const std::string& config_string, bool AudioEncoder::EnableAudioNetworkAdaptor(
RtcEventLog* event_log) { const std::string& /* config_string */,
RtcEventLog* /* event_log */) {
return false; return false;
} }
void AudioEncoder::DisableAudioNetworkAdaptor() {} void AudioEncoder::DisableAudioNetworkAdaptor() {}
void AudioEncoder::OnReceivedUplinkPacketLossFraction( void AudioEncoder::OnReceivedUplinkPacketLossFraction(
float uplink_packet_loss_fraction) {} float /* uplink_packet_loss_fraction */) {}
void AudioEncoder::OnReceivedUplinkRecoverablePacketLossFraction( void AudioEncoder::OnReceivedUplinkRecoverablePacketLossFraction(
float uplink_recoverable_packet_loss_fraction) { float /* uplink_recoverable_packet_loss_fraction */) {
RTC_DCHECK_NOTREACHED(); RTC_DCHECK_NOTREACHED();
} }
@ -100,20 +101,20 @@ void AudioEncoder::OnReceivedTargetAudioBitrate(int target_audio_bitrate_bps) {
} }
void AudioEncoder::OnReceivedUplinkBandwidth( void AudioEncoder::OnReceivedUplinkBandwidth(
int target_audio_bitrate_bps, int /* target_audio_bitrate_bps */,
std::optional<int64_t> bwe_period_ms) {} std::optional<int64_t> /* bwe_period_ms */) {}
void AudioEncoder::OnReceivedUplinkAllocation(BitrateAllocationUpdate update) { void AudioEncoder::OnReceivedUplinkAllocation(BitrateAllocationUpdate update) {
OnReceivedUplinkBandwidth(update.target_bitrate.bps(), OnReceivedUplinkBandwidth(update.target_bitrate.bps(),
update.bwe_period.ms()); update.bwe_period.ms());
} }
void AudioEncoder::OnReceivedRtt(int rtt_ms) {} void AudioEncoder::OnReceivedRtt(int /* rtt_ms */) {}
void AudioEncoder::OnReceivedOverhead(size_t overhead_bytes_per_packet) {} void AudioEncoder::OnReceivedOverhead(size_t /* overhead_bytes_per_packet */) {}
void AudioEncoder::SetReceiverFrameLengthRange(int min_frame_length_ms, void AudioEncoder::SetReceiverFrameLengthRange(int /* min_frame_length_ms */,
int max_frame_length_ms) {} int /* max_frame_length_ms */) {}
ANAStats AudioEncoder::GetANAStats() const { ANAStats AudioEncoder::GetANAStats() const {
return ANAStats(); return ANAStats();

View file

@ -35,15 +35,16 @@ struct Helper;
// Base case: 0 template parameters. // Base case: 0 template parameters.
template <> template <>
struct Helper<> { struct Helper<> {
static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs) {} static void AppendSupportedEncoders(
std::vector<AudioCodecSpec>* /* specs */) {}
static std::optional<AudioCodecInfo> QueryAudioEncoder( static std::optional<AudioCodecInfo> QueryAudioEncoder(
const SdpAudioFormat& format) { const SdpAudioFormat& /* format */) {
return std::nullopt; return std::nullopt;
} }
static absl::Nullable<std::unique_ptr<AudioEncoder>> CreateAudioEncoder( static absl::Nullable<std::unique_ptr<AudioEncoder>> CreateAudioEncoder(
const Environment& env, const Environment& /* env */,
const SdpAudioFormat& format, const SdpAudioFormat& /* format */,
const AudioEncoderFactory::Options& options) { const AudioEncoderFactory::Options& /* options */) {
return nullptr; return nullptr;
} }
}; };
@ -76,7 +77,7 @@ template <typename Trait,
std::unique_ptr<AudioEncoder>>>> std::unique_ptr<AudioEncoder>>>>
absl::Nullable<std::unique_ptr<AudioEncoder>> CreateEncoder( absl::Nullable<std::unique_ptr<AudioEncoder>> CreateEncoder(
Rank0, Rank0,
const Environment& env, const Environment& /* env */,
const typename Trait::Config& config, const typename Trait::Config& config,
const AudioEncoderFactory::Options& options) { const AudioEncoderFactory::Options& options) {
return Trait::MakeAudioEncoder(config, options.payload_type, return Trait::MakeAudioEncoder(config, options.payload_type,

View file

@ -23,9 +23,6 @@
#include "api/audio_codecs/g711/audio_decoder_g711.h" #include "api/audio_codecs/g711/audio_decoder_g711.h"
#include "api/audio_codecs/g722/audio_decoder_g722.h" #include "api/audio_codecs/g722/audio_decoder_g722.h"
#include "api/scoped_refptr.h" #include "api/scoped_refptr.h"
#if WEBRTC_USE_BUILTIN_ILBC
#include "api/audio_codecs/ilbc/audio_decoder_ilbc.h" // nogncheck
#endif
#if WEBRTC_USE_BUILTIN_OPUS #if WEBRTC_USE_BUILTIN_OPUS
#include "api/audio_codecs/opus/audio_decoder_multi_channel_opus.h" #include "api/audio_codecs/opus/audio_decoder_multi_channel_opus.h"
#include "api/audio_codecs/opus/audio_decoder_opus.h" // nogncheck #include "api/audio_codecs/opus/audio_decoder_opus.h" // nogncheck
@ -42,7 +39,8 @@ struct NotAdvertised {
static std::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format) { static std::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format) {
return T::SdpToConfig(audio_format); return T::SdpToConfig(audio_format);
} }
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs) { static void AppendSupportedDecoders(
std::vector<AudioCodecSpec>* /* specs */) {
// Don't advertise support for anything. // Don't advertise support for anything.
} }
static std::unique_ptr<AudioDecoder> MakeAudioDecoder( static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
@ -62,11 +60,6 @@ rtc::scoped_refptr<AudioDecoderFactory> CreateBuiltinAudioDecoderFactory() {
#endif #endif
AudioDecoderG722, AudioDecoderG722,
#if WEBRTC_USE_BUILTIN_ILBC
AudioDecoderIlbc,
#endif
AudioDecoderG711, NotAdvertised<AudioDecoderL16>>(); AudioDecoderG711, NotAdvertised<AudioDecoderL16>>();
} }

View file

@ -24,9 +24,6 @@
#include "api/audio_codecs/g722/audio_encoder_g722.h" #include "api/audio_codecs/g722/audio_encoder_g722.h"
#include "api/field_trials_view.h" #include "api/field_trials_view.h"
#include "api/scoped_refptr.h" #include "api/scoped_refptr.h"
#if WEBRTC_USE_BUILTIN_ILBC
#include "api/audio_codecs/ilbc/audio_encoder_ilbc.h" // nogncheck
#endif
#if WEBRTC_USE_BUILTIN_OPUS #if WEBRTC_USE_BUILTIN_OPUS
#include "api/audio_codecs/opus/audio_encoder_multi_channel_opus.h" #include "api/audio_codecs/opus/audio_encoder_multi_channel_opus.h"
#include "api/audio_codecs/opus/audio_encoder_opus.h" // nogncheck #include "api/audio_codecs/opus/audio_encoder_opus.h" // nogncheck
@ -43,7 +40,8 @@ struct NotAdvertised {
static std::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format) { static std::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format) {
return T::SdpToConfig(audio_format); return T::SdpToConfig(audio_format);
} }
static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs) { static void AppendSupportedEncoders(
std::vector<AudioCodecSpec>* /* specs */) {
// Don't advertise support for anything. // Don't advertise support for anything.
} }
static AudioCodecInfo QueryAudioEncoder(const Config& config) { static AudioCodecInfo QueryAudioEncoder(const Config& config) {
@ -69,11 +67,6 @@ rtc::scoped_refptr<AudioEncoderFactory> CreateBuiltinAudioEncoderFactory() {
#endif #endif
AudioEncoderG722, AudioEncoderG722,
#if WEBRTC_USE_BUILTIN_ILBC
AudioEncoderIlbc,
#endif
AudioEncoderG711, NotAdvertised<AudioEncoderL16>>(); AudioEncoderG711, NotAdvertised<AudioEncoderL16>>();
} }

View file

@ -56,7 +56,7 @@ void AudioDecoderG711::AppendSupportedDecoders(
std::unique_ptr<AudioDecoder> AudioDecoderG711::MakeAudioDecoder( std::unique_ptr<AudioDecoder> AudioDecoderG711::MakeAudioDecoder(
const Config& config, const Config& config,
std::optional<AudioCodecPairId> /*codec_pair_id*/, std::optional<AudioCodecPairId> /*codec_pair_id*/,
const FieldTrialsView* field_trials) { const FieldTrialsView* /* field_trials */) {
if (!config.IsOk()) { if (!config.IsOk()) {
RTC_DCHECK_NOTREACHED(); RTC_DCHECK_NOTREACHED();
return nullptr; return nullptr;

View file

@ -77,7 +77,7 @@ std::unique_ptr<AudioEncoder> AudioEncoderG711::MakeAudioEncoder(
const Config& config, const Config& config,
int payload_type, int payload_type,
std::optional<AudioCodecPairId> /*codec_pair_id*/, std::optional<AudioCodecPairId> /*codec_pair_id*/,
const FieldTrialsView* field_trials) { const FieldTrialsView* /* field_trials */) {
if (!config.IsOk()) { if (!config.IsOk()) {
RTC_DCHECK_NOTREACHED(); RTC_DCHECK_NOTREACHED();
return nullptr; return nullptr;

View file

@ -44,7 +44,7 @@ void AudioDecoderG722::AppendSupportedDecoders(
std::unique_ptr<AudioDecoder> AudioDecoderG722::MakeAudioDecoder( std::unique_ptr<AudioDecoder> AudioDecoderG722::MakeAudioDecoder(
Config config, Config config,
std::optional<AudioCodecPairId> /*codec_pair_id*/, std::optional<AudioCodecPairId> /*codec_pair_id*/,
const FieldTrialsView* field_trials) { const FieldTrialsView* /* field_trials */) {
if (!config.IsOk()) { if (!config.IsOk()) {
RTC_DCHECK_NOTREACHED(); RTC_DCHECK_NOTREACHED();
return nullptr; return nullptr;

View file

@ -75,7 +75,7 @@ std::unique_ptr<AudioEncoder> AudioEncoderG722::MakeAudioEncoder(
const AudioEncoderG722Config& config, const AudioEncoderG722Config& config,
int payload_type, int payload_type,
std::optional<AudioCodecPairId> /*codec_pair_id*/, std::optional<AudioCodecPairId> /*codec_pair_id*/,
const FieldTrialsView* field_trials) { const FieldTrialsView* /* field_trials */) {
if (!config.IsOk()) { if (!config.IsOk()) {
RTC_DCHECK_NOTREACHED(); RTC_DCHECK_NOTREACHED();
return nullptr; return nullptr;

View file

@ -1,53 +0,0 @@
# Copyright (c) 2017 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.
import("../../../webrtc.gni")
if (is_android) {
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
}
rtc_source_set("audio_encoder_ilbc_config") {
visibility = [ "*" ]
sources = [ "audio_encoder_ilbc_config.h" ]
}
rtc_library("audio_encoder_ilbc") {
visibility = [ "*" ]
poisonous = [ "audio_codecs" ]
sources = [
"audio_encoder_ilbc.cc",
"audio_encoder_ilbc.h",
]
deps = [
":audio_encoder_ilbc_config",
"..:audio_codecs_api",
"../../../api:field_trials_view",
"../../../modules/audio_coding:ilbc",
"../../../rtc_base:checks",
"../../../rtc_base:safe_conversions",
"../../../rtc_base:safe_minmax",
"../../../rtc_base:stringutils",
"//third_party/abseil-cpp/absl/strings",
]
}
rtc_library("audio_decoder_ilbc") {
visibility = [ "*" ]
poisonous = [ "audio_codecs" ]
sources = [
"audio_decoder_ilbc.cc",
"audio_decoder_ilbc.h",
]
deps = [
"..:audio_codecs_api",
"../../../api:field_trials_view",
"../../../modules/audio_coding:ilbc",
"//third_party/abseil-cpp/absl/strings",
]
}

View file

@ -1,48 +0,0 @@
/*
* Copyright (c) 2017 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.
*/
#include "api/audio_codecs/ilbc/audio_decoder_ilbc.h"
#include <memory>
#include <optional>
#include <vector>
#include "absl/strings/match.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_decoder.h"
#include "api/audio_codecs/audio_format.h"
#include "api/field_trials_view.h"
#include "modules/audio_coding/codecs/ilbc/audio_decoder_ilbc.h"
namespace webrtc {
std::optional<AudioDecoderIlbc::Config> AudioDecoderIlbc::SdpToConfig(
const SdpAudioFormat& format) {
if (absl::EqualsIgnoreCase(format.name, "ILBC") &&
format.clockrate_hz == 8000 && format.num_channels == 1) {
return Config();
}
return std::nullopt;
}
void AudioDecoderIlbc::AppendSupportedDecoders(
std::vector<AudioCodecSpec>* specs) {
// RingRTC change to disable unused audio codecs
// specs->push_back({{"ILBC", 8000, 1}, {8000, 1, 13300}});
}
std::unique_ptr<AudioDecoder> AudioDecoderIlbc::MakeAudioDecoder(
Config config,
std::optional<AudioCodecPairId> /*codec_pair_id*/,
const FieldTrialsView* field_trials) {
return std::make_unique<AudioDecoderIlbcImpl>();
}
} // namespace webrtc

View file

@ -1,39 +0,0 @@
/*
* Copyright (c) 2017 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_AUDIO_CODECS_ILBC_AUDIO_DECODER_ILBC_H_
#define API_AUDIO_CODECS_ILBC_AUDIO_DECODER_ILBC_H_
#include <memory>
#include <optional>
#include <vector>
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_decoder.h"
#include "api/audio_codecs/audio_format.h"
#include "api/field_trials_view.h"
namespace webrtc {
// ILBC decoder API for use as a template parameter to
// CreateAudioDecoderFactory<...>().
struct AudioDecoderIlbc {
struct Config {}; // Empty---no config values needed!
static std::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
Config config,
std::optional<AudioCodecPairId> codec_pair_id = std::nullopt,
const FieldTrialsView* field_trials = nullptr);
};
} // namespace webrtc
#endif // API_AUDIO_CODECS_ILBC_AUDIO_DECODER_ILBC_H_

View file

@ -1,98 +0,0 @@
/*
* Copyright (c) 2017 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.
*/
#include "api/audio_codecs/ilbc/audio_encoder_ilbc.h"
#include <map>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "absl/strings/match.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_encoder.h"
#include "api/audio_codecs/audio_format.h"
#include "api/audio_codecs/ilbc/audio_encoder_ilbc_config.h"
#include "api/field_trials_view.h"
#include "modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.h"
#include "rtc_base/checks.h"
#include "rtc_base/numerics/safe_minmax.h"
#include "rtc_base/string_to_number.h"
namespace webrtc {
namespace {
int GetIlbcBitrate(int ptime) {
switch (ptime) {
case 20:
case 40:
// 38 bytes per frame of 20 ms => 15200 bits/s.
return 15200;
case 30:
case 60:
// 50 bytes per frame of 30 ms => (approx) 13333 bits/s.
return 13333;
default:
RTC_CHECK_NOTREACHED();
}
}
} // namespace
std::optional<AudioEncoderIlbcConfig> AudioEncoderIlbc::SdpToConfig(
const SdpAudioFormat& format) {
if (!absl::EqualsIgnoreCase(format.name.c_str(), "ILBC") ||
format.clockrate_hz != 8000 || format.num_channels != 1) {
return std::nullopt;
}
AudioEncoderIlbcConfig config;
auto ptime_iter = format.parameters.find("ptime");
if (ptime_iter != format.parameters.end()) {
auto ptime = rtc::StringToNumber<int>(ptime_iter->second);
if (ptime && *ptime > 0) {
const int whole_packets = *ptime / 10;
config.frame_size_ms = rtc::SafeClamp<int>(whole_packets * 10, 20, 60);
}
}
if (!config.IsOk()) {
RTC_DCHECK_NOTREACHED();
return std::nullopt;
}
return config;
}
void AudioEncoderIlbc::AppendSupportedEncoders(
std::vector<AudioCodecSpec>* specs) {
// RingRTC change to disable unused audio codecs
// const SdpAudioFormat fmt = {"ILBC", 8000, 1};
// const AudioCodecInfo info = QueryAudioEncoder(*SdpToConfig(fmt));
// specs->push_back({fmt, info});
}
AudioCodecInfo AudioEncoderIlbc::QueryAudioEncoder(
const AudioEncoderIlbcConfig& config) {
RTC_DCHECK(config.IsOk());
return {8000, 1, GetIlbcBitrate(config.frame_size_ms)};
}
std::unique_ptr<AudioEncoder> AudioEncoderIlbc::MakeAudioEncoder(
const AudioEncoderIlbcConfig& config,
int payload_type,
std::optional<AudioCodecPairId> /*codec_pair_id*/,
const FieldTrialsView* field_trials) {
if (!config.IsOk()) {
RTC_DCHECK_NOTREACHED();
return nullptr;
}
return std::make_unique<AudioEncoderIlbcImpl>(config, payload_type);
}
} // namespace webrtc

View file

@ -1,43 +0,0 @@
/*
* Copyright (c) 2017 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_AUDIO_CODECS_ILBC_AUDIO_ENCODER_ILBC_H_
#define API_AUDIO_CODECS_ILBC_AUDIO_ENCODER_ILBC_H_
#include <memory>
#include <optional>
#include <vector>
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_encoder.h"
#include "api/audio_codecs/audio_format.h"
#include "api/audio_codecs/ilbc/audio_encoder_ilbc_config.h"
#include "api/field_trials_view.h"
namespace webrtc {
// ILBC encoder API for use as a template parameter to
// CreateAudioEncoderFactory<...>().
struct AudioEncoderIlbc {
using Config = AudioEncoderIlbcConfig;
static std::optional<AudioEncoderIlbcConfig> SdpToConfig(
const SdpAudioFormat& audio_format);
static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs);
static AudioCodecInfo QueryAudioEncoder(const AudioEncoderIlbcConfig& config);
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
const AudioEncoderIlbcConfig& config,
int payload_type,
std::optional<AudioCodecPairId> codec_pair_id = std::nullopt,
const FieldTrialsView* field_trials = nullptr);
};
} // namespace webrtc
#endif // API_AUDIO_CODECS_ILBC_AUDIO_ENCODER_ILBC_H_

View file

@ -1,28 +0,0 @@
/*
* Copyright (c) 2017 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_AUDIO_CODECS_ILBC_AUDIO_ENCODER_ILBC_CONFIG_H_
#define API_AUDIO_CODECS_ILBC_AUDIO_ENCODER_ILBC_CONFIG_H_
namespace webrtc {
struct AudioEncoderIlbcConfig {
bool IsOk() const {
return (frame_size_ms == 20 || frame_size_ms == 30 || frame_size_ms == 40 ||
frame_size_ms == 60);
}
int frame_size_ms = 30; // Valid values are 20, 30, 40, and 60 ms.
// Note that frame size 40 ms produces encodings with two 20 ms frames in
// them, and frame size 60 ms consists of two 30 ms frames.
};
} // namespace webrtc
#endif // API_AUDIO_CODECS_ILBC_AUDIO_ENCODER_ILBC_CONFIG_H_

View file

@ -69,7 +69,7 @@ void AudioDecoderMultiChannelOpus::AppendSupportedDecoders(
std::unique_ptr<AudioDecoder> AudioDecoderMultiChannelOpus::MakeAudioDecoder( std::unique_ptr<AudioDecoder> AudioDecoderMultiChannelOpus::MakeAudioDecoder(
AudioDecoderMultiChannelOpusConfig config, AudioDecoderMultiChannelOpusConfig config,
std::optional<AudioCodecPairId> /*codec_pair_id*/, std::optional<AudioCodecPairId> /*codec_pair_id*/,
const FieldTrialsView* field_trials) { const FieldTrialsView* /* field_trials */) {
return AudioDecoderMultiChannelOpusImpl::MakeAudioDecoder(config); return AudioDecoderMultiChannelOpusImpl::MakeAudioDecoder(config);
} }
} // namespace webrtc } // namespace webrtc

View file

@ -67,7 +67,7 @@ std::unique_ptr<AudioEncoder> AudioEncoderMultiChannelOpus::MakeAudioEncoder(
const AudioEncoderMultiChannelOpusConfig& config, const AudioEncoderMultiChannelOpusConfig& config,
int payload_type, int payload_type,
std::optional<AudioCodecPairId> /*codec_pair_id*/, std::optional<AudioCodecPairId> /*codec_pair_id*/,
const FieldTrialsView* field_trials) { const FieldTrialsView* /* field_trials */) {
return AudioEncoderMultiChannelOpusImpl::MakeAudioEncoder(config, return AudioEncoderMultiChannelOpusImpl::MakeAudioEncoder(config,
payload_type); payload_type);
} }

View file

@ -34,7 +34,8 @@ struct NotAdvertised {
static std::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format) { static std::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format) {
return T::SdpToConfig(audio_format); return T::SdpToConfig(audio_format);
} }
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs) { static void AppendSupportedDecoders(
std::vector<AudioCodecSpec>* /* specs */) {
// Don't advertise support for anything. // Don't advertise support for anything.
} }
static std::unique_ptr<AudioDecoder> MakeAudioDecoder( static std::unique_ptr<AudioDecoder> MakeAudioDecoder(

View file

@ -34,7 +34,8 @@ struct NotAdvertised {
static std::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format) { static std::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format) {
return T::SdpToConfig(audio_format); return T::SdpToConfig(audio_format);
} }
static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs) { static void AppendSupportedEncoders(
std::vector<AudioCodecSpec>* /* specs */) {
// Don't advertise support for anything. // Don't advertise support for anything.
} }
static AudioCodecInfo QueryAudioEncoder(const Config& config) { static AudioCodecInfo QueryAudioEncoder(const Config& config) {

View file

@ -33,8 +33,6 @@ if (rtc_include_tests) {
"../g711:audio_encoder_g711", "../g711:audio_encoder_g711",
"../g722:audio_decoder_g722", "../g722:audio_decoder_g722",
"../g722:audio_encoder_g722", "../g722:audio_encoder_g722",
"../ilbc:audio_decoder_ilbc",
"../ilbc:audio_encoder_ilbc",
"../opus:audio_decoder_opus", "../opus:audio_decoder_opus",
"../opus:audio_encoder_opus", "../opus:audio_encoder_opus",
] ]

View file

@ -22,7 +22,6 @@
#include "api/audio_codecs/audio_format.h" #include "api/audio_codecs/audio_format.h"
#include "api/audio_codecs/g711/audio_decoder_g711.h" #include "api/audio_codecs/g711/audio_decoder_g711.h"
#include "api/audio_codecs/g722/audio_decoder_g722.h" #include "api/audio_codecs/g722/audio_decoder_g722.h"
#include "api/audio_codecs/ilbc/audio_decoder_ilbc.h"
#include "api/audio_codecs/opus/audio_decoder_opus.h" #include "api/audio_codecs/opus/audio_decoder_opus.h"
#include "api/environment/environment.h" #include "api/environment/environment.h"
#include "api/environment/environment_factory.h" #include "api/environment/environment_factory.h"
@ -94,7 +93,8 @@ struct BaseAudioDecoderApi {
static SdpAudioFormat AudioFormat() { return {"fake", 16'000, 2, {}}; } static SdpAudioFormat AudioFormat() { return {"fake", 16'000, 2, {}}; }
static std::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format) { static std::optional<Config> SdpToConfig(
const SdpAudioFormat& /* audio_format */) {
return Config(); return Config();
} }
@ -111,17 +111,17 @@ struct TraitWithTwoMakeAudioDecoders : BaseAudioDecoderApi {
static constexpr int kRateWithEnv = 20'000; static constexpr int kRateWithEnv = 20'000;
static std::unique_ptr<AudioDecoder> MakeAudioDecoder( static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
const Config& config, const Config& /* config */,
std::optional<AudioCodecPairId> codec_pair_id) { std::optional<AudioCodecPairId> /* codec_pair_id */) {
auto decoder = std::make_unique<NiceMock<MockAudioDecoder>>(); auto decoder = std::make_unique<NiceMock<MockAudioDecoder>>();
ON_CALL(*decoder, SampleRateHz).WillByDefault(Return(kRateWithoutEnv)); ON_CALL(*decoder, SampleRateHz).WillByDefault(Return(kRateWithoutEnv));
return decoder; return decoder;
} }
static std::unique_ptr<AudioDecoder> MakeAudioDecoder( static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
const Environment& env, const Environment& /* env */,
const Config& config, const Config& /* config */,
std::optional<AudioCodecPairId> codec_pair_id) { std::optional<AudioCodecPairId> /* codec_pair_id */) {
auto decoder = std::make_unique<NiceMock<MockAudioDecoder>>(); auto decoder = std::make_unique<NiceMock<MockAudioDecoder>>();
ON_CALL(*decoder, SampleRateHz).WillByDefault(Return(kRateWithEnv)); ON_CALL(*decoder, SampleRateHz).WillByDefault(Return(kRateWithEnv));
return decoder; return decoder;
@ -140,8 +140,8 @@ TEST(AudioDecoderFactoryTemplateTest,
struct AudioDecoderApiWithV1Make : BaseAudioDecoderApi { struct AudioDecoderApiWithV1Make : BaseAudioDecoderApi {
static std::unique_ptr<AudioDecoder> MakeAudioDecoder( static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
const Config& config, const Config& /* config */,
std::optional<AudioCodecPairId> codec_pair_id) { std::optional<AudioCodecPairId> /* codec_pair_id */) {
return std::make_unique<NiceMock<MockAudioDecoder>>(); return std::make_unique<NiceMock<MockAudioDecoder>>();
} }
}; };
@ -244,21 +244,6 @@ TEST(AudioDecoderFactoryTemplateTest, DISABLED_G722) {
ASSERT_EQ(nullptr, dec3); ASSERT_EQ(nullptr, dec3);
} }
// RingRTC change to disable unused audio codecs
TEST(AudioDecoderFactoryTemplateTest, DISABLED_Ilbc) {
const Environment env = CreateEnvironment();
auto factory = CreateAudioDecoderFactory<AudioDecoderIlbc>();
EXPECT_THAT(factory->GetSupportedDecoders(),
::testing::ElementsAre(
AudioCodecSpec{{"ILBC", 8000, 1}, {8000, 1, 13300}}));
EXPECT_FALSE(factory->IsSupportedDecoder({"foo", 8000, 1}));
EXPECT_TRUE(factory->IsSupportedDecoder({"ilbc", 8000, 1}));
EXPECT_EQ(nullptr, factory->Create(env, {"bar", 8000, 1}, std::nullopt));
auto dec = factory->Create(env, {"ilbc", 8000, 1}, std::nullopt);
ASSERT_NE(nullptr, dec);
EXPECT_EQ(8000, dec->SampleRateHz());
}
// RingRTC change to disable unused audio codecs // RingRTC change to disable unused audio codecs
TEST(AudioDecoderFactoryTemplateTest, DISABLED_L16) { TEST(AudioDecoderFactoryTemplateTest, DISABLED_L16) {
const Environment env = CreateEnvironment(); const Environment env = CreateEnvironment();

View file

@ -22,7 +22,6 @@
#include "api/audio_codecs/audio_format.h" #include "api/audio_codecs/audio_format.h"
#include "api/audio_codecs/g711/audio_encoder_g711.h" #include "api/audio_codecs/g711/audio_encoder_g711.h"
#include "api/audio_codecs/g722/audio_encoder_g722.h" #include "api/audio_codecs/g722/audio_encoder_g722.h"
#include "api/audio_codecs/ilbc/audio_encoder_ilbc.h"
#include "api/audio_codecs/opus/audio_encoder_opus.h" #include "api/audio_codecs/opus/audio_encoder_opus.h"
#include "api/environment/environment.h" #include "api/environment/environment.h"
#include "api/environment/environment_factory.h" #include "api/environment/environment_factory.h"
@ -78,7 +77,7 @@ struct AudioEncoderFakeApi {
static std::unique_ptr<AudioEncoder> MakeAudioEncoder( static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
const Config&, const Config&,
int payload_type, int /* payload_type */,
std::optional<AudioCodecPairId> /*codec_pair_id*/ = std::nullopt) { std::optional<AudioCodecPairId> /*codec_pair_id*/ = std::nullopt) {
auto enc = std::make_unique<testing::StrictMock<MockAudioEncoder>>(); auto enc = std::make_unique<testing::StrictMock<MockAudioEncoder>>();
EXPECT_CALL(*enc, SampleRateHz()) EXPECT_CALL(*enc, SampleRateHz())
@ -100,7 +99,8 @@ struct BaseAudioEncoderApi {
static SdpAudioFormat AudioFormat() { return {"fake", 16'000, 2, {}}; } static SdpAudioFormat AudioFormat() { return {"fake", 16'000, 2, {}}; }
static AudioCodecInfo CodecInfo() { return {16'000, 2, 23456}; } static AudioCodecInfo CodecInfo() { return {16'000, 2, 23456}; }
static std::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format) { static std::optional<Config> SdpToConfig(
const SdpAudioFormat& /* audio_format */) {
return Config(); return Config();
} }
@ -114,8 +114,8 @@ struct BaseAudioEncoderApi {
struct AudioEncoderApiWithV1Make : BaseAudioEncoderApi { struct AudioEncoderApiWithV1Make : BaseAudioEncoderApi {
static std::unique_ptr<AudioEncoder> MakeAudioEncoder( static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
const Config&, const Config&,
int payload_type, int /* payload_type */,
std::optional<AudioCodecPairId> codec_pair_id) { std::optional<AudioCodecPairId> /* codec_pair_id */) {
auto encoder = std::make_unique<NiceMock<MockAudioEncoder>>(); auto encoder = std::make_unique<NiceMock<MockAudioEncoder>>();
ON_CALL(*encoder, SampleRateHz).WillByDefault(Return(kV1SameRate)); ON_CALL(*encoder, SampleRateHz).WillByDefault(Return(kV1SameRate));
return encoder; return encoder;
@ -124,9 +124,9 @@ struct AudioEncoderApiWithV1Make : BaseAudioEncoderApi {
struct AudioEncoderApiWithV2Make : BaseAudioEncoderApi { struct AudioEncoderApiWithV2Make : BaseAudioEncoderApi {
static std::unique_ptr<AudioEncoder> MakeAudioEncoder( static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
const Environment& env, const Environment& /* env */,
const Config& config, const Config& /* config */,
const AudioEncoderFactory::Options& options) { const AudioEncoderFactory::Options& /* options */) {
auto encoder = std::make_unique<NiceMock<MockAudioEncoder>>(); auto encoder = std::make_unique<NiceMock<MockAudioEncoder>>();
ON_CALL(*encoder, SampleRateHz).WillByDefault(Return(kV2SameRate)); ON_CALL(*encoder, SampleRateHz).WillByDefault(Return(kV2SameRate));
return encoder; return encoder;
@ -136,17 +136,17 @@ struct AudioEncoderApiWithV2Make : BaseAudioEncoderApi {
struct AudioEncoderApiWithBothV1AndV2Make : BaseAudioEncoderApi { struct AudioEncoderApiWithBothV1AndV2Make : BaseAudioEncoderApi {
static std::unique_ptr<AudioEncoder> MakeAudioEncoder( static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
const Config&, const Config&,
int payload_type, int /* payload_type */,
std::optional<AudioCodecPairId> codec_pair_id) { std::optional<AudioCodecPairId> /* codec_pair_id */) {
auto encoder = std::make_unique<NiceMock<MockAudioEncoder>>(); auto encoder = std::make_unique<NiceMock<MockAudioEncoder>>();
ON_CALL(*encoder, SampleRateHz).WillByDefault(Return(kV1SameRate)); ON_CALL(*encoder, SampleRateHz).WillByDefault(Return(kV1SameRate));
return encoder; return encoder;
} }
static std::unique_ptr<AudioEncoder> MakeAudioEncoder( static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
const Environment& env, const Environment& /* env */,
const Config& config, const Config& /* config */,
const AudioEncoderFactory::Options& options) { const AudioEncoderFactory::Options& /* options */) {
auto encoder = std::make_unique<NiceMock<MockAudioEncoder>>(); auto encoder = std::make_unique<NiceMock<MockAudioEncoder>>();
ON_CALL(*encoder, SampleRateHz).WillByDefault(Return(kV2SameRate)); ON_CALL(*encoder, SampleRateHz).WillByDefault(Return(kV2SameRate));
return encoder; return encoder;
@ -268,22 +268,6 @@ TEST(AudioEncoderFactoryTemplateTest, DISABLED_G722) {
Pointer(Property(&AudioEncoder::SampleRateHz, 16000))); Pointer(Property(&AudioEncoder::SampleRateHz, 16000)));
} }
// RingRTC change to disable unused audio codecs
TEST(AudioEncoderFactoryTemplateTest, DISABLED_Ilbc) {
const Environment env = CreateEnvironment();
auto factory = CreateAudioEncoderFactory<AudioEncoderIlbc>();
EXPECT_THAT(factory->GetSupportedEncoders(),
::testing::ElementsAre(
AudioCodecSpec{{"ILBC", 8000, 1}, {8000, 1, 13333}}));
EXPECT_EQ(std::nullopt, factory->QueryAudioEncoder({"foo", 8000, 1}));
EXPECT_EQ(AudioCodecInfo(8000, 1, 13333),
factory->QueryAudioEncoder({"ilbc", 8000, 1}));
EXPECT_THAT(factory->Create(env, {"bar", 8000, 1}, {}), IsNull());
EXPECT_THAT(factory->Create(env, {"ilbc", 8000, 1}, {}),
Pointer(Property(&AudioEncoder::SampleRateHz, 8000)));
}
// RingRTC change to disable unused audio codecs // RingRTC change to disable unused audio codecs
TEST(AudioEncoderFactoryTemplateTest, DISABLED_L16) { TEST(AudioEncoderFactoryTemplateTest, DISABLED_L16) {
const Environment env = CreateEnvironment(); const Environment env = CreateEnvironment();

View file

@ -10,6 +10,7 @@
#include "api/audio_options.h" #include "api/audio_options.h"
#include <optional>
#include <string> #include <string>
#include "api/array_view.h" #include "api/array_view.h"

View file

@ -27,8 +27,8 @@ struct PacketOptions {
// Negative ids are invalid and should be interpreted // Negative ids are invalid and should be interpreted
// as packet_id not being set. // as packet_id not being set.
int64_t packet_id = -1; int64_t packet_id = -1;
// Whether this is a retransmission of an earlier packet. // Whether this is an audio or video packet, excluding retransmissions.
bool is_retransmit = false; bool is_media = true;
bool included_in_feedback = false; bool included_in_feedback = false;
bool included_in_allocation = false; bool included_in_allocation = false;
// Whether this packet can be part of a packet batch at lower levels. // Whether this packet can be part of a packet batch at lower levels.

View file

@ -16,6 +16,7 @@
#include "api/audio/audio_device.h" #include "api/audio/audio_device.h"
#include "api/audio/audio_mixer.h" #include "api/audio/audio_mixer.h"
#include "api/audio/audio_processing.h" #include "api/audio/audio_processing.h"
#include "api/audio/builtin_audio_processing_builder.h"
#include "api/audio_codecs/audio_decoder_factory.h" #include "api/audio_codecs/audio_decoder_factory.h"
#include "api/audio_codecs/audio_encoder_factory.h" #include "api/audio_codecs/audio_encoder_factory.h"
#include "api/enable_media.h" #include "api/enable_media.h"
@ -57,10 +58,14 @@ rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
dependencies.audio_encoder_factory = std::move(audio_encoder_factory); dependencies.audio_encoder_factory = std::move(audio_encoder_factory);
dependencies.audio_decoder_factory = std::move(audio_decoder_factory); dependencies.audio_decoder_factory = std::move(audio_decoder_factory);
dependencies.audio_frame_processor = std::move(audio_frame_processor); dependencies.audio_frame_processor = std::move(audio_frame_processor);
if (audio_processing) { if (audio_processing != nullptr) {
dependencies.audio_processing = std::move(audio_processing); dependencies.audio_processing_builder =
CustomAudioProcessing(std::move(audio_processing));
} else { } else {
dependencies.audio_processing = AudioProcessingBuilder().Create(); #ifndef WEBRTC_EXCLUDE_AUDIO_PROCESSING_MODULE
dependencies.audio_processing_builder =
std::make_unique<BuiltinAudioProcessingBuilder>();
#endif
} }
dependencies.audio_mixer = std::move(audio_mixer); dependencies.audio_mixer = std::move(audio_mixer);
dependencies.video_encoder_factory = std::move(video_encoder_factory); dependencies.video_encoder_factory = std::move(video_encoder_factory);

View file

@ -11,6 +11,7 @@
#include "api/data_channel_interface.h" #include "api/data_channel_interface.h"
#include <cstdint> #include <cstdint>
#include <optional>
#include <string> #include <string>
#include "absl/functional/any_invocable.h" #include "absl/functional/any_invocable.h"
@ -57,15 +58,15 @@ uint64_t DataChannelInterface::MaxSendQueueSize() {
} }
// TODO(tommi): Remove method once downstream implementations have been removed. // TODO(tommi): Remove method once downstream implementations have been removed.
bool DataChannelInterface::Send(const DataBuffer& buffer) { bool DataChannelInterface::Send(const DataBuffer& /* buffer */) {
RTC_DCHECK_NOTREACHED(); RTC_DCHECK_NOTREACHED();
return false; return false;
} }
// TODO(tommi): Remove implementation once method is pure virtual. // TODO(tommi): Remove implementation once method is pure virtual.
void DataChannelInterface::SendAsync( void DataChannelInterface::SendAsync(
DataBuffer buffer, DataBuffer /* buffer */,
absl::AnyInvocable<void(RTCError) &&> on_complete) { absl::AnyInvocable<void(RTCError) &&> /* on_complete */) {
RTC_DCHECK_NOTREACHED(); RTC_DCHECK_NOTREACHED();
} }

View file

@ -99,7 +99,7 @@ class DataChannelObserver {
// A data buffer was successfully received. // A data buffer was successfully received.
virtual void OnMessage(const DataBuffer& buffer) = 0; virtual void OnMessage(const DataBuffer& buffer) = 0;
// The data channel's buffered_amount has changed. // The data channel's buffered_amount has changed.
virtual void OnBufferedAmountChange(uint64_t sent_data_size) {} virtual void OnBufferedAmountChange(uint64_t /* sent_data_size */) {}
// Override this to get callbacks directly on the network thread. // Override this to get callbacks directly on the network thread.
// An implementation that does that must not block the network thread // An implementation that does that must not block the network thread

View file

@ -27,12 +27,12 @@ class DtmfSenderObserverInterface {
// tones. // tones.
// The callback includes the state of the tone buffer at the time when // The callback includes the state of the tone buffer at the time when
// the tone finished playing. // the tone finished playing.
virtual void OnToneChange(const std::string& tone, virtual void OnToneChange(const std::string& /* tone */,
const std::string& tone_buffer) {} const std::string& /* tone_buffer */) {}
// DEPRECATED: Older API without tone buffer. // DEPRECATED: Older API without tone buffer.
// TODO(bugs.webrtc.org/9725): Remove old API and default implementation // TODO(bugs.webrtc.org/9725): Remove old API and default implementation
// when old callers are gone. // when old callers are gone.
virtual void OnToneChange(const std::string& tone) {} virtual void OnToneChange(const std::string& /* tone */) {}
protected: protected:
virtual ~DtmfSenderObserverInterface() = default; virtual ~DtmfSenderObserverInterface() = default;
@ -91,7 +91,7 @@ class DtmfSenderInterface : public webrtc::RefCountInterface {
virtual bool InsertDtmf(const std::string& tones, virtual bool InsertDtmf(const std::string& tones,
int duration, int duration,
int inter_tone_gap, int inter_tone_gap,
int comma_delay) { int /* comma_delay */) {
// TODO(bugs.webrtc.org/165700): Remove once downstream implementations // TODO(bugs.webrtc.org/165700): Remove once downstream implementations
// override this signature rather than the 3-parameter one. // override this signature rather than the 3-parameter one.
return InsertDtmf(tones, duration, inter_tone_gap); return InsertDtmf(tones, duration, inter_tone_gap);

View file

@ -13,6 +13,7 @@
#include <memory> #include <memory>
#include <utility> #include <utility>
#include "absl/base/nullability.h"
#include "api/environment/environment.h" #include "api/environment/environment.h"
#include "api/peer_connection_interface.h" #include "api/peer_connection_interface.h"
#include "api/scoped_refptr.h" #include "api/scoped_refptr.h"
@ -45,11 +46,16 @@ class MediaFactoryImpl : public MediaFactory {
std::unique_ptr<MediaEngineInterface> CreateMediaEngine( std::unique_ptr<MediaEngineInterface> CreateMediaEngine(
const Environment& env, const Environment& env,
PeerConnectionFactoryDependencies& deps) override { PeerConnectionFactoryDependencies& deps) override {
absl::Nullable<scoped_refptr<AudioProcessing>> audio_processing =
deps.audio_processing_builder != nullptr
? std::move(deps.audio_processing_builder)->Build(env)
: std::move(deps.audio_processing);
auto audio_engine = std::make_unique<WebRtcVoiceEngine>( auto audio_engine = std::make_unique<WebRtcVoiceEngine>(
&env.task_queue_factory(), deps.adm.get(), &env.task_queue_factory(), deps.adm.get(),
std::move(deps.audio_encoder_factory), std::move(deps.audio_encoder_factory),
std::move(deps.audio_decoder_factory), std::move(deps.audio_mixer), std::move(deps.audio_decoder_factory), std::move(deps.audio_mixer),
std::move(deps.audio_processing), std::move(deps.audio_frame_processor), std::move(audio_processing), std::move(deps.audio_frame_processor),
env.field_trials()); env.field_trials());
auto video_engine = std::make_unique<WebRtcVideoEngine>( auto video_engine = std::make_unique<WebRtcVideoEngine>(
std::move(deps.video_encoder_factory), std::move(deps.video_encoder_factory),

View file

@ -12,7 +12,7 @@
#include <memory> #include <memory>
#include "api/audio/audio_processing.h" #include "api/audio/builtin_audio_processing_builder.h"
#include "api/audio_codecs/builtin_audio_decoder_factory.h" #include "api/audio_codecs/builtin_audio_decoder_factory.h"
#include "api/audio_codecs/builtin_audio_encoder_factory.h" #include "api/audio_codecs/builtin_audio_encoder_factory.h"
#include "api/enable_media.h" #include "api/enable_media.h"
@ -34,10 +34,11 @@ void EnableMediaWithDefaults(PeerConnectionFactoryDependencies& deps) {
if (deps.audio_decoder_factory == nullptr) { if (deps.audio_decoder_factory == nullptr) {
deps.audio_decoder_factory = CreateBuiltinAudioDecoderFactory(); deps.audio_decoder_factory = CreateBuiltinAudioDecoderFactory();
} }
if (deps.audio_processing == nullptr) { if (deps.audio_processing == nullptr &&
deps.audio_processing = AudioProcessingBuilder().Create(); deps.audio_processing_builder == nullptr) {
deps.audio_processing_builder =
std::make_unique<BuiltinAudioProcessingBuilder>();
} }
if (deps.video_encoder_factory == nullptr) { if (deps.video_encoder_factory == nullptr) {
deps.video_encoder_factory = CreateBuiltinVideoEncoderFactory(); deps.video_encoder_factory = CreateBuiltinVideoEncoderFactory();
} }

View file

@ -124,7 +124,7 @@ inline void EnvironmentFactory::Set(absl::Nullable<RtcEventLog*> utility) {
namespace webrtc_create_environment_internal { namespace webrtc_create_environment_internal {
inline void Set(EnvironmentFactory& factory) {} inline void Set(EnvironmentFactory& /* factory */) {}
template <typename FirstUtility, typename... Utilities> template <typename FirstUtility, typename... Utilities>
void Set(EnvironmentFactory& factory, void Set(EnvironmentFactory& factory,

View file

@ -54,7 +54,9 @@ class FakeFieldTrials : public FieldTrialsView {
} }
} }
std::string Lookup(absl::string_view key) const override { return "fake"; } std::string Lookup(absl::string_view /* key */) const override {
return "fake";
}
private: private:
absl::AnyInvocable<void() &&> on_destroyed_; absl::AnyInvocable<void() &&> on_destroyed_;
@ -72,8 +74,8 @@ class FakeTaskQueueFactory : public TaskQueueFactory {
} }
std::unique_ptr<TaskQueueBase, TaskQueueDeleter> CreateTaskQueue( std::unique_ptr<TaskQueueBase, TaskQueueDeleter> CreateTaskQueue(
absl::string_view name, absl::string_view /* name */,
Priority priority) const override { Priority /* priority */) const override {
return nullptr; return nullptr;
} }

View file

@ -54,9 +54,15 @@ class TransformableFrameInterface {
virtual uint32_t GetTimestamp() const = 0; virtual uint32_t GetTimestamp() const = 0;
virtual void SetRTPTimestamp(uint32_t timestamp) = 0; virtual void SetRTPTimestamp(uint32_t timestamp) = 0;
// TODO(https://bugs.webrtc.org/373365537): Remove this once its usage is
// removed from blink.
virtual std::optional<Timestamp> GetCaptureTimeIdentifier() const {
return std::nullopt;
}
// TODO(https://bugs.webrtc.org/14878): Change this to pure virtual after it // TODO(https://bugs.webrtc.org/14878): Change this to pure virtual after it
// is implemented everywhere. // is implemented everywhere.
virtual std::optional<Timestamp> GetCaptureTimeIdentifier() const { virtual std::optional<Timestamp> GetPresentationTimestamp() const {
return std::nullopt; return std::nullopt;
} }
@ -139,9 +145,9 @@ class FrameTransformerInterface : public RefCountInterface {
rtc::scoped_refptr<TransformedFrameCallback>) {} rtc::scoped_refptr<TransformedFrameCallback>) {}
virtual void RegisterTransformedFrameSinkCallback( virtual void RegisterTransformedFrameSinkCallback(
rtc::scoped_refptr<TransformedFrameCallback>, rtc::scoped_refptr<TransformedFrameCallback>,
uint32_t ssrc) {} uint32_t /* ssrc */) {}
virtual void UnregisterTransformedFrameCallback() {} virtual void UnregisterTransformedFrameCallback() {}
virtual void UnregisterTransformedFrameSinkCallback(uint32_t ssrc) {} virtual void UnregisterTransformedFrameSinkCallback(uint32_t /* ssrc */) {}
protected: protected:
~FrameTransformerInterface() override = default; ~FrameTransformerInterface() override = default;

View file

@ -86,7 +86,7 @@ class FunctionView<RetT(ArgT...)> final {
typename std::enable_if<std::is_same< typename std::enable_if<std::is_same<
std::nullptr_t, std::nullptr_t,
typename std::remove_cv<F>::type>::value>::type* = nullptr> typename std::remove_cv<F>::type>::value>::type* = nullptr>
FunctionView(F&& f) : call_(nullptr) {} FunctionView(F&& /* f */) : call_(nullptr) {}
// Default constructor. Creates an empty FunctionView. // Default constructor. Creates an empty FunctionView.
FunctionView() : call_(nullptr) {} FunctionView() : call_(nullptr) {}

View file

@ -11,6 +11,7 @@
#include "api/jsep.h" #include "api/jsep.h"
#include <cstddef> #include <cstddef>
#include <optional>
#include <string> #include <string>
#include <vector> #include <vector>
@ -21,7 +22,7 @@ std::string IceCandidateInterface::server_url() const {
} }
size_t SessionDescriptionInterface::RemoveCandidates( size_t SessionDescriptionInterface::RemoveCandidates(
const std::vector<cricket::Candidate>& candidates) { const std::vector<cricket::Candidate>& /* candidates */) {
return 0; return 0;
} }

View file

@ -187,6 +187,19 @@ class RTC_EXPORT SessionDescriptionInterface {
// Serializes the description to SDP. // Serializes the description to SDP.
virtual bool ToString(std::string* out) const = 0; virtual bool ToString(std::string* out) const = 0;
template <typename Sink>
friend void AbslStringify(Sink& sink, const SessionDescriptionInterface& p) {
sink.Append("\n--- BEGIN SDP ");
sink.Append(SdpTypeToString(p.GetType()));
sink.Append(" ---\n");
std::string temp;
if (p.ToString(&temp)) {
sink.Append(temp);
} else {
sink.Append("Error in ToString\n");
}
sink.Append("--- END SDP ---\n");
}
}; };
// Creates a SessionDescriptionInterface based on the SDP string and the type. // Creates a SessionDescriptionInterface based on the SDP string and the type.

67
api/jsep_unittest.cc Normal file
View file

@ -0,0 +1,67 @@
/*
* 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.
*/
#include "api/jsep.h"
#include <memory>
#include <string>
#include "absl/strings/str_cat.h"
#include "rtc_base/logging.h"
#include "test/gmock.h"
#include "test/gtest.h"
namespace webrtc {
using ::testing::HasSubstr;
TEST(JsepTest, AbslStringifySdp) {
std::string sdp =
"v=0\r\n"
"o=- 0 3 IN IP4 127.0.0.1\r\n"
"s=-\r\n"
"t=0 0\r\n"
"a=group:BUNDLE 0 1\r\n"
"a=fingerprint:sha-1 "
"4A:AD:B9:B1:3F:82:18:3B:54:02:12:DF:3E:5D:49:6B:19:E5:7C:AB\r\n"
"a=setup:actpass\r\n"
"a=ice-ufrag:ETEn\r\n"
"a=ice-pwd:OtSK0WpNtpUjkY4+86js7Z/l\r\n"
"m=audio 9 UDP/TLS/RTP/SAVPF 111\r\n"
"c=IN IP4 0.0.0.0\r\n"
"a=rtcp-mux\r\n"
"a=sendonly\r\n"
"a=mid:0\r\n"
"a=rtpmap:111 opus/48000/2\r\n"
"m=video 9 UDP/TLS/RTP/SAVPF 111\r\n"
"c=IN IP4 0.0.0.0\r\n"
"a=rtcp-mux\r\n"
"a=sendonly\r\n"
"a=mid:1\r\n"
"a=rtpmap:111 H264/90000\r\n"
"a=fmtp:111 "
"level-asymmetry-allowed=1;packetization-mode=0;profile-level-id="
"42e01f\r\n";
std::unique_ptr<SessionDescriptionInterface> some_sdp =
CreateSessionDescription(SdpType::kOffer, sdp);
// Verify that sending the SDP to the log compiles.
RTC_LOG(LS_VERBOSE) << "The SDP is " << *some_sdp;
// Since create/stringify mangles order of fields, we only test
// some substrings.
EXPECT_THAT(absl::StrCat(*some_sdp), HasSubstr("a=rtpmap:111 opus/48000"));
EXPECT_THAT(
absl::StrCat(*some_sdp),
HasSubstr(
"a=fingerprint:sha-1 "
"4A:AD:B9:B1:3F:82:18:3B:54:02:12:DF:3E:5D:49:6B:19:E5:7C:AB\r\n"));
}
} // namespace webrtc

View file

@ -13,6 +13,7 @@
#include <type_traits> #include <type_traits>
#include <utility> #include <utility>
#include "absl/base/nullability.h"
#include "api/ref_count.h" #include "api/ref_count.h"
#include "api/scoped_refptr.h" #include "api/scoped_refptr.h"
#include "rtc_base/ref_counted_object.h" #include "rtc_base/ref_counted_object.h"
@ -85,7 +86,7 @@ template <
typename std::enable_if<std::is_convertible_v<T*, RefCountInterface*> && typename std::enable_if<std::is_convertible_v<T*, RefCountInterface*> &&
std::is_abstract_v<T>, std::is_abstract_v<T>,
T>::type* = nullptr> T>::type* = nullptr>
scoped_refptr<T> make_ref_counted(Args&&... args) { absl::Nonnull<scoped_refptr<T>> make_ref_counted(Args&&... args) {
return scoped_refptr<T>(new RefCountedObject<T>(std::forward<Args>(args)...)); return scoped_refptr<T>(new RefCountedObject<T>(std::forward<Args>(args)...));
} }
@ -98,7 +99,7 @@ template <
!std::is_convertible_v<T*, RefCountInterface*> && !std::is_convertible_v<T*, RefCountInterface*> &&
webrtc_make_ref_counted_internal::HasAddRefAndRelease<T>::value, webrtc_make_ref_counted_internal::HasAddRefAndRelease<T>::value,
T>::type* = nullptr> T>::type* = nullptr>
scoped_refptr<T> make_ref_counted(Args&&... args) { absl::Nonnull<scoped_refptr<T>> make_ref_counted(Args&&... args) {
return scoped_refptr<T>(new T(std::forward<Args>(args)...)); return scoped_refptr<T>(new T(std::forward<Args>(args)...));
} }
@ -112,61 +113,18 @@ template <
!webrtc_make_ref_counted_internal::HasAddRefAndRelease<T>::value, !webrtc_make_ref_counted_internal::HasAddRefAndRelease<T>::value,
T>::type* = nullptr> T>::type* = nullptr>
scoped_refptr<FinalRefCountedObject<T>> make_ref_counted(Args&&... args) { absl::Nonnull<scoped_refptr<FinalRefCountedObject<T>>> make_ref_counted(
Args&&... args) {
return scoped_refptr<FinalRefCountedObject<T>>( return scoped_refptr<FinalRefCountedObject<T>>(
new FinalRefCountedObject<T>(std::forward<Args>(args)...)); new FinalRefCountedObject<T>(std::forward<Args>(args)...));
} }
} // namespace webrtc } // namespace webrtc
// Backwards compatibe aliases.
// TODO: https://issues.webrtc.org/42225969 - deprecate and remove.
namespace rtc { namespace rtc {
// This doesn't work: // Backwards compatibe alias.
// template <typename T, typename... Args> // TODO: bugs.webrtc.org/42225969 - deprecate and remove.
// using make_ref_counted(Args&&... args) = using ::webrtc::make_ref_counted;
// webrtc::make_ref_counted<T>(Args&&... args);
// Instead, reproduce the templates.
template <typename T,
typename... Args,
typename std::enable_if<
std::is_convertible_v<T*, webrtc::RefCountInterface*> &&
std::is_abstract_v<T>,
T>::type* = nullptr>
scoped_refptr<T> make_ref_counted(Args&&... args) {
return webrtc::scoped_refptr<T>(
new webrtc::RefCountedObject<T>(std::forward<Args>(args)...));
}
// `make_ref_counted` for complete classes that are not convertible to
// RefCountInterface and already carry a ref count.
template <typename T,
typename... Args,
typename std::enable_if<
!std::is_convertible_v<T*, webrtc::RefCountInterface*> &&
webrtc::webrtc_make_ref_counted_internal::HasAddRefAndRelease<
T>::value,
T>::type* = nullptr>
scoped_refptr<T> make_ref_counted(Args&&... args) {
return webrtc::scoped_refptr<T>(new T(std::forward<Args>(args)...));
}
// `make_ref_counted` for complete classes that are not convertible to
// RefCountInterface and have no ref count of their own.
template <typename T,
typename... Args,
typename std::enable_if<
!std::is_convertible_v<T*, webrtc::RefCountInterface*> &&
!webrtc::webrtc_make_ref_counted_internal::
HasAddRefAndRelease<T>::value,
T>::type* = nullptr>
scoped_refptr<webrtc::FinalRefCountedObject<T>> make_ref_counted(
Args&&... args) {
return webrtc::scoped_refptr<FinalRefCountedObject<T>>(
new webrtc::FinalRefCountedObject<T>(std::forward<Args>(args)...));
}
} // namespace rtc } // namespace rtc
#endif // API_MAKE_REF_COUNTED_H_ #endif // API_MAKE_REF_COUNTED_H_

View file

@ -25,7 +25,7 @@ VideoTrackInterface::ContentHint VideoTrackInterface::content_hint() const {
return ContentHint::kNone; return ContentHint::kNone;
} }
bool AudioTrackInterface::GetSignalLevel(int* level) { bool AudioTrackInterface::GetSignalLevel(int* /* level */) {
return false; return false;
} }

View file

@ -161,7 +161,7 @@ class VideoTrackSourceInterface : public MediaSourceInterface,
// The call is expected to happen on the network thread. // The call is expected to happen on the network thread.
// TODO(crbug/1255737): make pure virtual once downstream project adapts. // TODO(crbug/1255737): make pure virtual once downstream project adapts.
virtual void ProcessConstraints( virtual void ProcessConstraints(
const webrtc::VideoTrackSourceConstraints& constraints) {} const webrtc::VideoTrackSourceConstraints& /* constraints */) {}
protected: protected:
~VideoTrackSourceInterface() override = default; ~VideoTrackSourceInterface() override = default;
@ -184,14 +184,14 @@ class RTC_EXPORT VideoTrackInterface
// Register a video sink for this track. Used to connect the track to the // Register a video sink for this track. Used to connect the track to the
// underlying video engine. // underlying video engine.
void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink, void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* /* sink */,
const rtc::VideoSinkWants& wants) override {} const rtc::VideoSinkWants& /* wants */) override {}
void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override {} void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* /* sink */) override {}
virtual VideoTrackSourceInterface* GetSource() const = 0; virtual VideoTrackSourceInterface* GetSource() const = 0;
virtual ContentHint content_hint() const; virtual ContentHint content_hint() const;
virtual void set_content_hint(ContentHint hint) {} virtual void set_content_hint(ContentHint /* hint */) {}
protected: protected:
~VideoTrackInterface() override = default; ~VideoTrackInterface() override = default;
@ -200,11 +200,11 @@ class RTC_EXPORT VideoTrackInterface
// Interface for receiving audio data from a AudioTrack. // Interface for receiving audio data from a AudioTrack.
class AudioTrackSinkInterface { class AudioTrackSinkInterface {
public: public:
virtual void OnData(const void* audio_data, virtual void OnData(const void* /* audio_data */,
int bits_per_sample, int /* bits_per_sample */,
int sample_rate, int /* sample_rate */,
size_t number_of_channels, size_t /* number_of_channels */,
size_t number_of_frames) { size_t /* number_of_frames */) {
RTC_DCHECK_NOTREACHED() << "This method must be overridden, or not used."; RTC_DCHECK_NOTREACHED() << "This method must be overridden, or not used.";
} }
@ -212,12 +212,13 @@ class AudioTrackSinkInterface {
// supposed to deliver the timestamp when this audio frame was originally // supposed to deliver the timestamp when this audio frame was originally
// captured. This timestamp MUST be based on the same clock as // captured. This timestamp MUST be based on the same clock as
// rtc::TimeMillis(). // rtc::TimeMillis().
virtual void OnData(const void* audio_data, virtual void OnData(
int bits_per_sample, const void* audio_data,
int sample_rate, int bits_per_sample,
size_t number_of_channels, int sample_rate,
size_t number_of_frames, size_t number_of_channels,
std::optional<int64_t> absolute_capture_timestamp_ms) { size_t number_of_frames,
std::optional<int64_t> /* absolute_capture_timestamp_ms */) {
// TODO(bugs.webrtc.org/10739): Deprecate the old OnData and make this one // TODO(bugs.webrtc.org/10739): Deprecate the old OnData and make this one
// pure virtual. // pure virtual.
return OnData(audio_data, bits_per_sample, sample_rate, number_of_channels, return OnData(audio_data, bits_per_sample, sample_rate, number_of_channels,
@ -251,15 +252,15 @@ class RTC_EXPORT AudioSourceInterface : public MediaSourceInterface {
// Sets the volume of the source. `volume` is in the range of [0, 10]. // Sets the volume of the source. `volume` is in the range of [0, 10].
// TODO(tommi): This method should be on the track and ideally volume should // TODO(tommi): This method should be on the track and ideally volume should
// be applied in the track in a way that does not affect clones of the track. // be applied in the track in a way that does not affect clones of the track.
virtual void SetVolume(double volume) {} virtual void SetVolume(double /* volume */) {}
// Registers/unregisters observers to the audio source. // Registers/unregisters observers to the audio source.
virtual void RegisterAudioObserver(AudioObserver* observer) {} virtual void RegisterAudioObserver(AudioObserver* /* observer */) {}
virtual void UnregisterAudioObserver(AudioObserver* observer) {} virtual void UnregisterAudioObserver(AudioObserver* /* observer */) {}
// TODO(tommi): Make pure virtual. // TODO(tommi): Make pure virtual.
virtual void AddSink(AudioTrackSinkInterface* sink) {} virtual void AddSink(AudioTrackSinkInterface* /* sink */) {}
virtual void RemoveSink(AudioTrackSinkInterface* sink) {} virtual void RemoveSink(AudioTrackSinkInterface* /* sink */) {}
// Returns options for the AudioSource. // Returns options for the AudioSource.
// (for some of the settings this approach is broken, e.g. setting // (for some of the settings this approach is broken, e.g. setting
@ -339,35 +340,20 @@ class MediaStreamInterface : public webrtc::RefCountInterface,
// Note: Default implementations are for avoiding link time errors in // Note: Default implementations are for avoiding link time errors in
// implementations that mock this API. // implementations that mock this API.
// TODO(bugs.webrtc.org/13980): Remove default implementations. // TODO(bugs.webrtc.org/13980): Remove default implementations.
virtual bool AddTrack(rtc::scoped_refptr<AudioTrackInterface> track) { virtual bool AddTrack(rtc::scoped_refptr<AudioTrackInterface> /* track */) {
RTC_CHECK_NOTREACHED(); RTC_CHECK_NOTREACHED();
} }
virtual bool AddTrack(rtc::scoped_refptr<VideoTrackInterface> track) { virtual bool AddTrack(rtc::scoped_refptr<VideoTrackInterface> /* track */) {
RTC_CHECK_NOTREACHED(); RTC_CHECK_NOTREACHED();
} }
virtual bool RemoveTrack(rtc::scoped_refptr<AudioTrackInterface> track) { virtual bool RemoveTrack(
rtc::scoped_refptr<AudioTrackInterface> /* track */) {
RTC_CHECK_NOTREACHED(); RTC_CHECK_NOTREACHED();
} }
virtual bool RemoveTrack(rtc::scoped_refptr<VideoTrackInterface> track) { virtual bool RemoveTrack(
rtc::scoped_refptr<VideoTrackInterface> /* track */) {
RTC_CHECK_NOTREACHED(); RTC_CHECK_NOTREACHED();
} }
// Deprecated: Should use scoped_refptr versions rather than pointers.
[[deprecated("Pass a scoped_refptr")]] virtual bool AddTrack(
AudioTrackInterface* track) {
return AddTrack(rtc::scoped_refptr<AudioTrackInterface>(track));
}
[[deprecated("Pass a scoped_refptr")]] virtual bool AddTrack(
VideoTrackInterface* track) {
return AddTrack(rtc::scoped_refptr<VideoTrackInterface>(track));
}
[[deprecated("Pass a scoped_refptr")]] virtual bool RemoveTrack(
AudioTrackInterface* track) {
return RemoveTrack(rtc::scoped_refptr<AudioTrackInterface>(track));
}
[[deprecated("Pass a scoped_refptr")]] virtual bool RemoveTrack(
VideoTrackInterface* track) {
return RemoveTrack(rtc::scoped_refptr<VideoTrackInterface>(track));
}
protected: protected:
~MediaStreamInterface() override = default; ~MediaStreamInterface() override = default;

View file

@ -36,7 +36,8 @@ class RTC_EXPORT Metronome {
// executed on the same sequence as they were requested on. There are no // executed on the same sequence as they were requested on. There are no
// features for cancellation. When that's needed, use e.g. ScopedTaskSafety // features for cancellation. When that's needed, use e.g. ScopedTaskSafety
// from the client. // from the client.
virtual void RequestCallOnNextTick(absl::AnyInvocable<void() &&> callback) {} virtual void RequestCallOnNextTick(
absl::AnyInvocable<void() &&> /* callback */) {}
// Returns the current tick period of the metronome. // Returns the current tick period of the metronome.
virtual TimeDelta TickPeriod() const = 0; virtual TimeDelta TickPeriod() const = 0;

View file

@ -28,6 +28,22 @@ rtc_source_set("neteq_api") {
] ]
} }
rtc_source_set("default_neteq_factory") {
visibility = [ "*" ]
sources = [
"default_neteq_factory.cc",
"default_neteq_factory.h",
]
deps = [
":default_neteq_controller_factory",
":neteq_api",
"..:scoped_refptr",
"../../modules/audio_coding:neteq",
"../audio_codecs:audio_codecs_api",
"../environment",
]
}
rtc_source_set("custom_neteq_factory") { rtc_source_set("custom_neteq_factory") {
visibility = [ "*" ] visibility = [ "*" ]
sources = [ sources = [

View file

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#include "modules/audio_coding/neteq/default_neteq_factory.h" #include "api/neteq/default_neteq_factory.h"
#include <utility> #include <utility>

View file

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#ifndef MODULES_AUDIO_CODING_NETEQ_DEFAULT_NETEQ_FACTORY_H_ #ifndef API_NETEQ_DEFAULT_NETEQ_FACTORY_H_
#define MODULES_AUDIO_CODING_NETEQ_DEFAULT_NETEQ_FACTORY_H_ #define API_NETEQ_DEFAULT_NETEQ_FACTORY_H_
#include <memory> #include <memory>
@ -38,4 +38,4 @@ class DefaultNetEqFactory : public NetEqFactory {
}; };
} // namespace webrtc } // namespace webrtc
#endif // MODULES_AUDIO_CODING_NETEQ_DEFAULT_NETEQ_FACTORY_H_ #endif // API_NETEQ_DEFAULT_NETEQ_FACTORY_H_

View file

@ -194,7 +194,7 @@ class NetEq {
// Returns 0 on success, -1 on failure. // Returns 0 on success, -1 on failure.
virtual int InsertPacket(const RTPHeader& rtp_header, virtual int InsertPacket(const RTPHeader& rtp_header,
rtc::ArrayView<const uint8_t> payload, rtc::ArrayView<const uint8_t> payload,
Timestamp receive_time) { Timestamp /* receive_time */) {
// TODO: webrtc:343501093 - Make this method pure virtual. // TODO: webrtc:343501093 - Make this method pure virtual.
return InsertPacket(rtp_header, payload); return InsertPacket(rtp_header, payload);
} }
@ -300,7 +300,7 @@ class NetEq {
// such payload type was registered. // such payload type was registered.
[[deprecated( [[deprecated(
"Use GetCurrentDecoderFormat")]] virtual std::optional<DecoderFormat> "Use GetCurrentDecoderFormat")]] virtual std::optional<DecoderFormat>
GetDecoderFormat(int payload_type) const { GetDecoderFormat(int /* payload_type */) const {
return std::nullopt; return std::nullopt;
} }

View file

@ -147,18 +147,18 @@ PeerConnectionFactoryInterface::CreatePeerConnection(
RTCErrorOr<rtc::scoped_refptr<PeerConnectionInterface>> RTCErrorOr<rtc::scoped_refptr<PeerConnectionInterface>>
PeerConnectionFactoryInterface::CreatePeerConnectionOrError( PeerConnectionFactoryInterface::CreatePeerConnectionOrError(
const PeerConnectionInterface::RTCConfiguration& configuration, const PeerConnectionInterface::RTCConfiguration& /* configuration */,
PeerConnectionDependencies dependencies) { PeerConnectionDependencies /* dependencies */) {
return RTCError(RTCErrorType::INTERNAL_ERROR); return RTCError(RTCErrorType::INTERNAL_ERROR);
} }
RtpCapabilities PeerConnectionFactoryInterface::GetRtpSenderCapabilities( RtpCapabilities PeerConnectionFactoryInterface::GetRtpSenderCapabilities(
cricket::MediaType kind) const { cricket::MediaType /* kind */) const {
return {}; return {};
} }
RtpCapabilities PeerConnectionFactoryInterface::GetRtpReceiverCapabilities( RtpCapabilities PeerConnectionFactoryInterface::GetRtpReceiverCapabilities(
cricket::MediaType kind) const { cricket::MediaType /* kind */) const {
return {}; return {};
} }

View file

@ -360,6 +360,13 @@ class RTC_EXPORT PeerConnectionInterface : public webrtc::RefCountInterface {
bool dscp() const { return media_config.enable_dscp; } bool dscp() const { return media_config.enable_dscp; }
void set_dscp(bool enable) { media_config.enable_dscp = enable; } void set_dscp(bool enable) { media_config.enable_dscp = enable; }
bool stats_timestamp_with_environment_clock() const {
return media_config.stats_timestamp_with_environment_clock;
}
void set_stats_timestamp_with_environment_clock(bool enable) {
media_config.stats_timestamp_with_environment_clock = enable;
}
bool cpu_adaptation() const { bool cpu_adaptation() const {
return media_config.video.enable_cpu_adaptation; return media_config.video.enable_cpu_adaptation;
} }
@ -842,7 +849,7 @@ class RTC_EXPORT PeerConnectionInterface : public webrtc::RefCountInterface {
// TODO(bugs.webrtc.org/9534): Rename to RemoveTrack once the other signature // TODO(bugs.webrtc.org/9534): Rename to RemoveTrack once the other signature
// is removed; remove default implementation once upstream is updated. // is removed; remove default implementation once upstream is updated.
virtual RTCError RemoveTrackOrError( virtual RTCError RemoveTrackOrError(
rtc::scoped_refptr<RtpSenderInterface> sender) { rtc::scoped_refptr<RtpSenderInterface> /* sender */) {
RTC_CHECK_NOTREACHED(); RTC_CHECK_NOTREACHED();
return RTCError(); return RTCError();
} }
@ -983,8 +990,8 @@ class RTC_EXPORT PeerConnectionInterface : public webrtc::RefCountInterface {
// in SDP, so it should be done before CreateOffer is called, if the // in SDP, so it should be done before CreateOffer is called, if the
// application plans to use data channels. // application plans to use data channels.
virtual RTCErrorOr<rtc::scoped_refptr<DataChannelInterface>> virtual RTCErrorOr<rtc::scoped_refptr<DataChannelInterface>>
CreateDataChannelOrError(const std::string& label, CreateDataChannelOrError(const std::string& /* label */,
const DataChannelInit* config) { const DataChannelInit* /* config */) {
return RTCError(RTCErrorType::INTERNAL_ERROR, "dummy function called"); return RTCError(RTCErrorType::INTERNAL_ERROR, "dummy function called");
} }
// TODO(crbug.com/788659): Remove "virtual" below and default implementation // TODO(crbug.com/788659): Remove "virtual" below and default implementation
@ -1053,15 +1060,17 @@ class RTC_EXPORT PeerConnectionInterface : public webrtc::RefCountInterface {
// The observer is invoked as soon as the operation completes, which could be // The observer is invoked as soon as the operation completes, which could be
// before or after the SetLocalDescription() method has exited. // before or after the SetLocalDescription() method has exited.
virtual void SetLocalDescription( virtual void SetLocalDescription(
std::unique_ptr<SessionDescriptionInterface> desc, std::unique_ptr<SessionDescriptionInterface> /* desc */,
rtc::scoped_refptr<SetLocalDescriptionObserverInterface> observer) {} rtc::scoped_refptr<SetLocalDescriptionObserverInterface> /* observer */) {
}
// Creates an offer or answer (depending on current signaling state) and sets // Creates an offer or answer (depending on current signaling state) and sets
// it as the local session description. // it as the local session description.
// //
// The observer is invoked as soon as the operation completes, which could be // The observer is invoked as soon as the operation completes, which could be
// before or after the SetLocalDescription() method has exited. // before or after the SetLocalDescription() method has exited.
virtual void SetLocalDescription( virtual void SetLocalDescription(
rtc::scoped_refptr<SetLocalDescriptionObserverInterface> observer) {} rtc::scoped_refptr<SetLocalDescriptionObserverInterface> /* observer */) {
}
// Like SetLocalDescription() above, but the observer is invoked with a delay // Like SetLocalDescription() above, but the observer is invoked with a delay
// after the operation completes. This helps avoid recursive calls by the // after the operation completes. This helps avoid recursive calls by the
// observer but also makes it possible for states to change in-between the // observer but also makes it possible for states to change in-between the
@ -1071,7 +1080,8 @@ class RTC_EXPORT PeerConnectionInterface : public webrtc::RefCountInterface {
// ones taking SetLocalDescriptionObserverInterface as argument. // ones taking SetLocalDescriptionObserverInterface as argument.
virtual void SetLocalDescription(SetSessionDescriptionObserver* observer, virtual void SetLocalDescription(SetSessionDescriptionObserver* observer,
SessionDescriptionInterface* desc) = 0; SessionDescriptionInterface* desc) = 0;
virtual void SetLocalDescription(SetSessionDescriptionObserver* observer) {} virtual void SetLocalDescription(
SetSessionDescriptionObserver* /* observer */) {}
// Sets the remote session description. // Sets the remote session description.
// //
@ -1090,8 +1100,9 @@ class RTC_EXPORT PeerConnectionInterface : public webrtc::RefCountInterface {
// for synchronizing peer connection states to the application. // for synchronizing peer connection states to the application.
// TODO(https://crbug.com/webrtc/11798): Delete this method in favor of the // TODO(https://crbug.com/webrtc/11798): Delete this method in favor of the
// ones taking SetRemoteDescriptionObserverInterface as argument. // ones taking SetRemoteDescriptionObserverInterface as argument.
virtual void SetRemoteDescription(SetSessionDescriptionObserver* observer, virtual void SetRemoteDescription(
SessionDescriptionInterface* desc) {} SetSessionDescriptionObserver* /* observer */,
SessionDescriptionInterface* /* desc */) {}
// According to spec, we must only fire "negotiationneeded" if the Operations // According to spec, we must only fire "negotiationneeded" if the Operations
// Chain is empty. This method takes care of validating an event previously // Chain is empty. This method takes care of validating an event previously
@ -1136,8 +1147,9 @@ class RTC_EXPORT PeerConnectionInterface : public webrtc::RefCountInterface {
virtual bool AddIceCandidate(const IceCandidateInterface* candidate) = 0; virtual bool AddIceCandidate(const IceCandidateInterface* candidate) = 0;
// TODO(hbos): Remove default implementation once implemented by downstream // TODO(hbos): Remove default implementation once implemented by downstream
// projects. // projects.
virtual void AddIceCandidate(std::unique_ptr<IceCandidateInterface> candidate, virtual void AddIceCandidate(
std::function<void(RTCError)> callback) {} std::unique_ptr<IceCandidateInterface> /* candidate */,
std::function<void(RTCError)> /* callback */) {}
// Removes a group of remote candidates from the ICE agent. Needed mainly for // Removes a group of remote candidates from the ICE agent. Needed mainly for
// continual gathering, to avoid an ever-growing list of candidates as // continual gathering, to avoid an ever-growing list of candidates as
@ -1310,11 +1322,12 @@ class PeerConnectionObserver : public RtpPacketSinkInterface {
PeerConnectionInterface::SignalingState new_state) = 0; PeerConnectionInterface::SignalingState new_state) = 0;
// Triggered when media is received on a new stream from remote peer. // Triggered when media is received on a new stream from remote peer.
virtual void OnAddStream(rtc::scoped_refptr<MediaStreamInterface> stream) {} virtual void OnAddStream(
rtc::scoped_refptr<MediaStreamInterface> /* stream */) {}
// Triggered when a remote peer closes a stream. // Triggered when a remote peer closes a stream.
virtual void OnRemoveStream(rtc::scoped_refptr<MediaStreamInterface> stream) { virtual void OnRemoveStream(
} rtc::scoped_refptr<MediaStreamInterface> /* stream */) {}
// Triggered when a remote peer opens a data channel. // Triggered when a remote peer opens a data channel.
virtual void OnDataChannel( virtual void OnDataChannel(
@ -1332,7 +1345,7 @@ class PeerConnectionObserver : public RtpPacketSinkInterface {
// PeerConnection::ShouldFireNegotiationNeededEvent() returns true since it is // PeerConnection::ShouldFireNegotiationNeededEvent() returns true since it is
// possible for the event to become invalidated by operations subsequently // possible for the event to become invalidated by operations subsequently
// chained. // chained.
virtual void OnNegotiationNeededEvent(uint32_t event_id) {} virtual void OnNegotiationNeededEvent(uint32_t /* event_id */) {}
// Called any time the legacy IceConnectionState changes. // Called any time the legacy IceConnectionState changes.
// //
@ -1343,15 +1356,15 @@ class PeerConnectionObserver : public RtpPacketSinkInterface {
// //
// TODO(jonasolsson): deprecate and remove this. // TODO(jonasolsson): deprecate and remove this.
virtual void OnIceConnectionChange( virtual void OnIceConnectionChange(
PeerConnectionInterface::IceConnectionState new_state) {} PeerConnectionInterface::IceConnectionState /* new_state */) {}
// Called any time the standards-compliant IceConnectionState changes. // Called any time the standards-compliant IceConnectionState changes.
virtual void OnStandardizedIceConnectionChange( virtual void OnStandardizedIceConnectionChange(
PeerConnectionInterface::IceConnectionState new_state) {} PeerConnectionInterface::IceConnectionState /* new_state */) {}
// Called any time the PeerConnectionState changes. // Called any time the PeerConnectionState changes.
virtual void OnConnectionChange( virtual void OnConnectionChange(
PeerConnectionInterface::PeerConnectionState new_state) {} PeerConnectionInterface::PeerConnectionState /* new_state */) {}
// Called any time the IceGatheringState changes. // Called any time the IceGatheringState changes.
virtual void OnIceGatheringChange( virtual void OnIceGatheringChange(
@ -1362,24 +1375,24 @@ class PeerConnectionObserver : public RtpPacketSinkInterface {
// Gathering of an ICE candidate failed. // Gathering of an ICE candidate failed.
// See https://w3c.github.io/webrtc-pc/#event-icecandidateerror // See https://w3c.github.io/webrtc-pc/#event-icecandidateerror
virtual void OnIceCandidateError(const std::string& address, virtual void OnIceCandidateError(const std::string& /* address */,
int port, int /* port */,
const std::string& url, const std::string& /* url */,
int error_code, int /* error_code */,
const std::string& error_text) {} const std::string& /* error_text */) {}
// Ice candidates have been removed. // Ice candidates have been removed.
// TODO(honghaiz): Make this a pure virtual method when all its subclasses // TODO(honghaiz): Make this a pure virtual method when all its subclasses
// implement it. // implement it.
virtual void OnIceCandidatesRemoved( virtual void OnIceCandidatesRemoved(
const std::vector<cricket::Candidate>& candidates) {} const std::vector<cricket::Candidate>& /* candidates */) {}
// Called when the ICE connection receiving status changes. // Called when the ICE connection receiving status changes.
virtual void OnIceConnectionReceivingChange(bool receiving) {} virtual void OnIceConnectionReceivingChange(bool /* receiving */) {}
// Called when the selected candidate pair for the ICE connection changes. // Called when the selected candidate pair for the ICE connection changes.
virtual void OnIceSelectedCandidatePairChanged( virtual void OnIceSelectedCandidatePairChanged(
const cricket::CandidatePairChangeEvent& event) {} const cricket::CandidatePairChangeEvent& /* event */) {}
// This is called when a receiver and its track are created. // This is called when a receiver and its track are created.
// TODO(zhihuang): Make this pure virtual when all subclasses implement it. // TODO(zhihuang): Make this pure virtual when all subclasses implement it.
@ -1387,8 +1400,9 @@ class PeerConnectionObserver : public RtpPacketSinkInterface {
// Plan users should prefer OnTrack, OnAddTrack is only called as backwards // Plan users should prefer OnTrack, OnAddTrack is only called as backwards
// compatibility (and is called in the exact same situations as OnTrack). // compatibility (and is called in the exact same situations as OnTrack).
virtual void OnAddTrack( virtual void OnAddTrack(
rtc::scoped_refptr<RtpReceiverInterface> receiver, rtc::scoped_refptr<RtpReceiverInterface> /* receiver */,
const std::vector<rtc::scoped_refptr<MediaStreamInterface>>& streams) {} const std::vector<
rtc::scoped_refptr<MediaStreamInterface>>& /* streams */) {}
// This is called when signaling indicates a transceiver will be receiving // This is called when signaling indicates a transceiver will be receiving
// media from the remote endpoint. This is fired during a call to // media from the remote endpoint. This is fired during a call to
@ -1400,7 +1414,7 @@ class PeerConnectionObserver : public RtpPacketSinkInterface {
// RTCSessionDescription" algorithm: // RTCSessionDescription" algorithm:
// https://w3c.github.io/webrtc-pc/#set-description // https://w3c.github.io/webrtc-pc/#set-description
virtual void OnTrack( virtual void OnTrack(
rtc::scoped_refptr<RtpTransceiverInterface> transceiver) {} rtc::scoped_refptr<RtpTransceiverInterface> /* transceiver */) {}
// Called when signaling indicates that media will no longer be received on a // Called when signaling indicates that media will no longer be received on a
// track. // track.
@ -1411,7 +1425,7 @@ class PeerConnectionObserver : public RtpPacketSinkInterface {
// https://w3c.github.io/webrtc-pc/#process-remote-track-removal // https://w3c.github.io/webrtc-pc/#process-remote-track-removal
// TODO(hbos,deadbeef): Make pure virtual when all subclasses implement it. // TODO(hbos,deadbeef): Make pure virtual when all subclasses implement it.
virtual void OnRemoveTrack( virtual void OnRemoveTrack(
rtc::scoped_refptr<RtpReceiverInterface> receiver) {} rtc::scoped_refptr<RtpReceiverInterface> /* receiver */) {}
// Called when an interesting usage is detected by WebRTC. // Called when an interesting usage is detected by WebRTC.
// An appropriate action is to add information about the context of the // An appropriate action is to add information about the context of the
@ -1419,7 +1433,7 @@ class PeerConnectionObserver : public RtpPacketSinkInterface {
// log function. // log function.
// The heuristics for defining what constitutes "interesting" are // The heuristics for defining what constitutes "interesting" are
// implementation-defined. // implementation-defined.
virtual void OnInterestingUsage(int usage_pattern) {} virtual void OnInterestingUsage(int /* usage_pattern */) {}
// RingRTC change to receive RTP data // RingRTC change to receive RTP data
void OnRtpPacket(const RtpPacketReceived& rtp_packet) override {} void OnRtpPacket(const RtpPacketReceived& rtp_packet) override {}
@ -1523,7 +1537,10 @@ struct RTC_EXPORT PeerConnectionFactoryDependencies final {
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory; rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory;
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory; rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory;
rtc::scoped_refptr<AudioMixer> audio_mixer; rtc::scoped_refptr<AudioMixer> audio_mixer;
// TODO: bugs.webrtc.org/369904700 - Deprecate `audio_processing` in favor
// of `audio_processing_builder`.
rtc::scoped_refptr<AudioProcessing> audio_processing; rtc::scoped_refptr<AudioProcessing> audio_processing;
std::unique_ptr<AudioProcessingBuilderInterface> audio_processing_builder;
std::unique_ptr<AudioFrameProcessor> audio_frame_processor; std::unique_ptr<AudioFrameProcessor> audio_frame_processor;
std::unique_ptr<VideoEncoderFactory> video_encoder_factory; std::unique_ptr<VideoEncoderFactory> video_encoder_factory;
std::unique_ptr<VideoDecoderFactory> video_decoder_factory; std::unique_ptr<VideoDecoderFactory> video_decoder_factory;
@ -1663,7 +1680,7 @@ class RTC_EXPORT PeerConnectionFactoryInterface
// StopAecDump function is called. // StopAecDump function is called.
// TODO(webrtc:6463): Delete default implementation when downstream mocks // TODO(webrtc:6463): Delete default implementation when downstream mocks
// classes are updated. // classes are updated.
virtual bool StartAecDump(FILE* file, int64_t max_size_bytes) { virtual bool StartAecDump(FILE* /* file */, int64_t /* max_size_bytes */) {
return false; return false;
} }

View file

@ -60,7 +60,7 @@ class RtcEventLogNull final : public RtcEventLog {
bool StartLogging(std::unique_ptr<RtcEventLogOutput> output, bool StartLogging(std::unique_ptr<RtcEventLogOutput> output,
int64_t output_period_ms) override; int64_t output_period_ms) override;
void StopLogging() override {} void StopLogging() override {}
void Log(std::unique_ptr<RtcEvent> event) override {} void Log(std::unique_ptr<RtcEvent> /* event */) override {}
}; };
} // namespace webrtc } // namespace webrtc

View file

@ -27,7 +27,7 @@ class RTC_EXPORT RtcEventLogFactory : public RtcEventLogFactoryInterface {
RtcEventLogFactory() = default; RtcEventLogFactory() = default;
[[deprecated("Use default constructor")]] // [[deprecated("Use default constructor")]] //
explicit RtcEventLogFactory(TaskQueueFactory* task_queue_factory) {} explicit RtcEventLogFactory(TaskQueueFactory* /* task_queue_factory */) {}
~RtcEventLogFactory() override = default; ~RtcEventLogFactory() override = default;

View file

@ -32,7 +32,7 @@ class RtpPacketSender {
// Clear any pending packets with the given SSRC from the queue. // Clear any pending packets with the given SSRC from the queue.
// TODO(crbug.com/1395081): Make pure virtual when downstream code has been // TODO(crbug.com/1395081): Make pure virtual when downstream code has been
// updated. // updated.
virtual void RemovePacketsForSsrc(uint32_t ssrc) {} virtual void RemovePacketsForSsrc(uint32_t /* ssrc */) {}
}; };
} // namespace webrtc } // namespace webrtc

View file

@ -76,6 +76,15 @@ RtpHeaderExtensionCapability::RtpHeaderExtensionCapability(
int preferred_id, int preferred_id,
RtpTransceiverDirection direction) RtpTransceiverDirection direction)
: uri(uri), preferred_id(preferred_id), direction(direction) {} : uri(uri), preferred_id(preferred_id), direction(direction) {}
RtpHeaderExtensionCapability::RtpHeaderExtensionCapability(
absl::string_view uri,
int preferred_id,
bool preferred_encrypt,
RtpTransceiverDirection direction)
: uri(uri),
preferred_id(preferred_id),
preferred_encrypt(preferred_encrypt),
direction(direction) {}
RtpHeaderExtensionCapability::~RtpHeaderExtensionCapability() = default; RtpHeaderExtensionCapability::~RtpHeaderExtensionCapability() = default;
RtpExtension::RtpExtension() = default; RtpExtension::RtpExtension() = default;

View file

@ -212,7 +212,6 @@ struct RTC_EXPORT RtpHeaderExtensionCapability {
std::optional<int> preferred_id; std::optional<int> preferred_id;
// If true, it's preferred that the value in the header is encrypted. // If true, it's preferred that the value in the header is encrypted.
// TODO(deadbeef): Not implemented.
bool preferred_encrypt = false; bool preferred_encrypt = false;
// The direction of the extension. The kStopped value is only used with // The direction of the extension. The kStopped value is only used with
@ -227,6 +226,10 @@ struct RTC_EXPORT RtpHeaderExtensionCapability {
RtpHeaderExtensionCapability(absl::string_view uri, RtpHeaderExtensionCapability(absl::string_view uri,
int preferred_id, int preferred_id,
RtpTransceiverDirection direction); RtpTransceiverDirection direction);
RtpHeaderExtensionCapability(absl::string_view uri,
int preferred_id,
bool preferred_encrypt,
RtpTransceiverDirection direction);
~RtpHeaderExtensionCapability(); ~RtpHeaderExtensionCapability();
bool operator==(const RtpHeaderExtensionCapability& o) const { bool operator==(const RtpHeaderExtensionCapability& o) const {
@ -494,23 +497,16 @@ struct RTC_EXPORT RtpEncodingParameters {
// https://w3c.github.io/webrtc-svc/#rtcrtpencodingparameters // https://w3c.github.io/webrtc-svc/#rtcrtpencodingparameters
std::optional<std::string> scalability_mode; std::optional<std::string> scalability_mode;
// Requested encode resolution. // This is an alternative API to `scale_resolution_down_by` but expressed in
// absolute terms (max width and max height) as opposed to relative terms (a
// scaling factor that is relative to the input frame size).
// //
// This field provides an alternative to `scale_resolution_down_by` // If both `scale_resolution_down_by` and `scale_resolution_down_to` are
// that is not dependent on the video source. // specified, the "scale by" value is ignored.
// //
// When setting requested_resolution it is not necessary to adapt the // See spec:
// video source using OnOutputFormatRequest, since the VideoStreamEncoder // https://w3c.github.io/webrtc-extensions/#dom-rtcrtpencodingparameters-scaleresolutiondownto
// will apply downscaling if necessary. requested_resolution will also be std::optional<Resolution> scale_resolution_down_to;
// propagated to the video source, this allows downscaling earlier in the
// pipeline which can be beneficial if the source is consumed by multiple
// encoders, but is not strictly necessary.
//
// The `requested_resolution` is subject to resource adaptation.
//
// It is an error to set both `requested_resolution` and
// `scale_resolution_down_by`.
std::optional<Resolution> requested_resolution;
// For an RtpSender, set to true to cause this encoding to be encoded and // For an RtpSender, set to true to cause this encoding to be encoded and
// sent, and false for it not to be encoded and sent. This allows control // sent, and false for it not to be encoded and sent. This allows control
@ -543,7 +539,8 @@ struct RTC_EXPORT RtpEncodingParameters {
scale_resolution_down_by == o.scale_resolution_down_by && scale_resolution_down_by == o.scale_resolution_down_by &&
active == o.active && rid == o.rid && active == o.active && rid == o.rid &&
adaptive_ptime == o.adaptive_ptime && adaptive_ptime == o.adaptive_ptime &&
requested_resolution == o.requested_resolution && codec == o.codec; scale_resolution_down_to == o.scale_resolution_down_to &&
codec == o.codec;
} }
bool operator!=(const RtpEncodingParameters& o) const { bool operator!=(const RtpEncodingParameters& o) const {
return !(*this == o); return !(*this == o);

View file

@ -36,7 +36,7 @@ std::vector<RtpSource> RtpReceiverInterface::GetSources() const {
} }
void RtpReceiverInterface::SetFrameDecryptor( void RtpReceiverInterface::SetFrameDecryptor(
rtc::scoped_refptr<FrameDecryptorInterface> frame_decryptor) {} rtc::scoped_refptr<FrameDecryptorInterface> /* frame_decryptor */) {}
rtc::scoped_refptr<FrameDecryptorInterface> rtc::scoped_refptr<FrameDecryptorInterface>
RtpReceiverInterface::GetFrameDecryptor() const { RtpReceiverInterface::GetFrameDecryptor() const {
@ -49,6 +49,6 @@ RtpReceiverInterface::dtls_transport() const {
} }
void RtpReceiverInterface::SetFrameTransformer( void RtpReceiverInterface::SetFrameTransformer(
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer) {} rtc::scoped_refptr<FrameTransformerInterface> /* frame_transformer */) {}
} // namespace webrtc } // namespace webrtc

View file

@ -80,7 +80,9 @@ class RTC_EXPORT RtpReceiverInterface : public webrtc::RefCountInterface,
virtual RtpParameters GetParameters() const = 0; virtual RtpParameters GetParameters() const = 0;
// TODO(dinosaurav): Delete SetParameters entirely after rolling to Chromium. // TODO(dinosaurav): Delete SetParameters entirely after rolling to Chromium.
// Currently, doesn't support changing any parameters. // Currently, doesn't support changing any parameters.
virtual bool SetParameters(const RtpParameters& parameters) { return false; } virtual bool SetParameters(const RtpParameters& /* parameters */) {
return false;
}
// Does not take ownership of observer. // Does not take ownership of observer.
// Must call SetObserver(nullptr) before the observer is destroyed. // Must call SetObserver(nullptr) before the observer is destroyed.

View file

@ -15,8 +15,9 @@
namespace webrtc { namespace webrtc {
void RtpSenderInterface::SetParametersAsync(const RtpParameters& parameters, void RtpSenderInterface::SetParametersAsync(
SetParametersCallback callback) { const RtpParameters& /* parameters */,
SetParametersCallback /* callback */) {
RTC_DCHECK_NOTREACHED() << "Default implementation called"; RTC_DCHECK_NOTREACHED() << "Default implementation called";
} }

View file

@ -36,6 +36,16 @@
namespace webrtc { namespace webrtc {
class RtpSenderObserverInterface {
public:
// The observer is called when the first media packet is sent for the observed
// sender. It is called immediately if the first packet was already sent.
virtual void OnFirstPacketSent(cricket::MediaType media_type) = 0;
protected:
virtual ~RtpSenderObserverInterface() {}
};
using SetParametersCallback = absl::AnyInvocable<void(RTCError) &&>; using SetParametersCallback = absl::AnyInvocable<void(RTCError) &&>;
class RTC_EXPORT RtpSenderInterface : public webrtc::RefCountInterface, class RTC_EXPORT RtpSenderInterface : public webrtc::RefCountInterface,
@ -88,6 +98,12 @@ class RTC_EXPORT RtpSenderInterface : public webrtc::RefCountInterface,
virtual void SetParametersAsync(const RtpParameters& parameters, virtual void SetParametersAsync(const RtpParameters& parameters,
SetParametersCallback callback); SetParametersCallback callback);
// Sets an observer which gets a callback when the first media packet is sent
// for this sender.
// Does not take ownership of observer.
// Must call SetObserver(nullptr) before the observer is destroyed.
virtual void SetObserver(RtpSenderObserverInterface* /* observer */) {}
// Returns null for a video sender. // Returns null for a video sender.
virtual rtc::scoped_refptr<DtmfSenderInterface> GetDtmfSender() const = 0; virtual rtc::scoped_refptr<DtmfSenderInterface> GetDtmfSender() const = 0;
@ -119,7 +135,7 @@ class RTC_EXPORT RtpSenderInterface : public webrtc::RefCountInterface,
// Default implementation of SetFrameTransformer. // Default implementation of SetFrameTransformer.
// TODO: bugs.webrtc.org/15929 - remove when all implementations are good // TODO: bugs.webrtc.org/15929 - remove when all implementations are good
void SetFrameTransformer(rtc::scoped_refptr<FrameTransformerInterface> void SetFrameTransformer(rtc::scoped_refptr<FrameTransformerInterface>
frame_transformer) override {} /* frame_transformer */) override {}
protected: protected:
~RtpSenderInterface() override = default; ~RtpSenderInterface() override = default;

View file

@ -10,6 +10,8 @@
#include "api/rtp_transceiver_interface.h" #include "api/rtp_transceiver_interface.h"
#include <optional>
#include "api/rtc_error.h" #include "api/rtc_error.h"
#include "api/rtp_transceiver_direction.h" #include "api/rtp_transceiver_direction.h"
#include "rtc_base/checks.h" #include "rtc_base/checks.h"
@ -54,7 +56,7 @@ void RtpTransceiverInterface::SetDirection(
} }
RTCError RtpTransceiverInterface::SetDirectionWithError( RTCError RtpTransceiverInterface::SetDirectionWithError(
RtpTransceiverDirection new_direction) { RtpTransceiverDirection /* new_direction */) {
RTC_DCHECK_NOTREACHED() << "Default implementation called"; RTC_DCHECK_NOTREACHED() << "Default implementation called";
return RTCError::OK(); return RTCError::OK();
} }

View file

@ -22,13 +22,13 @@
// }; // };
// //
// void some_function() { // void some_function() {
// scoped_refptr<MyFoo> foo = new MyFoo(); // scoped_refptr<MyFoo> foo = make_ref_counted<MyFoo>();
// foo->Method(param); // foo->Method(param);
// // `foo` is released when this function returns // // `foo` is released when this function returns
// } // }
// //
// void some_other_function() { // void some_other_function() {
// scoped_refptr<MyFoo> foo = new MyFoo(); // scoped_refptr<MyFoo> foo = make_ref_counted<MyFoo>();
// ... // ...
// foo = nullptr; // explicitly releases `foo` // foo = nullptr; // explicitly releases `foo`
// ... // ...
@ -41,7 +41,7 @@
// references between the two objects, like so: // references between the two objects, like so:
// //
// { // {
// scoped_refptr<MyFoo> a = new MyFoo(); // scoped_refptr<MyFoo> a = make_ref_counted<MyFoo>();
// scoped_refptr<MyFoo> b; // scoped_refptr<MyFoo> b;
// //
// b.swap(a); // b.swap(a);
@ -52,7 +52,7 @@
// object, simply use the assignment operator: // object, simply use the assignment operator:
// //
// { // {
// scoped_refptr<MyFoo> a = new MyFoo(); // scoped_refptr<MyFoo> a = make_ref_counted<MyFoo>();
// scoped_refptr<MyFoo> b; // scoped_refptr<MyFoo> b;
// //
// b = a; // b = a;
@ -66,17 +66,20 @@
#include <cstddef> #include <cstddef>
#include <utility> #include <utility>
#include "absl/base/nullability.h"
namespace webrtc { namespace webrtc {
template <class T> template <class T>
class scoped_refptr { class ABSL_NULLABILITY_COMPATIBLE scoped_refptr {
public: public:
typedef T element_type; using absl_nullability_compatible = void;
using element_type = T;
scoped_refptr() : ptr_(nullptr) {} scoped_refptr() : ptr_(nullptr) {}
scoped_refptr(std::nullptr_t) : ptr_(nullptr) {} // NOLINT(runtime/explicit) scoped_refptr(std::nullptr_t) : ptr_(nullptr) {} // NOLINT(runtime/explicit)
explicit scoped_refptr(T* p) : ptr_(p) { explicit scoped_refptr(absl::Nullable<T*> p) : ptr_(p) {
if (ptr_) if (ptr_)
ptr_->AddRef(); ptr_->AddRef();
} }
@ -119,7 +122,7 @@ class scoped_refptr {
return retVal; return retVal;
} }
scoped_refptr<T>& operator=(T* p) { scoped_refptr<T>& operator=(absl::Nullable<T*> p) {
// AddRef first so that self assignment should work // AddRef first so that self assignment should work
if (p) if (p)
p->AddRef(); p->AddRef();
@ -149,7 +152,7 @@ class scoped_refptr {
return *this; return *this;
} }
void swap(T** pp) noexcept { void swap(absl::Nonnull<T**> pp) noexcept {
T* p = ptr_; T* p = ptr_;
ptr_ = *pp; ptr_ = *pp;
*pp = p; *pp = p;
@ -219,9 +222,8 @@ bool operator<(const scoped_refptr<T>& a, const scoped_refptr<U>& b) {
namespace rtc { namespace rtc {
// Backwards compatible alias. // Backwards compatible alias.
// TODO(bugs.webrtc.org/15622): Deprecate and remove. // TODO: bugs.webrtc.org/42225969 - Deprecate and remove.
template <typename T> using ::webrtc::scoped_refptr;
using scoped_refptr = webrtc::scoped_refptr<T>;
} // namespace rtc } // namespace rtc
#endif // API_SCOPED_REFPTR_H_ #endif // API_SCOPED_REFPTR_H_

View file

@ -10,6 +10,7 @@
#include "api/sctp_transport_interface.h" #include "api/sctp_transport_interface.h"
#include <optional>
#include <utility> #include <utility>
#include "api/dtls_transport_interface.h" #include "api/dtls_transport_interface.h"

View file

@ -297,6 +297,9 @@ class RTC_EXPORT RTCInboundRtpStreamStats final
std::optional<uint32_t> pli_count; std::optional<uint32_t> pli_count;
std::optional<uint32_t> nack_count; std::optional<uint32_t> nack_count;
std::optional<uint64_t> qp_sum; std::optional<uint64_t> qp_sum;
std::optional<double> total_corruption_probability;
std::optional<double> total_squared_corruption_probability;
std::optional<uint64_t> corruption_measurements;
// This is a remnant of the legacy getStats() API. When the "video-timing" // This is a remnant of the legacy getStats() API. When the "video-timing"
// header extension is used, // header extension is used,
// https://webrtc.github.io/webrtc-org/experiments/rtp-hdrext/video-timing/, // https://webrtc.github.io/webrtc-org/experiments/rtp-hdrext/video-timing/,

View file

@ -16,7 +16,7 @@
namespace webrtc { namespace webrtc {
std::unique_ptr<TaskQueueFactory> CreateDefaultTaskQueueFactory( std::unique_ptr<TaskQueueFactory> CreateDefaultTaskQueueFactory(
const FieldTrialsView* field_trials) { const FieldTrialsView* /* field_trials */) {
return CreateTaskQueueGcdFactory(); return CreateTaskQueueGcdFactory();
} }

View file

@ -13,26 +13,14 @@
#include "api/field_trials_view.h" #include "api/field_trials_view.h"
#include "api/task_queue/task_queue_factory.h" #include "api/task_queue/task_queue_factory.h"
#include "api/transport/field_trial_based_config.h" #include "api/transport/field_trial_based_config.h"
#include "rtc_base/logging.h"
#include "rtc_base/memory/always_valid_pointer.h" #include "rtc_base/memory/always_valid_pointer.h"
#include "rtc_base/task_queue_libevent.h"
#include "rtc_base/task_queue_stdlib.h" #include "rtc_base/task_queue_stdlib.h"
namespace webrtc { namespace webrtc {
std::unique_ptr<TaskQueueFactory> CreateDefaultTaskQueueFactory( std::unique_ptr<TaskQueueFactory> CreateDefaultTaskQueueFactory(
const FieldTrialsView* field_trials_view) { const FieldTrialsView* field_trials_view) {
AlwaysValidPointer<const FieldTrialsView, FieldTrialBasedConfig> field_trials( return CreateTaskQueueStdlibFactory();
field_trials_view);
if (field_trials->IsEnabled("WebRTC-TaskQueue-ReplaceLibeventWithStdlib")) {
RTC_LOG(LS_INFO) << "WebRTC-TaskQueue-ReplaceLibeventWithStdlib: "
<< "using TaskQueueStdlibFactory.";
return CreateTaskQueueStdlibFactory();
}
RTC_LOG(LS_INFO) << "WebRTC-TaskQueue-ReplaceLibeventWithStdlib: "
<< "using TaskQueueLibeventFactory.";
return CreateTaskQueueLibeventFactory();
} }
} // namespace webrtc } // namespace webrtc

View file

@ -13,25 +13,31 @@
#include <memory> #include <memory>
#include <utility> #include <utility>
#include "absl/base/nullability.h"
#include "api/audio/audio_processing.h" #include "api/audio/audio_processing.h"
#include "api/scoped_refptr.h" #include "api/audio/builtin_audio_processing_builder.h"
#include "modules/audio_processing/test/audioproc_float_impl.h" #include "modules/audio_processing/test/audioproc_float_impl.h"
namespace webrtc { namespace webrtc {
namespace test { namespace test {
int AudioprocFloat(rtc::scoped_refptr<AudioProcessing> audio_processing, int AudioprocFloat(int argc, char* argv[]) {
int argc, return AudioprocFloatImpl(std::make_unique<BuiltinAudioProcessingBuilder>(),
char* argv[]) { argc, argv);
return AudioprocFloatImpl(std::move(audio_processing), argc, argv);
} }
int AudioprocFloat(std::unique_ptr<AudioProcessingBuilder> ap_builder, int AudioprocFloat(
int argc, absl::Nonnull<std::unique_ptr<BuiltinAudioProcessingBuilder>> ap_builder,
char* argv[]) { int argc,
return AudioprocFloatImpl(std::move(ap_builder), argc, argv, char* argv[]) {
/*input_aecdump=*/"", return AudioprocFloatImpl(std::move(ap_builder), argc, argv);
/*processed_capture_samples=*/nullptr); }
int AudioprocFloat(
absl::Nonnull<std::unique_ptr<AudioProcessingBuilderInterface>> ap_builder,
int argc,
char* argv[]) {
return AudioprocFloatImpl(std::move(ap_builder), argc, argv);
} }
} // namespace test } // namespace test

View file

@ -13,8 +13,9 @@
#include <memory> #include <memory>
#include "absl/base/nullability.h"
#include "api/audio/audio_processing.h" #include "api/audio/audio_processing.h"
#include "api/scoped_refptr.h" #include "api/audio/builtin_audio_processing_builder.h"
namespace webrtc { namespace webrtc {
namespace test { namespace test {
@ -22,36 +23,26 @@ namespace test {
// This is an interface for the audio processing simulation utility. This // This is an interface for the audio processing simulation utility. This
// utility can be used to simulate the audioprocessing module using a recording // utility can be used to simulate the audioprocessing module using a recording
// (either an AEC dump or wav files), and generate the output as a wav file. // (either an AEC dump or wav files), and generate the output as a wav file.
// Any audio_processing object specified in the input is used for the //
// simulation. The optional `audio_processing` object provides the // It is needed to pass the command line flags as `argc` and `argv`, so these
// AudioProcessing instance that is used during the simulation. Note that when // can be interpreted properly by the utility. To see a list of all supported
// the audio_processing object is specified all functionality that relies on // command line flags, run the executable with the '--helpfull' flag.
// using the AudioProcessingBuilder is deactivated, since the AudioProcessing //
// object is already created and the builder is not used in the simulation. It // The optional `ap_builder` object will be used to create the AudioProcessing
// is needed to pass the command line flags as `argc` and `argv`, so these can // instance that is used during the simulation. BuiltinAudioProcessingBuilder
// be interpreted properly by the utility. To see a list of all supported // `ap_builder` supports setting of injectable components, which will be passed
// command line flags, run the executable with the '--help' flag. // on to the created AudioProcessing instance. When generic
int AudioprocFloat(rtc::scoped_refptr<AudioProcessing> audio_processing, // `AudioProcessingBuilderInterface` is used, all functionality that relies on
int argc, // using the BuiltinAudioProcessingBuilder is deactivated.
char* argv[]); int AudioprocFloat(int argc, char* argv[]);
int AudioprocFloat(
// This is an interface for the audio processing simulation utility. This absl::Nonnull<std::unique_ptr<BuiltinAudioProcessingBuilder>> ap_builder,
// utility can be used to simulate the audioprocessing module using a recording int argc,
// (either an AEC dump or wav files), and generate the output as a wav file. char* argv[]);
// The `ap_builder` object will be used to create the AudioProcessing instance int AudioprocFloat(
// that is used during the simulation. The `ap_builder` supports setting of absl::Nonnull<std::unique_ptr<AudioProcessingBuilderInterface>> ap_builder,
// injectable components, which will be passed on to the created AudioProcessing int argc,
// instance. It is needed to pass the command line flags as `argc` and `argv`, char* argv[]);
// so these can be interpreted properly by the utility.
// To get a fully-working audioproc_f utility, all that is needed is to write a
// main function, create an AudioProcessingBuilder, optionally set custom
// processing components on it, and pass the builder together with the command
// line arguments into this function.
// To see a list of all supported command line flags, run the executable with
// the '--help' flag.
int AudioprocFloat(std::unique_ptr<AudioProcessingBuilder> ap_builder,
int argc,
char* argv[]);
} // namespace test } // namespace test
} // namespace webrtc } // namespace webrtc

View file

@ -25,9 +25,9 @@ FakeFrameDecryptor::FakeFrameDecryptor(uint8_t fake_key,
: fake_key_(fake_key), expected_postfix_byte_(expected_postfix_byte) {} : fake_key_(fake_key), expected_postfix_byte_(expected_postfix_byte) {}
FakeFrameDecryptor::Result FakeFrameDecryptor::Decrypt( FakeFrameDecryptor::Result FakeFrameDecryptor::Decrypt(
cricket::MediaType media_type, cricket::MediaType /* media_type */,
const std::vector<uint32_t>& csrcs, const std::vector<uint32_t>& /* csrcs */,
rtc::ArrayView<const uint8_t> additional_data, rtc::ArrayView<const uint8_t> /* additional_data */,
rtc::ArrayView<const uint8_t> encrypted_frame, rtc::ArrayView<const uint8_t> encrypted_frame,
rtc::ArrayView<uint8_t> frame) { rtc::ArrayView<uint8_t> frame) {
if (fail_decryption_) { if (fail_decryption_) {
@ -47,7 +47,7 @@ FakeFrameDecryptor::Result FakeFrameDecryptor::Decrypt(
} }
size_t FakeFrameDecryptor::GetMaxPlaintextByteSize( size_t FakeFrameDecryptor::GetMaxPlaintextByteSize(
cricket::MediaType media_type, cricket::MediaType /* media_type */,
size_t encrypted_frame_size) { size_t encrypted_frame_size) {
return encrypted_frame_size - 1; return encrypted_frame_size - 1;
} }

View file

@ -22,12 +22,13 @@ FakeFrameEncryptor::FakeFrameEncryptor(uint8_t fake_key, uint8_t postfix_byte)
: fake_key_(fake_key), postfix_byte_(postfix_byte) {} : fake_key_(fake_key), postfix_byte_(postfix_byte) {}
// FrameEncryptorInterface implementation // FrameEncryptorInterface implementation
int FakeFrameEncryptor::Encrypt(cricket::MediaType media_type, int FakeFrameEncryptor::Encrypt(
uint32_t ssrc, cricket::MediaType /* media_type */,
rtc::ArrayView<const uint8_t> additional_data, uint32_t /* ssrc */,
rtc::ArrayView<const uint8_t> frame, rtc::ArrayView<const uint8_t> /* additional_data */,
rtc::ArrayView<uint8_t> encrypted_frame, rtc::ArrayView<const uint8_t> frame,
size_t* bytes_written) { rtc::ArrayView<uint8_t> encrypted_frame,
size_t* bytes_written) {
if (fail_encryption_) { if (fail_encryption_) {
return static_cast<int>(FakeEncryptionStatus::FORCED_FAILURE); return static_cast<int>(FakeEncryptionStatus::FORCED_FAILURE);
} }
@ -43,7 +44,7 @@ int FakeFrameEncryptor::Encrypt(cricket::MediaType media_type,
} }
size_t FakeFrameEncryptor::GetMaxCiphertextByteSize( size_t FakeFrameEncryptor::GetMaxCiphertextByteSize(
cricket::MediaType media_type, cricket::MediaType /* media_type */,
size_t frame_size) { size_t frame_size) {
return frame_size + 1; return frame_size + 1;
} }

View file

@ -45,9 +45,9 @@ class MockDtmfSender : public DtmfSenderInterface {
(override)); (override));
MOCK_METHOD(void, UnregisterObserver, (), (override)); MOCK_METHOD(void, UnregisterObserver, (), (override));
MOCK_METHOD(bool, CanInsertDtmf, (), (override)); MOCK_METHOD(bool, CanInsertDtmf, (), (override));
MOCK_METHOD(std::string, tones, (), (const override)); MOCK_METHOD(std::string, tones, (), (const, override));
MOCK_METHOD(int, duration, (), (const override)); MOCK_METHOD(int, duration, (), (const, override));
MOCK_METHOD(int, inter_tone_gap, (), (const override)); MOCK_METHOD(int, inter_tone_gap, (), (const, override));
protected: protected:
MockDtmfSender() = default; MockDtmfSender() = default;

View file

@ -89,7 +89,7 @@ class MockAudioTrack : public rtc::RefCountedObject<AudioTrackInterface> {
class MockMediaStream : public MediaStreamInterface { class MockMediaStream : public MediaStreamInterface {
public: public:
MOCK_METHOD(std::string, id, (), (const override)); MOCK_METHOD(std::string, id, (), (const, override));
MOCK_METHOD(AudioTrackVector, GetAudioTracks, (), (override)); MOCK_METHOD(AudioTrackVector, GetAudioTracks, (), (override));
MOCK_METHOD(VideoTrackVector, GetVideoTracks, (), (override)); MOCK_METHOD(VideoTrackVector, GetVideoTracks, (), (override));
MOCK_METHOD(rtc::scoped_refptr<AudioTrackInterface>, MOCK_METHOD(rtc::scoped_refptr<AudioTrackInterface>,
@ -116,11 +116,6 @@ class MockMediaStream : public MediaStreamInterface {
RemoveTrack, RemoveTrack,
(rtc::scoped_refptr<VideoTrackInterface> track), (rtc::scoped_refptr<VideoTrackInterface> track),
(override)); (override));
// Old AddTrack/RemoveTrack methods - slated for removal
MOCK_METHOD(bool, AddTrack, (AudioTrackInterface * track), (override));
MOCK_METHOD(bool, AddTrack, (VideoTrackInterface * track), (override));
MOCK_METHOD(bool, RemoveTrack, (AudioTrackInterface * track), (override));
MOCK_METHOD(bool, RemoveTrack, (VideoTrackInterface * track), (override));
MOCK_METHOD(void, MOCK_METHOD(void,
RegisterObserver, RegisterObserver,
(ObserverInterface * observer), (ObserverInterface * observer),

View file

@ -234,7 +234,7 @@ class MockPeerConnectionInterface : public webrtc::PeerConnectionInterface {
(override)); (override));
MOCK_METHOD(void, StopRtcEventLog, (), (override)); MOCK_METHOD(void, StopRtcEventLog, (), (override));
MOCK_METHOD(void, Close, (), (override)); MOCK_METHOD(void, Close, (), (override));
MOCK_METHOD(rtc::Thread*, signaling_thread, (), (const override)); MOCK_METHOD(rtc::Thread*, signaling_thread, (), (const, override));
MOCK_METHOD(NetworkControllerInterface*, MOCK_METHOD(NetworkControllerInterface*,
GetNetworkController, GetNetworkController,
(), (),

View file

@ -45,10 +45,8 @@ class MockRtpSender : public RtpSenderInterface {
track, track,
(), (),
(const, override)); (const, override));
MOCK_METHOD(rtc::scoped_refptr<DtlsTransportInterface>, MOCK_METHOD(rtc::scoped_refptr<DtlsTransportInterface>, dtls_transport, (),
dtls_transport, (const, override));
(),
(const override));
MOCK_METHOD(uint32_t, ssrc, (), (const, override)); MOCK_METHOD(uint32_t, ssrc, (), (const, override));
MOCK_METHOD(cricket::MediaType, media_type, (), (const, override)); MOCK_METHOD(cricket::MediaType, media_type, (), (const, override));
MOCK_METHOD(std::string, id, (), (const, override)); MOCK_METHOD(std::string, id, (), (const, override));
@ -84,6 +82,7 @@ class MockRtpSender : public RtpSenderInterface {
SetEncoderSelector, SetEncoderSelector,
(std::unique_ptr<VideoEncoderFactory::EncoderSelectorInterface>), (std::unique_ptr<VideoEncoderFactory::EncoderSelectorInterface>),
(override)); (override));
MOCK_METHOD(void, SetObserver, (RtpSenderObserverInterface*), (override));
}; };
static_assert(!std::is_abstract_v<rtc::RefCountedObject<MockRtpSender>>, ""); static_assert(!std::is_abstract_v<rtc::RefCountedObject<MockRtpSender>>, "");

View file

@ -33,10 +33,8 @@ class MockTransformableAudioFrame : public TransformableAudioFrameInterface {
MOCK_METHOD(uint32_t, GetSsrc, (), (const, override)); MOCK_METHOD(uint32_t, GetSsrc, (), (const, override));
MOCK_METHOD(uint32_t, GetTimestamp, (), (const, override)); MOCK_METHOD(uint32_t, GetTimestamp, (), (const, override));
MOCK_METHOD(std::string, GetMimeType, (), (const, override)); MOCK_METHOD(std::string, GetMimeType, (), (const, override));
MOCK_METHOD(rtc::ArrayView<const uint32_t>, MOCK_METHOD(rtc::ArrayView<const uint32_t>, GetContributingSources, (),
GetContributingSources, (const, override));
(),
(const override));
MOCK_METHOD(const std::optional<uint16_t>, MOCK_METHOD(const std::optional<uint16_t>,
SequenceNumber, SequenceNumber,
(), (),

View file

@ -35,7 +35,7 @@ class MockTransformableFrame : public TransformableFrameInterface {
MOCK_METHOD(uint32_t, GetTimestamp, (), (const, override)); MOCK_METHOD(uint32_t, GetTimestamp, (), (const, override));
MOCK_METHOD(void, SetRTPTimestamp, (uint32_t), (override)); MOCK_METHOD(void, SetRTPTimestamp, (uint32_t), (override));
MOCK_METHOD(std::optional<webrtc::Timestamp>, MOCK_METHOD(std::optional<webrtc::Timestamp>,
GetCaptureTimeIdentifier, GetPresentationTimestamp,
(), (),
(const, override)); (const, override));
MOCK_METHOD(std::string, GetMimeType, (), (const, override)); MOCK_METHOD(std::string, GetMimeType, (), (const, override));

View file

@ -46,7 +46,7 @@ class MockTransformableVideoFrame
MOCK_METHOD(std::string, GetMimeType, (), (const, override)); MOCK_METHOD(std::string, GetMimeType, (), (const, override));
MOCK_METHOD(VideoFrameMetadata, Metadata, (), (const, override)); MOCK_METHOD(VideoFrameMetadata, Metadata, (), (const, override));
MOCK_METHOD(std::optional<Timestamp>, MOCK_METHOD(std::optional<Timestamp>,
GetCaptureTimeIdentifier, GetPresentationTimestamp,
(), (),
(const, override)); (const, override));
}; };

View file

@ -128,10 +128,15 @@ struct Params {
std::optional<std::string> name; std::optional<std::string> name;
// If `audio_config` is set audio stream will be configured // If `audio_config` is set audio stream will be configured
std::optional<AudioConfig> audio_config; std::optional<AudioConfig> audio_config;
// Flags to set on `cricket::PortAllocator`. These flags will be added // Flags to set on `cricket::PortAllocator`. If not set,
// to the default ones that are presented on the port allocator. // cricket::kDefaultPortAllocatorFlags will be used and
// cricket::PORTALLOCATOR_DISABLE_TCP will be disabled.
//
// IMPORTANT: if you use WebRTC Network Emulation
// (api/test/network_emulation_manager.h) and set this field, remember to set
// cricket::PORTALLOCATOR_DISABLE_TCP to 0.
// RingRTC change to avoid incorrect use of flag in non-test code. // RingRTC change to avoid incorrect use of flag in non-test code.
uint32_t port_allocator_extra_flags = 0; std::optional<uint32_t> port_allocator_flags = 0;
// If `rtc_event_log_path` is set, an RTCEventLog will be saved in that // If `rtc_event_log_path` is set, an RTCEventLog will be saved in that
// location and it will be available for further analysis. // location and it will be available for further analysis.
std::optional<std::string> rtc_event_log_path; std::optional<std::string> rtc_event_log_path;

View file

@ -240,9 +240,17 @@ PeerConfigurer* PeerConfigurer::SetFieldTrials(
PeerConfigurer* PeerConfigurer::SetPortAllocatorExtraFlags( PeerConfigurer* PeerConfigurer::SetPortAllocatorExtraFlags(
uint32_t extra_flags) { uint32_t extra_flags) {
params_->port_allocator_extra_flags = extra_flags; params_->port_allocator_flags = cricket::kDefaultPortAllocatorFlags |
cricket::PORTALLOCATOR_DISABLE_TCP |
extra_flags;
return this; return this;
} }
PeerConfigurer* PeerConfigurer::SetPortAllocatorFlags(uint32_t flags) {
params_->port_allocator_flags = flags;
return this;
}
std::unique_ptr<InjectableComponents> PeerConfigurer::ReleaseComponents() { std::unique_ptr<InjectableComponents> PeerConfigurer::ReleaseComponents() {
RTC_CHECK(components_); RTC_CHECK(components_);
auto components = std::move(components_); auto components = std::move(components_);

View file

@ -99,9 +99,19 @@ class PeerConfigurer {
PeerConfigurer* SetIceTransportFactory( PeerConfigurer* SetIceTransportFactory(
std::unique_ptr<IceTransportFactory> factory); std::unique_ptr<IceTransportFactory> factory);
// Flags to set on `cricket::PortAllocator`. These flags will be added // Flags to set on `cricket::PortAllocator`. These flags will be added
// to the default ones that are presented on the port allocator. // to the cricket::kDefaultPortAllocatorFlags with
// For possible values check p2p/base/port_allocator.h. // cricket::PORTALLOCATOR_DISABLE_TCP disabled. For possible values check
// p2p/base/port_allocator.h.
PeerConfigurer* SetPortAllocatorExtraFlags(uint32_t extra_flags); PeerConfigurer* SetPortAllocatorExtraFlags(uint32_t extra_flags);
// Flags to set on `cricket::PortAllocator`. These flags will override
// the default ones that are presented on the port allocator.
//
// For possible values check p2p/base/port_allocator.h.
//
// IMPORTANT: if you use WebRTC Network Emulation
// (api/test/network_emulation_manager.h) and set this field, remember to set
// cricket::PORTALLOCATOR_DISABLE_TCP to 0.
PeerConfigurer* SetPortAllocatorFlags(uint32_t flags);
// Add new video stream to the call that will be sent from this peer. // Add new video stream to the call that will be sent from this peer.
// Default implementation of video frames generator will be used. // Default implementation of video frames generator will be used.

View file

@ -85,7 +85,7 @@ struct TestVideoFrameWriter : public test::VideoFrameWriter {
const VideoResolution& resolution) const VideoResolution& resolution)
: file_name_prefix(file_name_prefix), resolution(resolution) {} : file_name_prefix(file_name_prefix), resolution(resolution) {}
bool WriteFrame(const VideoFrame& frame) override { return true; } bool WriteFrame(const VideoFrame& /* frame */) override { return true; }
void Close() override {} void Close() override {}

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