Update to 5005 (M102) (#86)

This commit is contained in:
Rashad Sookram 2022-08-24 11:07:33 -04:00 committed by GitHub
parent 69a0665d86
commit 9ed4194e49
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
799 changed files with 41903 additions and 11045 deletions

10
.gn
View file

@ -24,7 +24,12 @@ secondary_source = "//build/secondary/"
# matching these patterns (see "gn help label_pattern" for format) will not have
# their includes checked for proper dependencies when you run either
# "gn check" or "gn gen --check".
no_check_targets = [ "//third_party/icu/*" ]
no_check_targets = [
"//third_party/icu/*",
# TODO(crbug.com/1151236) Remove once fixed.
"//base/allocator/partition_allocator:partition_alloc",
]
# These are the list of GN files that run exec_script. This whitelist exists
# to force additional review for new uses of exec_script, which is strongly
@ -67,4 +72,7 @@ default_args = {
# RingRTC change to support SDK >= 19.
# Differently from Chromium, WebRTC still support SDK 19.
default_min_sdk_version = 19
# Prevent jsoncpp to pass -Wno-deprecated-declarations to users
jsoncpp_no_deprecated_declarations = false
}

View file

@ -31,7 +31,7 @@ wheel: <
version: "version:5.2.2"
>
# Used by tools_webrtc/perf/webrtc_dashboard_upload.py.
# Used by tools_webrtc/perf/process_perf_results.py.
wheel: <
name: "infra/python/wheels/httplib2-py2_py3"
version: "version:0.10.3"

View file

@ -31,7 +31,7 @@ wheel: <
version: "version:5.8.0.chromium.2"
>
# Used by tools_webrtc/perf/webrtc_dashboard_upload.py.
# Used by tools_webrtc/perf/process_perf_results.py.
wheel: <
name: "infra/python/wheels/httplib2-py3"
version: "version:0.19.1"

View file

@ -35,6 +35,7 @@ CZ Theng <cz.theng@gmail.com>
Danail Kirov <dkirovbroadsoft@gmail.com>
Dave Cowart <davecowart@gmail.com>
David Porter <david@porter.me>
David Sanders <dsanders11@ucsbalum.com>
Dax Booysen <dax@younow.com>
Dennis Angelo <dennis.angelo@gmail.com>
Dharmesh Chauhan <dharmesh.r.chauhan@gmail.com>

View file

@ -473,9 +473,7 @@ if (!build_with_chromium) {
"modules/video_capture:video_capture_internal_impl",
"p2p:rtc_p2p",
"pc:libjingle_peerconnection",
"pc:peerconnection",
"pc:rtc_pc",
"pc:rtc_pc_base",
"ringrtc",
"rtc_base",
"sdk",
@ -580,6 +578,7 @@ if (rtc_include_tests && !build_with_chromium) {
"rtc_base/task_utils:pending_task_safety_flag_unittests",
"rtc_base/task_utils:repeating_task_unittests",
"rtc_base/task_utils:to_queued_task_unittests",
"rtc_base/time:timestamp_extrapolator_unittests",
"rtc_base/units:units_unittests",
"sdk:sdk_tests",
"test:rtp_test_utils",
@ -726,6 +725,23 @@ if (rtc_include_tests && !build_with_chromium) {
}
}
# Build target for standalone dcsctp
rtc_static_library("dcsctp") {
# Only the root target should depend on this.
visibility = [ "//:default" ]
sources = []
complete_static_lib = true
suppressed_configs += [ "//build/config/compiler:thin_archive" ]
defines = []
deps = [
"net/dcsctp/public:factory",
"net/dcsctp/public:socket",
"net/dcsctp/public:types",
"net/dcsctp/socket:dcsctp_socket",
"net/dcsctp/timer:task_queue_timeout",
]
}
# ---- Poisons ----
#
# Here is one empty dummy target for each poison type (needed because

151
DEPS
View file

@ -10,43 +10,43 @@ vars = {
# chromium waterfalls. More info at: crbug.com/570091.
'checkout_configuration': 'default',
'checkout_instrumented_libraries': 'checkout_linux and checkout_configuration == "default"',
'chromium_revision': 'f55241d0144f3599fa90e4e6038b96634d2b4d42',
'chromium_revision': '367352a504a1137ecf9548df523db9104fc24782',
# Keep the Chromium default of generating location tags.
'generate_location_tags': True,
# ResultDB version
'resultdb_version': 'git_revision:735a8a662d3874d8b1d795a40e46ea0f57b52758',
'resultdb_version': 'git_revision:6cc18e2763e180929d70c786b419c1f8e6bcc66c',
}
deps = {
# TODO(kjellander): Move this to be Android-only once the libevent dependency
# in base/third_party/libevent is solved.
'src/base':
'https://chromium.googlesource.com/chromium/src/base@bee216d6736d6a471879c5fcd32c8aba863d4755',
'https://chromium.googlesource.com/chromium/src/base@d714333bb07eb8444f600ea4d2dc56be55730a51',
'src/build':
'https://chromium.googlesource.com/chromium/src/build@b42b2033819f95b3e43f24e541938c671110966d',
'https://chromium.googlesource.com/chromium/src/build@bb1c23c67d2328cbb89966535bfca2916854bb8e',
'src/buildtools':
'https://chromium.googlesource.com/chromium/src/buildtools@d8c375426d8f7f4147f7d4109bb63c12655fb8d6',
'https://chromium.googlesource.com/chromium/src/buildtools@c2e4795660817c2776dbabd778b92ed58c074032',
# Gradle 6.6.1. Used for testing Android Studio project generation for WebRTC.
'src/examples/androidtests/third_party/gradle': {
'url': 'https://chromium.googlesource.com/external/github.com/gradle/gradle.git@f2d1fb54a951d8b11d25748e4711bec8d128d7e3',
'condition': 'checkout_android',
},
'src/ios': {
'url': 'https://chromium.googlesource.com/chromium/src/ios@043ae4b9e442fed9d4a53c88ab708775f8e079cd',
'url': 'https://chromium.googlesource.com/chromium/src/ios@5b2e06596b8a02c9885aec65e233c8c3383e1dee',
'condition': 'checkout_ios',
},
'src/testing':
'https://chromium.googlesource.com/chromium/src/testing@c4769e51cb122096ea4cdc5ed6f7e57aa2315447',
'https://chromium.googlesource.com/chromium/src/testing@d2cc6b1f9d361923efea2c822f9e6c346861dc9f',
'src/third_party':
'https://chromium.googlesource.com/chromium/src/third_party@7835795588c74a353beb1e03b74d45fabfdf295f',
'https://chromium.googlesource.com/chromium/src/third_party@5a0acdf2e317019f2c55ad5de72a144e9a758cdf',
'src/buildtools/linux64': {
'packages': [
{
'package': 'gn/gn/linux-amd64',
'version': 'git_revision:bd99dbf98cbdefe18a4128189665c5761263bcfb',
'version': 'git_revision:0cbe341c1a28037ee32d21b589030a7df0b9fdab',
}
],
'dep_type': 'cipd',
@ -56,7 +56,7 @@ deps = {
'packages': [
{
'package': 'gn/gn/mac-${{arch}}',
'version': 'git_revision:bd99dbf98cbdefe18a4128189665c5761263bcfb',
'version': 'git_revision:0cbe341c1a28037ee32d21b589030a7df0b9fdab',
}
],
'dep_type': 'cipd',
@ -66,7 +66,7 @@ deps = {
'packages': [
{
'package': 'gn/gn/windows-amd64',
'version': 'git_revision:bd99dbf98cbdefe18a4128189665c5761263bcfb',
'version': 'git_revision:0cbe341c1a28037ee32d21b589030a7df0b9fdab',
}
],
'dep_type': 'cipd',
@ -78,20 +78,9 @@ deps = {
'src/buildtools/third_party/libc++/trunk':
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxx.git@79a2e924d96e2fc1e4b937c42efd08898fa472d7',
'src/buildtools/third_party/libc++abi/trunk':
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxxabi.git@93b8dcd57bd8ebe201ec24f7257339988ed2ef7c',
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxxabi.git@e025ba5dc85202540099d7cd8e72eae2d4ee9e33',
'src/buildtools/third_party/libunwind/trunk':
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libunwind.git@d1c7f92b8b0bff8d9f710ca40e44563a63db376e',
'src/tools/clang/dsymutil': {
'packages': [
{
'package': 'chromium/llvm-build-tools/dsymutil',
'version': 'M56jPzDv1620Rnm__jTMYS62Zi8rxHVq7yw0qeBFEgkC',
}
],
'condition': 'checkout_mac',
'dep_type': 'cipd',
},
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libunwind.git@bbcbce996866ff1f947414a8d9db1e79bdc7dca2',
'src/third_party/android_system_sdk': {
'packages': [
@ -117,7 +106,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_build_tools/aapt2',
'version': 'wicn5Ce1ay6ivbZ1GNFF0gRSS3NYv_7hJTPtVga3O-QC',
'version': 'u2Cw4baoLfvlEDMwcJjq9iOJRF0_2BjsgMFl7UhJxGAC',
},
],
'condition': 'checkout_android',
@ -128,7 +117,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_build_tools/bundletool',
'version': 'LoldiQDpZ0uTdAm5EPgZ8hBJ3La2KlTWLuaRxE7eDigC',
'version': 'zQILIUnCaQ93HTtR07m4ahlE9mrkkwks52L5vFaUaUUC',
},
],
'condition': 'checkout_android',
@ -136,11 +125,11 @@ deps = {
},
'src/third_party/boringssl/src':
'https://boringssl.googlesource.com/boringssl.git@4d955d20d27bcf3ae71df091ad17d95229a7eb56',
'https://boringssl.googlesource.com/boringssl.git@27ffcc6e19bbafddf1b59ec0bc6df2904de7eb2c',
'src/third_party/breakpad/breakpad':
'https://chromium.googlesource.com/breakpad/breakpad.git@08bd844599bf04c71707e8f59a8013a941264695',
'https://chromium.googlesource.com/breakpad/breakpad.git@8b68c72a3fff2bb687c7f411e5c1c09e356b8603',
'src/third_party/catapult':
'https://chromium.googlesource.com/catapult.git@389f33bb40a3345b73a68613178c789476ceaecf',
'https://chromium.googlesource.com/catapult.git@e9e999a4a88a2963b60bec778f340d3c3d00fa1a',
'src/third_party/ced/src': {
'url': 'https://chromium.googlesource.com/external/github.com/google/compact_enc_det.git@ba412eaaacd3186085babcd901679a48863c7dd5',
},
@ -149,15 +138,15 @@ deps = {
'src/third_party/crc32c/src':
'https://chromium.googlesource.com/external/github.com/google/crc32c.git@fa5ade41ee480003d9c5af6f43567ba22e4e17e6',
'src/third_party/depot_tools':
'https://chromium.googlesource.com/chromium/tools/depot_tools.git@bc93924b3b2b84515d91ba49bb60ac0b89d928e1',
'https://chromium.googlesource.com/chromium/tools/depot_tools.git@3c6f0eb95fddb6833820d3a10e80a7a2fb5d0167',
'src/third_party/ffmpeg':
'https://chromium.googlesource.com/chromium/third_party/ffmpeg.git@574c39cce3231c69bc9a02ac475c27d944bdb113',
'https://chromium.googlesource.com/chromium/third_party/ffmpeg.git@32b2d1d52612e47531df9289e3f5fdd5447507dd',
'src/third_party/findbugs': {
'url': 'https://chromium.googlesource.com/chromium/deps/findbugs.git@4275d9ac8610db6b1bc9a5e887f97e41b33fac67',
'condition': 'checkout_android',
},
'src/third_party/grpc/src': {
'url': 'https://chromium.googlesource.com/external/github.com/grpc/grpc.git@2a0d6234cb2ccebb265c035ffd09ecc9a347b4bf',
'url': 'https://chromium.googlesource.com/external/github.com/grpc/grpc.git@ee2b75e33740d1a88c0e2aeec1b14435e17a889e',
},
# Used for embedded builds. CrOS & Linux use the system version.
'src/third_party/fontconfig/src': {
@ -165,9 +154,9 @@ deps = {
'condition': 'checkout_linux',
},
'src/third_party/freetype/src':
'https://chromium.googlesource.com/chromium/src/third_party/freetype2.git@53dfdcd8198d2b3201a23c4bad9190519ba918db',
'https://chromium.googlesource.com/chromium/src/third_party/freetype2.git@a1ca70102373fec0b98ac525885b34771c2604aa',
'src/third_party/harfbuzz-ng/src':
'https://chromium.googlesource.com/external/github.com/harfbuzz/harfbuzz.git@965cf1d66589b0db60e75961cc58f5a65521078e',
'https://chromium.googlesource.com/external/github.com/harfbuzz/harfbuzz.git@61486746d3d8937c2b656c3ba72bd666fadef76c',
'src/third_party/google_benchmark/src': {
'url': 'https://chromium.googlesource.com/external/github.com/google/benchmark.git@f730846b0a3c0dc0699978846fb14ffb2fad0bdc',
},
@ -185,9 +174,9 @@ deps = {
'dep_type': 'cipd',
},
'src/third_party/googletest/src':
'https://chromium.googlesource.com/external/github.com/google/googletest.git@b007c54f2944e193ac44fba1bc997cb65826a0b9',
'https://chromium.googlesource.com/external/github.com/google/googletest.git@af29db7ec28d6df1c7f0f745186884091e602e07',
'src/third_party/icu': {
'url': 'https://chromium.googlesource.com/chromium/deps/icu.git@a9359a84a3969b3019db7d62899afb19642eefcd',
'url': 'https://chromium.googlesource.com/chromium/deps/icu.git@1fd0dbea04448c3f73fe5cb7599f9472f0f107f1',
},
'src/third_party/jdk': {
'packages': [
@ -223,19 +212,19 @@ deps = {
'src/third_party/libsrtp':
'https://chromium.googlesource.com/chromium/deps/libsrtp.git@5b7c744eb8310250ccc534f3f86a2015b3887a0a',
'src/third_party/dav1d/libdav1d':
'https://chromium.googlesource.com/external/github.com/videolan/dav1d.git@56e7ffc0dbe44970a4d55ec2241824c67add9dd5',
'https://chromium.googlesource.com/external/github.com/videolan/dav1d.git@87f9a81cd770e49394a45deca7a3df41243de00b',
'src/third_party/libaom/source/libaom':
'https://aomedia.googlesource.com/aom.git@ee1ed1ccf2b9ecedd6aee438eafc7cc61c23342d',
'https://aomedia.googlesource.com/aom.git@e24a83a72b507b93a94f299f0eead1213dbac214',
'src/third_party/libunwindstack': {
'url': 'https://chromium.googlesource.com/chromium/src/third_party/libunwindstack.git@6868358481bb1e5e20d155c1084dc436c88b5e6b',
'condition': 'checkout_android',
},
'src/third_party/perfetto':
'https://android.googlesource.com/platform/external/perfetto.git@6dadd2c3b267bd4776762dc5c0a4acb391abbc5e',
'https://android.googlesource.com/platform/external/perfetto.git@2188b7ddcf4b4a9087e6f674ddfb84840591a608',
'src/third_party/libvpx/source/libvpx':
'https://chromium.googlesource.com/webm/libvpx.git@df0d06de6d3b64e35b9e75ad72c571af061bc7b3',
'https://chromium.googlesource.com/webm/libvpx.git@bf672f23a5336cb54dbcb2e4417142139f44cc3e',
'src/third_party/libyuv':
'https://chromium.googlesource.com/libyuv/libyuv.git@3aebf69d668177e7ee6dbbe0025e5c3dbb525ff2',
'https://chromium.googlesource.com/libyuv/libyuv.git@f4d25308467cbd50c2706a46fa0ddcef939e715a',
'src/third_party/lss': {
'url': 'https://chromium.googlesource.com/linux-syscall-support.git@92a65a8f5d705d1928874420c8d0d15bde8c89e5',
'condition': 'checkout_android or checkout_linux',
@ -280,15 +269,13 @@ deps = {
'url': 'https://chromium.googlesource.com/chromium/third_party/ub-uiautomator.git@00270549ce3161ae72ceb24712618ea28b4f9434',
'condition': 'checkout_android',
},
'src/third_party/usrsctp/usrsctplib':
'https://chromium.googlesource.com/external/github.com/sctplab/usrsctp@62d7d0c928c9a040dce96aa2f16c00e7e67d59cb',
# Dependency used by libjpeg-turbo.
'src/third_party/yasm/binaries': {
'url': 'https://chromium.googlesource.com/chromium/deps/yasm/binaries.git@52f9b3f4b0aa06da24ef8b123058bb61ee468881',
'condition': 'checkout_win',
},
'src/tools':
'https://chromium.googlesource.com/chromium/src/tools@3c7dc0d25c91195a7d9b31947b14739d57f6c728',
'https://chromium.googlesource.com/chromium/src/tools@8727552b4f5634f4f90eb43cffdd43e4c7727d47',
'src/third_party/accessibility_test_framework': {
'packages': [
@ -368,7 +355,7 @@ deps = {
},
'src/third_party/android_ndk': {
'url': 'https://chromium.googlesource.com/android_ndk.git@9644104c8cf85bf1bdce5b1c0691e9778572c3f8',
'url': 'https://chromium.googlesource.com/android_ndk.git@8388a2be5421311dc75c5f937aae13d821a27f3d',
'condition': 'checkout_android',
},
@ -470,7 +457,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/turbine',
'version': 'Go9J3Mz5ankZAgxmn5GxeXKdEDV73zaZp2ojNfGC1RQC',
'version': 'y4x80kUnDOxC5QyG48MlVoiRIEn09eaHcIJQFavlqgMC',
},
],
'condition': 'checkout_android',
@ -481,11 +468,11 @@ deps = {
'packages': [
{
'package': 'infra/tools/luci/isolate/${{platform}}',
'version': 'git_revision:cb424e70e75136736a86359ef070aa96425fe7a3',
'version': 'git_revision:6da0608e4fa8a3c6d1fa4f855485c0038b05bf72',
},
{
'package': 'infra/tools/luci/swarming/${{platform}}',
'version': 'git_revision:cb424e70e75136736a86359ef070aa96425fe7a3',
'version': 'git_revision:6da0608e4fa8a3c6d1fa4f855485c0038b05bf72',
},
],
'dep_type': 'cipd',
@ -1840,7 +1827,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/org_jetbrains_kotlin_kotlin_stdlib',
'version': 'version:2@1.6.10.cr1',
'version': 'version:2@1.6.20.cr1',
},
],
'condition': 'checkout_android',
@ -1851,7 +1838,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/org_jetbrains_kotlin_kotlin_stdlib_common',
'version': 'version:2@1.6.10.cr1',
'version': 'version:2@1.6.20.cr1',
},
],
'condition': 'checkout_android',
@ -1862,7 +1849,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/org_jetbrains_kotlin_kotlin_stdlib_jdk7',
'version': 'version:2@1.5.0.cr1',
'version': 'version:2@1.6.20.cr1',
},
],
'condition': 'checkout_android',
@ -1873,7 +1860,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/org_jetbrains_kotlin_kotlin_stdlib_jdk8',
'version': 'version:2@1.5.0.cr1',
'version': 'version:2@1.6.20.cr1',
},
],
'condition': 'checkout_android',
@ -1884,7 +1871,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/org_jetbrains_kotlinx_kotlinx_coroutines_android',
'version': 'version:2@1.5.0.cr1',
'version': 'version:2@1.6.1.cr1',
},
],
'condition': 'checkout_android',
@ -1895,7 +1882,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/org_jetbrains_kotlinx_kotlinx_coroutines_core_jvm',
'version': 'version:2@1.5.0.cr1',
'version': 'version:2@1.6.1.cr1',
},
],
'condition': 'checkout_android',
@ -2241,12 +2228,40 @@ hooks = [
'action': ['python3', 'src/build/util/lastchange.py',
'-o', 'src/build/util/LASTCHANGE'],
},
# Pull dsymutil binaries using checked-in hashes.
{
'name': 'dsymutil_mac_arm64',
'pattern': '.',
'condition': 'host_os == "mac" and host_cpu == "arm64"',
'action': [ 'python3',
'src/third_party/depot_tools/download_from_google_storage.py',
'--no_resume',
'--no_auth',
'--bucket', 'chromium-browser-clang',
'-s', 'src/tools/clang/dsymutil/bin/dsymutil.arm64.sha1',
'-o', 'src/tools/clang/dsymutil/bin/dsymutil',
],
},
{
'name': 'dsymutil_mac_x64',
'pattern': '.',
'condition': 'host_os == "mac" and host_cpu == "x64"',
'action': [ 'python3',
'src/third_party/depot_tools/download_from_google_storage.py',
'--no_resume',
'--no_auth',
'--bucket', 'chromium-browser-clang',
'-s', 'src/tools/clang/dsymutil/bin/dsymutil.x64.sha1',
'-o', 'src/tools/clang/dsymutil/bin/dsymutil',
],
},
# Pull clang-format binaries using checked-in hashes.
{
'name': 'clang_format_win',
'pattern': '.',
'condition': 'host_os == "win"',
'action': [ 'download_from_google_storage',
'action': [ 'python3',
'src/third_party/depot_tools/download_from_google_storage.py',
'--no_resume',
'--platform=win32',
'--no_auth',
@ -2255,22 +2270,38 @@ hooks = [
],
},
{
'name': 'clang_format_mac',
'name': 'clang_format_mac_x64',
'pattern': '.',
'condition': 'host_os == "mac"',
'action': [ 'download_from_google_storage',
'condition': 'host_os == "mac" and host_cpu == "x64"',
'action': [ 'python3',
'src/third_party/depot_tools/download_from_google_storage.py',
'--no_resume',
'--platform=darwin',
'--no_auth',
'--bucket', 'chromium-clang-format',
'-s', 'src/buildtools/mac/clang-format.sha1',
'-s', 'src/buildtools/mac/clang-format.x64.sha1',
'-o', 'src/buildtools/mac/clang-format',
],
},
{
'name': 'clang_format_mac_arm64',
'pattern': '.',
'condition': 'host_os == "mac" and host_cpu == "arm64"',
'action': [ 'python3',
'src/third_party/depot_tools/download_from_google_storage.py',
'--no_resume',
'--no_auth',
'--bucket', 'chromium-clang-format',
'-s', 'src/buildtools/mac/clang-format.arm64.sha1',
'-o', 'src/buildtools/mac/clang-format',
],
},
{
'name': 'clang_format_linux',
'pattern': '.',
'condition': 'host_os == "linux"',
'action': [ 'download_from_google_storage',
'action': [ 'python3',
'src/third_party/depot_tools/download_from_google_storage.py',
'--no_resume',
'--platform=linux*',
'--no_auth',

View file

@ -26,7 +26,6 @@ CPPLINT_EXCEPTIONS = [
'examples/objc',
'media/base/stream_params.h',
'media/base/video_common.h',
'media/sctp/usrsctp_transport.cc',
'modules/audio_coding',
'modules/audio_device',
'modules/audio_processing',
@ -937,8 +936,6 @@ def CommonChecks(input_api, output_api):
r'^testing[\\\/].*\.py$',
r'^third_party[\\\/].*\.py$',
r'^tools[\\\/].*\.py$',
# TODO(bugs.webrtc.org/13605): should arguably be checked.
r'^tools_webrtc[\\\/]mb[\\\/].*\.py$',
r'^xcodebuild.*[\\\/].*\.py$',
),
pylintrc='pylintrc',

View file

@ -52,10 +52,12 @@ if (!build_with_chromium) {
"../media:rtc_media_base",
"../modules/audio_device:audio_device_api",
"../modules/audio_processing:api",
"../pc:peerconnection",
"../pc:peer_connection_factory",
"../pc:webrtc_sdp",
"../rtc_base",
"../rtc_base:rtc_base_approved",
"../rtc_base:threading",
"../stats:rtc_stats",
"audio:audio_mixer_api",
"audio_codecs:audio_codecs_api",
"task_queue:default_task_queue_factory",
@ -91,6 +93,7 @@ rtc_library("rtp_packet_info") {
":refcountedbase",
":rtp_headers",
":scoped_refptr",
"../rtc_base:refcount",
"../rtc_base:rtc_base_approved",
"../rtc_base/system:rtc_export",
"units:timestamp",
@ -173,6 +176,8 @@ rtc_library("libjingle_peerconnection_api") {
":audio_options_api",
":callfactory_api",
":fec_controller_api",
":field_trials",
":field_trials_view",
":frame_transformer_interface",
":libjingle_logging_api",
":media_stream_interface",
@ -187,7 +192,10 @@ rtc_library("libjingle_peerconnection_api") {
":scoped_refptr",
":sequence_checker",
"../call:rtp_interfaces",
"../rtc_base:logging",
"../rtc_base:network_constants",
"../rtc_base:refcount",
"../rtc_base:stringutils",
"adaptation:resource_adaptation_api",
"audio:audio_mixer_api",
"audio_codecs:audio_codecs_api",
@ -202,7 +210,6 @@ rtc_library("libjingle_peerconnection_api") {
"transport:enums",
"transport:network_control",
"transport:sctp_transport_factory_interface",
"transport:webrtc_key_value_config",
"transport/rtp:rtp_source",
"units:data_rate",
"units:timestamp",
@ -593,6 +600,7 @@ rtc_library("rtc_event_log_output_file") {
deps = [
":libjingle_logging_api",
"../rtc_base:checks",
"../rtc_base:logging",
"../rtc_base:rtc_base_approved",
"../rtc_base/system:file_wrapper",
"rtc_event_log",
@ -613,6 +621,7 @@ rtc_source_set("rtc_stats_api") {
":scoped_refptr",
"../api:refcountedbase",
"../rtc_base:checks",
"../rtc_base:refcount",
"../rtc_base:rtc_base_approved",
"../rtc_base/system:rtc_export",
]
@ -658,7 +667,10 @@ rtc_source_set("bitrate_allocation") {
rtc_source_set("simulated_network_api") {
visibility = [ "*" ]
sources = [ "test/simulated_network.h" ]
deps = [ "../rtc_base" ]
deps = [
"../rtc_base",
"../rtc_base:macromagic",
]
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
}
@ -954,6 +966,7 @@ if (rtc_include_tests) {
":libjingle_peerconnection_api",
":rtp_parameters",
"../rtc_base:checks",
"../rtc_base:refcount",
"../rtc_base:rtc_base_approved",
"crypto:frame_encryptor_interface",
]
@ -971,6 +984,7 @@ if (rtc_include_tests) {
":libjingle_peerconnection_api",
":rtp_parameters",
"../rtc_base:checks",
"../rtc_base:refcount",
"../rtc_base:rtc_base_approved",
"crypto:frame_decryptor_interface",
]
@ -1154,6 +1168,7 @@ if (rtc_include_tests) {
sources = [
"array_view_unittest.cc",
"field_trials_unittest.cc",
"function_view_unittest.cc",
"rtc_error_unittest.cc",
"rtc_event_log_output_file_unittest.cc",
@ -1168,6 +1183,8 @@ if (rtc_include_tests) {
deps = [
":array_view",
":create_time_controller",
":field_trials",
":field_trials_view",
":function_view",
":libjingle_peerconnection_api",
":rtc_error",
@ -1180,12 +1197,16 @@ if (rtc_include_tests) {
"../rtc_base:checks",
"../rtc_base:gunit_helpers",
"../rtc_base:rtc_base_approved",
"../rtc_base:rtc_event",
"../rtc_base:rtc_task_queue",
"../rtc_base:task_queue_for_test",
"../rtc_base/task_utils:repeating_task",
"../system_wrappers:field_trial",
"../test:fileutils",
"../test:rtc_expect_death",
"../test:test_support",
"task_queue:task_queue_default_factory_unittests",
"transport:field_trial_based_config",
"units:time_delta",
"units:timestamp",
"units:units_unittests",
@ -1226,9 +1247,30 @@ if (rtc_include_tests) {
}
}
rtc_source_set("webrtc_key_value_config") {
rtc_source_set("field_trials_view") {
visibility = [ "*" ]
sources = [ "webrtc_key_value_config.h" ]
sources = [ "field_trials_view.h" ]
deps = [ "../rtc_base/system:rtc_export" ]
absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
}
rtc_source_set("webrtc_key_value_config") {
visibility = [ "*" ]
sources = [ "webrtc_key_value_config.h" ]
deps = [ ":field_trials_view" ]
}
rtc_library("field_trials") {
visibility = [ "*" ]
sources = [
"field_trials.cc",
"field_trials.h",
]
deps = [
":field_trials_view",
"../rtc_base:checks",
"../rtc_base/containers:flat_map",
"../system_wrappers:field_trial",
]
absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
}

View file

@ -316,6 +316,10 @@ specific_include_rules = {
"+modules/video_coding",
],
"field_trials\.h": [
"+rtc_base/containers/flat_map.h",
],
# .cc files in api/ should not be restricted in what they can #include,
# so we re-add all the top-level directories here. (That's because .h
# files leak their #includes to whoever's #including them, but .cc files

View file

@ -20,7 +20,10 @@ rtc_library("audio_frame_api") {
deps = [
"..:rtp_packet_info",
"../../rtc_base:checks",
"../../rtc_base:logging",
"../../rtc_base:macromagic",
"../../rtc_base:rtc_base_approved",
"../../rtc_base:timeutils",
]
}
@ -35,6 +38,7 @@ rtc_source_set("audio_mixer_api") {
deps = [
":audio_frame_api",
"../../rtc_base:refcount",
"../../rtc_base:rtc_base_approved",
]
}
@ -63,8 +67,10 @@ rtc_library("aec3_config_json") {
deps = [
":aec3_config",
"../../rtc_base:checks",
"../../rtc_base:logging",
"../../rtc_base:rtc_base_approved",
"../../rtc_base:rtc_json",
"../../rtc_base:stringutils",
"../../rtc_base/system:rtc_export",
]
absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]

View file

@ -236,6 +236,13 @@ struct RTC_EXPORT EchoCanceller3Config {
float floor_first_increase = 0.00001f;
bool conservative_hf_suppression = false;
} suppressor;
struct MultiChannel {
bool detect_stereo_content = true;
float stereo_detection_threshold = 0.0f;
int stereo_detection_timeout_threshold_seconds = 300;
float stereo_detection_hysteresis_seconds = 2.0f;
} multi_channel;
};
} // namespace webrtc

View file

@ -415,6 +415,17 @@ void Aec3ConfigFromJsonString(absl::string_view json_string,
ReadParam(section, "conservative_hf_suppression",
&cfg.suppressor.conservative_hf_suppression);
}
if (rtc::GetValueFromJsonObject(aec3_root, "multi_channel", &section)) {
ReadParam(section, "detect_stereo_content",
&cfg.multi_channel.detect_stereo_content);
ReadParam(section, "stereo_detection_threshold",
&cfg.multi_channel.stereo_detection_threshold);
ReadParam(section, "stereo_detection_timeout_threshold_seconds",
&cfg.multi_channel.stereo_detection_timeout_threshold_seconds);
ReadParam(section, "stereo_detection_hysteresis_seconds",
&cfg.multi_channel.stereo_detection_hysteresis_seconds);
}
}
EchoCanceller3Config Aec3ConfigFromJsonString(absl::string_view json_string) {
@ -574,7 +585,8 @@ std::string Aec3ConfigToJsonString(const EchoCanceller3Config& config) {
ost << "\"erle_onset_compensation_in_dominant_nearend\": "
<< (config.ep_strength.erle_onset_compensation_in_dominant_nearend
? "true"
: "false") << ",";
: "false")
<< ",";
ost << "\"use_conservative_tail_frequency_response\": "
<< (config.ep_strength.use_conservative_tail_frequency_response
? "true"
@ -736,7 +748,19 @@ std::string Aec3ConfigToJsonString(const EchoCanceller3Config& config) {
<< ",";
ost << "\"conservative_hf_suppression\": "
<< config.suppressor.conservative_hf_suppression;
ost << "},";
ost << "\"multi_channel\": {";
ost << "\"detect_stereo_content\": "
<< (config.multi_channel.detect_stereo_content ? "true" : "false") << ",";
ost << "\"stereo_detection_threshold\": "
<< config.multi_channel.stereo_detection_threshold << ",";
ost << "\"stereo_detection_timeout_threshold_seconds\": "
<< config.multi_channel.stereo_detection_timeout_threshold_seconds << ",";
ost << "\"stereo_detection_hysteresis_seconds\": "
<< config.multi_channel.stereo_detection_hysteresis_seconds;
ost << "}";
ost << "}";
ost << "}";

View file

@ -25,7 +25,8 @@ std::unique_ptr<EchoControl> EchoCanceller3Factory::Create(
int num_render_channels,
int num_capture_channels) {
return std::make_unique<EchoCanceller3>(
config_, sample_rate_hz, num_render_channels, num_capture_channels);
config_, /*multichannel_config=*/absl::nullopt, sample_rate_hz,
num_render_channels, num_capture_channels);
}
} // namespace webrtc

View file

@ -31,6 +31,11 @@ TEST(EchoCanceller3JsonHelpers, ToStringAndParseJson) {
cfg.suppressor.subband_nearend_detection.subband1 = {4, 5};
cfg.suppressor.subband_nearend_detection.nearend_threshold = 2.f;
cfg.suppressor.subband_nearend_detection.snr_threshold = 100.f;
cfg.multi_channel.detect_stereo_content =
!cfg.multi_channel.detect_stereo_content;
cfg.multi_channel.stereo_detection_threshold += 1.0f;
cfg.multi_channel.stereo_detection_timeout_threshold_seconds += 1;
cfg.multi_channel.stereo_detection_hysteresis_seconds += 1;
std::string json_string = Aec3ConfigToJsonString(cfg);
EchoCanceller3Config cfg_transformed = Aec3ConfigFromJsonString(json_string);
@ -75,5 +80,14 @@ TEST(EchoCanceller3JsonHelpers, ToStringAndParseJson) {
cfg_transformed.suppressor.subband_nearend_detection.nearend_threshold);
EXPECT_EQ(cfg.suppressor.subband_nearend_detection.snr_threshold,
cfg_transformed.suppressor.subband_nearend_detection.snr_threshold);
EXPECT_EQ(cfg.multi_channel.detect_stereo_content,
cfg_transformed.multi_channel.detect_stereo_content);
EXPECT_EQ(cfg.multi_channel.stereo_detection_threshold,
cfg_transformed.multi_channel.stereo_detection_threshold);
EXPECT_EQ(
cfg.multi_channel.stereo_detection_timeout_threshold_seconds,
cfg_transformed.multi_channel.stereo_detection_timeout_threshold_seconds);
EXPECT_EQ(cfg.multi_channel.stereo_detection_hysteresis_seconds,
cfg_transformed.multi_channel.stereo_detection_hysteresis_seconds);
}
} // namespace webrtc

View file

@ -32,8 +32,9 @@ rtc_library("audio_codecs_api") {
"..:array_view",
"..:bitrate_allocation",
"..:scoped_refptr",
"../../api:webrtc_key_value_config",
"../../api:field_trials_view",
"../../rtc_base:checks",
"../../rtc_base:refcount",
"../../rtc_base:rtc_base_approved",
"../../rtc_base:sanitizer",
"../../rtc_base/system:rtc_export",

View file

@ -21,10 +21,12 @@ rtc_library("audio_encoder_L16") {
]
deps = [
"..:audio_codecs_api",
"../../../api:webrtc_key_value_config",
"../../../api:field_trials_view",
"../../../modules/audio_coding:pcm16b",
"../../../rtc_base:rtc_base_approved",
"../../../rtc_base:safe_conversions",
"../../../rtc_base:safe_minmax",
"../../../rtc_base:stringutils",
"../../../rtc_base/system:rtc_export",
]
absl_deps = [
@ -42,9 +44,10 @@ rtc_library("audio_decoder_L16") {
]
deps = [
"..:audio_codecs_api",
"../../../api:webrtc_key_value_config",
"../../../api:field_trials_view",
"../../../modules/audio_coding:pcm16b",
"../../../rtc_base:rtc_base_approved",
"../../../rtc_base:safe_conversions",
"../../../rtc_base/system:rtc_export",
]
absl_deps = [

View file

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

View file

@ -18,7 +18,7 @@
#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/webrtc_key_value_config.h"
#include "api/field_trials_view.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
@ -41,7 +41,7 @@ struct RTC_EXPORT AudioDecoderL16 {
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
const Config& config,
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
const WebRtcKeyValueConfig* field_trials = nullptr);
const FieldTrialsView* field_trials = nullptr);
};
} // namespace webrtc

View file

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

View file

@ -18,7 +18,7 @@
#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/webrtc_key_value_config.h"
#include "api/field_trials_view.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
@ -46,7 +46,7 @@ struct RTC_EXPORT AudioEncoderL16 {
const Config& config,
int payload_type,
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
const WebRtcKeyValueConfig* field_trials = nullptr);
const FieldTrialsView* field_trials = nullptr);
};
} // namespace webrtc

View file

@ -15,8 +15,8 @@
#include <vector>
#include "api/audio_codecs/audio_decoder_factory.h"
#include "api/field_trials_view.h"
#include "api/scoped_refptr.h"
#include "api/webrtc_key_value_config.h"
#include "rtc_base/ref_counted_object.h"
namespace webrtc {
@ -34,7 +34,7 @@ struct Helper<> {
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
const SdpAudioFormat& format,
absl::optional<AudioCodecPairId> codec_pair_id,
const WebRtcKeyValueConfig* field_trials) {
const FieldTrialsView* field_trials) {
return nullptr;
}
};
@ -58,7 +58,7 @@ struct Helper<T, Ts...> {
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
const SdpAudioFormat& format,
absl::optional<AudioCodecPairId> codec_pair_id,
const WebRtcKeyValueConfig* field_trials) {
const FieldTrialsView* field_trials) {
auto opt_config = T::SdpToConfig(format);
return opt_config ? T::MakeAudioDecoder(*opt_config, codec_pair_id)
: Helper<Ts...>::MakeAudioDecoder(format, codec_pair_id,
@ -69,7 +69,7 @@ struct Helper<T, Ts...> {
template <typename... Ts>
class AudioDecoderFactoryT : public AudioDecoderFactory {
public:
explicit AudioDecoderFactoryT(const WebRtcKeyValueConfig* field_trials) {
explicit AudioDecoderFactoryT(const FieldTrialsView* field_trials) {
field_trials_ = field_trials;
}
@ -90,7 +90,7 @@ class AudioDecoderFactoryT : public AudioDecoderFactory {
field_trials_);
}
const WebRtcKeyValueConfig* field_trials_;
const FieldTrialsView* field_trials_;
};
} // namespace audio_decoder_factory_template_impl
@ -127,7 +127,7 @@ class AudioDecoderFactoryT : public AudioDecoderFactory {
// how it is used.
template <typename... Ts>
rtc::scoped_refptr<AudioDecoderFactory> CreateAudioDecoderFactory(
const WebRtcKeyValueConfig* field_trials = nullptr) {
const FieldTrialsView* field_trials = nullptr) {
// There's no technical reason we couldn't allow zero template parameters,
// but such a factory couldn't create any decoders, and callers can do this
// by mistake by simply forgetting the <> altogether. So we forbid it in

View file

@ -15,8 +15,8 @@
#include <vector>
#include "api/audio_codecs/audio_encoder_factory.h"
#include "api/field_trials_view.h"
#include "api/scoped_refptr.h"
#include "api/webrtc_key_value_config.h"
#include "rtc_base/ref_counted_object.h"
namespace webrtc {
@ -38,7 +38,7 @@ struct Helper<> {
int payload_type,
const SdpAudioFormat& format,
absl::optional<AudioCodecPairId> codec_pair_id,
const WebRtcKeyValueConfig* field_trials) {
const FieldTrialsView* field_trials) {
return nullptr;
}
};
@ -66,7 +66,7 @@ struct Helper<T, Ts...> {
int payload_type,
const SdpAudioFormat& format,
absl::optional<AudioCodecPairId> codec_pair_id,
const WebRtcKeyValueConfig* field_trials) {
const FieldTrialsView* field_trials) {
auto opt_config = T::SdpToConfig(format);
if (opt_config) {
return T::MakeAudioEncoder(*opt_config, payload_type, codec_pair_id);
@ -80,7 +80,7 @@ struct Helper<T, Ts...> {
template <typename... Ts>
class AudioEncoderFactoryT : public AudioEncoderFactory {
public:
explicit AudioEncoderFactoryT(const WebRtcKeyValueConfig* field_trials) {
explicit AudioEncoderFactoryT(const FieldTrialsView* field_trials) {
field_trials_ = field_trials;
}
@ -103,7 +103,7 @@ class AudioEncoderFactoryT : public AudioEncoderFactory {
field_trials_);
}
const WebRtcKeyValueConfig* field_trials_;
const FieldTrialsView* field_trials_;
};
} // namespace audio_encoder_factory_template_impl
@ -145,7 +145,7 @@ class AudioEncoderFactoryT : public AudioEncoderFactory {
// how it is used.
template <typename... Ts>
rtc::scoped_refptr<AudioEncoderFactory> CreateAudioEncoderFactory(
const WebRtcKeyValueConfig* field_trials = nullptr) {
const FieldTrialsView* field_trials = nullptr) {
// There's no technical reason we couldn't allow zero template parameters,
// but such a factory couldn't create any encoders, and callers can do this
// by mistake by simply forgetting the <> altogether. So we forbid it in

View file

@ -48,7 +48,7 @@ struct NotAdvertised {
const Config& config,
int payload_type,
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
const WebRtcKeyValueConfig* field_trials = nullptr) {
const FieldTrialsView* field_trials = nullptr) {
return T::MakeAudioEncoder(config, payload_type, codec_pair_id,
field_trials);
}

View file

@ -21,10 +21,12 @@ rtc_library("audio_encoder_g711") {
]
deps = [
"..:audio_codecs_api",
"../../../api:webrtc_key_value_config",
"../../../api:field_trials_view",
"../../../modules/audio_coding:g711",
"../../../rtc_base:rtc_base_approved",
"../../../rtc_base:safe_conversions",
"../../../rtc_base:safe_minmax",
"../../../rtc_base:stringutils",
"../../../rtc_base/system:rtc_export",
]
absl_deps = [
@ -42,9 +44,10 @@ rtc_library("audio_decoder_g711") {
]
deps = [
"..:audio_codecs_api",
"../../../api:webrtc_key_value_config",
"../../../api:field_trials_view",
"../../../modules/audio_coding:g711",
"../../../rtc_base:rtc_base_approved",
"../../../rtc_base:safe_conversions",
"../../../rtc_base/system:rtc_export",
]
absl_deps = [

View file

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

View file

@ -18,7 +18,7 @@
#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/webrtc_key_value_config.h"
#include "api/field_trials_view.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
@ -41,7 +41,7 @@ struct RTC_EXPORT AudioDecoderG711 {
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
const Config& config,
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
const WebRtcKeyValueConfig* field_trials = nullptr);
const FieldTrialsView* field_trials = nullptr);
};
} // namespace webrtc

View file

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

View file

@ -18,7 +18,7 @@
#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/webrtc_key_value_config.h"
#include "api/field_trials_view.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
@ -46,7 +46,7 @@ struct RTC_EXPORT AudioEncoderG711 {
const Config& config,
int payload_type,
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
const WebRtcKeyValueConfig* field_trials = nullptr);
const FieldTrialsView* field_trials = nullptr);
};
} // namespace webrtc

View file

@ -27,10 +27,12 @@ rtc_library("audio_encoder_g722") {
deps = [
":audio_encoder_g722_config",
"..:audio_codecs_api",
"../../../api:webrtc_key_value_config",
"../../../api:field_trials_view",
"../../../modules/audio_coding:g722",
"../../../rtc_base:rtc_base_approved",
"../../../rtc_base:safe_conversions",
"../../../rtc_base:safe_minmax",
"../../../rtc_base:stringutils",
"../../../rtc_base/system:rtc_export",
]
absl_deps = [
@ -48,9 +50,10 @@ rtc_library("audio_decoder_g722") {
]
deps = [
"..:audio_codecs_api",
"../../../api:webrtc_key_value_config",
"../../../api:field_trials_view",
"../../../modules/audio_coding:g722",
"../../../rtc_base:rtc_base_approved",
"../../../rtc_base:safe_conversions",
"../../../rtc_base/system:rtc_export",
]
absl_deps = [

View file

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

View file

@ -18,7 +18,7 @@
#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/webrtc_key_value_config.h"
#include "api/field_trials_view.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
@ -35,7 +35,7 @@ struct RTC_EXPORT AudioDecoderG722 {
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
Config config,
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
const WebRtcKeyValueConfig* field_trials = nullptr);
const FieldTrialsView* field_trials = nullptr);
};
} // namespace webrtc

View file

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

View file

@ -19,7 +19,7 @@
#include "api/audio_codecs/audio_encoder.h"
#include "api/audio_codecs/audio_format.h"
#include "api/audio_codecs/g722/audio_encoder_g722_config.h"
#include "api/webrtc_key_value_config.h"
#include "api/field_trials_view.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
@ -36,7 +36,7 @@ struct RTC_EXPORT AudioEncoderG722 {
const AudioEncoderG722Config& config,
int payload_type,
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
const WebRtcKeyValueConfig* field_trials = nullptr);
const FieldTrialsView* field_trials = nullptr);
};
} // namespace webrtc

View file

@ -27,10 +27,12 @@ rtc_library("audio_encoder_ilbc") {
deps = [
":audio_encoder_ilbc_config",
"..:audio_codecs_api",
"../../../api:webrtc_key_value_config",
"../../../api:field_trials_view",
"../../../modules/audio_coding:ilbc",
"../../../rtc_base:rtc_base_approved",
"../../../rtc_base:safe_conversions",
"../../../rtc_base:safe_minmax",
"../../../rtc_base:stringutils",
]
absl_deps = [
"//third_party/abseil-cpp/absl/strings",
@ -47,7 +49,7 @@ rtc_library("audio_decoder_ilbc") {
]
deps = [
"..:audio_codecs_api",
"../../../api:webrtc_key_value_config",
"../../../api:field_trials_view",
"../../../modules/audio_coding:ilbc",
"../../../rtc_base:rtc_base_approved",
]

View file

@ -36,7 +36,7 @@ void AudioDecoderIlbc::AppendSupportedDecoders(
std::unique_ptr<AudioDecoder> AudioDecoderIlbc::MakeAudioDecoder(
Config config,
absl::optional<AudioCodecPairId> /*codec_pair_id*/,
const WebRtcKeyValueConfig* field_trials) {
const FieldTrialsView* field_trials) {
return std::make_unique<AudioDecoderIlbcImpl>();
}

View file

@ -18,7 +18,7 @@
#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/webrtc_key_value_config.h"
#include "api/field_trials_view.h"
namespace webrtc {
@ -31,7 +31,7 @@ struct AudioDecoderIlbc {
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
Config config,
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
const WebRtcKeyValueConfig* field_trials = nullptr);
const FieldTrialsView* field_trials = nullptr);
};
} // namespace webrtc

View file

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

View file

@ -19,7 +19,7 @@
#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/webrtc_key_value_config.h"
#include "api/field_trials_view.h"
namespace webrtc {
@ -35,7 +35,7 @@ struct AudioEncoderIlbc {
const AudioEncoderIlbcConfig& config,
int payload_type,
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
const WebRtcKeyValueConfig* field_trials = nullptr);
const FieldTrialsView* field_trials = nullptr);
};
} // namespace webrtc

View file

@ -65,9 +65,10 @@ rtc_library("audio_encoder_isac_fix") {
]
deps = [
"..:audio_codecs_api",
"../../../api:webrtc_key_value_config",
"../../../api:field_trials_view",
"../../../modules/audio_coding:isac_fix",
"../../../rtc_base:rtc_base_approved",
"../../../rtc_base:stringutils",
"../../../rtc_base/system:rtc_export",
]
absl_deps = [
@ -85,7 +86,7 @@ rtc_library("audio_decoder_isac_fix") {
]
deps = [
"..:audio_codecs_api",
"../../../api:webrtc_key_value_config",
"../../../api:field_trials_view",
"../../../modules/audio_coding:isac_fix",
"../../../rtc_base:rtc_base_approved",
"../../../rtc_base/system:rtc_export",
@ -105,9 +106,10 @@ rtc_library("audio_encoder_isac_float") {
]
deps = [
"..:audio_codecs_api",
"../../../api:webrtc_key_value_config",
"../../../api:field_trials_view",
"../../../modules/audio_coding:isac",
"../../../rtc_base:rtc_base_approved",
"../../../rtc_base:stringutils",
"../../../rtc_base/system:rtc_export",
]
absl_deps = [
@ -125,7 +127,7 @@ rtc_library("audio_decoder_isac_float") {
]
deps = [
"..:audio_codecs_api",
"../../../api:webrtc_key_value_config",
"../../../api:field_trials_view",
"../../../modules/audio_coding:isac",
"../../../rtc_base:rtc_base_approved",
"../../../rtc_base/system:rtc_export",

View file

@ -35,7 +35,7 @@ void AudioDecoderIsacFix::AppendSupportedDecoders(
std::unique_ptr<AudioDecoder> AudioDecoderIsacFix::MakeAudioDecoder(
Config config,
absl::optional<AudioCodecPairId> /*codec_pair_id*/,
const WebRtcKeyValueConfig* field_trials) {
const FieldTrialsView* field_trials) {
AudioDecoderIsacFixImpl::Config c;
c.sample_rate_hz = 16000;
return std::make_unique<AudioDecoderIsacFixImpl>(c);

View file

@ -18,7 +18,7 @@
#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/webrtc_key_value_config.h"
#include "api/field_trials_view.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
@ -32,7 +32,7 @@ struct RTC_EXPORT AudioDecoderIsacFix {
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
Config config,
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
const WebRtcKeyValueConfig* field_trials = nullptr);
const FieldTrialsView* field_trials = nullptr);
};
} // namespace webrtc

View file

@ -44,7 +44,7 @@ void AudioDecoderIsacFloat::AppendSupportedDecoders(
std::unique_ptr<AudioDecoder> AudioDecoderIsacFloat::MakeAudioDecoder(
Config config,
absl::optional<AudioCodecPairId> /*codec_pair_id*/,
const WebRtcKeyValueConfig* field_trials) {
const FieldTrialsView* field_trials) {
AudioDecoderIsacFloatImpl::Config c;
c.sample_rate_hz = config.sample_rate_hz;
if (!config.IsOk()) {

View file

@ -18,7 +18,7 @@
#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/webrtc_key_value_config.h"
#include "api/field_trials_view.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
@ -37,7 +37,7 @@ struct RTC_EXPORT AudioDecoderIsacFloat {
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
Config config,
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
const WebRtcKeyValueConfig* field_trials = nullptr);
const FieldTrialsView* field_trials = nullptr);
};
} // namespace webrtc

View file

@ -58,7 +58,7 @@ std::unique_ptr<AudioEncoder> AudioEncoderIsacFix::MakeAudioEncoder(
AudioEncoderIsacFix::Config config,
int payload_type,
absl::optional<AudioCodecPairId> /*codec_pair_id*/,
const WebRtcKeyValueConfig* field_trials) {
const FieldTrialsView* field_trials) {
AudioEncoderIsacFixImpl::Config c;
c.frame_size_ms = config.frame_size_ms;
c.bit_rate = config.bit_rate;

View file

@ -18,7 +18,7 @@
#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/webrtc_key_value_config.h"
#include "api/field_trials_view.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
@ -46,7 +46,7 @@ struct RTC_EXPORT AudioEncoderIsacFix {
Config config,
int payload_type,
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
const WebRtcKeyValueConfig* field_trials = nullptr);
const FieldTrialsView* field_trials = nullptr);
};
} // namespace webrtc

View file

@ -70,7 +70,7 @@ std::unique_ptr<AudioEncoder> AudioEncoderIsacFloat::MakeAudioEncoder(
const AudioEncoderIsacFloat::Config& config,
int payload_type,
absl::optional<AudioCodecPairId> /*codec_pair_id*/,
const WebRtcKeyValueConfig* field_trials) {
const FieldTrialsView* field_trials) {
AudioEncoderIsacFloatImpl::Config c;
c.payload_type = payload_type;
c.sample_rate_hz = config.sample_rate_hz;

View file

@ -18,7 +18,7 @@
#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/webrtc_key_value_config.h"
#include "api/field_trials_view.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
@ -60,7 +60,7 @@ struct RTC_EXPORT AudioEncoderIsacFloat {
const Config& config,
int payload_type,
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
const WebRtcKeyValueConfig* field_trials = nullptr);
const FieldTrialsView* field_trials = nullptr);
};
} // namespace webrtc

View file

@ -46,7 +46,7 @@ rtc_library("audio_encoder_opus") {
deps = [
":audio_encoder_opus_config",
"..:audio_codecs_api",
"../../../api:webrtc_key_value_config",
"../../../api:field_trials_view",
"../../../modules/audio_coding:webrtc_opus",
"../../../rtc_base:rtc_base_approved",
"../../../rtc_base/system:rtc_export",
@ -66,7 +66,7 @@ rtc_library("audio_decoder_opus") {
]
deps = [
"..:audio_codecs_api",
"../../../api:webrtc_key_value_config",
"../../../api:field_trials_view",
"../../../modules/audio_coding:webrtc_opus",
"../../../rtc_base:rtc_base_approved",
"../../../rtc_base/system:rtc_export",
@ -84,7 +84,7 @@ rtc_library("audio_encoder_multiopus") {
sources = [ "audio_encoder_multi_channel_opus.cc" ]
deps = [
"..:audio_codecs_api",
"../../../api:webrtc_key_value_config",
"../../../api:field_trials_view",
"../../../modules/audio_coding:webrtc_multiopus",
"../../../rtc_base:rtc_base_approved",
"../../../rtc_base/system:rtc_export",
@ -103,7 +103,7 @@ rtc_library("audio_decoder_multiopus") {
deps = [
":audio_decoder_opus_config",
"..:audio_codecs_api",
"../../../api:webrtc_key_value_config",
"../../../api:field_trials_view",
"../../../modules/audio_coding:webrtc_multiopus",
"../../../rtc_base:rtc_base_approved",
"../../../rtc_base/system:rtc_export",

View file

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

View file

@ -19,7 +19,7 @@
#include "api/audio_codecs/audio_decoder.h"
#include "api/audio_codecs/audio_format.h"
#include "api/audio_codecs/opus/audio_decoder_multi_channel_opus_config.h"
#include "api/webrtc_key_value_config.h"
#include "api/field_trials_view.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
@ -34,7 +34,7 @@ struct RTC_EXPORT AudioDecoderMultiChannelOpus {
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
AudioDecoderMultiChannelOpusConfig config,
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
const WebRtcKeyValueConfig* field_trials = nullptr);
const FieldTrialsView* field_trials = nullptr);
};
} // namespace webrtc

View file

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

View file

@ -18,7 +18,7 @@
#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/webrtc_key_value_config.h"
#include "api/field_trials_view.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
@ -36,7 +36,7 @@ struct RTC_EXPORT AudioDecoderOpus {
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
Config config,
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
const WebRtcKeyValueConfig* field_trials = nullptr);
const FieldTrialsView* field_trials = nullptr);
};
} // namespace webrtc

View file

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

View file

@ -19,7 +19,7 @@
#include "api/audio_codecs/audio_encoder.h"
#include "api/audio_codecs/audio_format.h"
#include "api/audio_codecs/opus/audio_encoder_multi_channel_opus_config.h"
#include "api/webrtc_key_value_config.h"
#include "api/field_trials_view.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
@ -35,7 +35,7 @@ struct RTC_EXPORT AudioEncoderMultiChannelOpus {
const Config& config,
int payload_type,
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
const WebRtcKeyValueConfig* field_trials = nullptr);
const FieldTrialsView* field_trials = nullptr);
};
} // namespace webrtc

View file

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

View file

@ -19,7 +19,7 @@
#include "api/audio_codecs/audio_encoder.h"
#include "api/audio_codecs/audio_format.h"
#include "api/audio_codecs/opus/audio_encoder_opus_config.h"
#include "api/webrtc_key_value_config.h"
#include "api/field_trials_view.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
@ -36,7 +36,7 @@ struct RTC_EXPORT AudioEncoderOpus {
const AudioEncoderOpusConfig& config,
int payload_type,
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
const WebRtcKeyValueConfig* field_trials = nullptr);
const FieldTrialsView* field_trials = nullptr);
};
} // namespace webrtc

View file

@ -38,7 +38,7 @@ struct NotAdvertised {
const Config& config,
int payload_type,
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
const WebRtcKeyValueConfig* field_trials = nullptr) {
const FieldTrialsView* field_trials = nullptr) {
return T::MakeAudioEncoder(config, payload_type, codec_pair_id,
field_trials);
}

View file

@ -54,7 +54,6 @@ void AudioOptions::SetAll(const AudioOptions& change) {
change.audio_jitter_buffer_min_delay_ms);
SetFrom(&audio_jitter_buffer_enable_rtx_handling,
change.audio_jitter_buffer_enable_rtx_handling);
SetFrom(&typing_detection, change.typing_detection);
SetFrom(&residual_echo_detector, change.residual_echo_detector);
SetFrom(&combined_audio_video_bwe, change.combined_audio_video_bwe);
SetFrom(&audio_network_adaptor, change.audio_network_adaptor);
@ -78,7 +77,6 @@ bool AudioOptions::operator==(const AudioOptions& o) const {
o.audio_jitter_buffer_min_delay_ms &&
audio_jitter_buffer_enable_rtx_handling ==
o.audio_jitter_buffer_enable_rtx_handling &&
typing_detection == o.typing_detection &&
residual_echo_detector == o.residual_echo_detector &&
combined_audio_video_bwe == o.combined_audio_video_bwe &&
audio_network_adaptor == o.audio_network_adaptor &&
@ -107,7 +105,6 @@ std::string AudioOptions::ToString() const {
audio_jitter_buffer_min_delay_ms);
ToStringIfSet(&result, "audio_jitter_buffer_enable_rtx_handling",
audio_jitter_buffer_enable_rtx_handling);
ToStringIfSet(&result, "typing", typing_detection);
ToStringIfSet(&result, "residual_echo_detector", residual_echo_detector);
ToStringIfSet(&result, "combined_audio_video_bwe", combined_audio_video_bwe);
ToStringIfSet(&result, "audio_network_adaptor", audio_network_adaptor);

View file

@ -60,10 +60,6 @@ struct RTC_EXPORT AudioOptions {
absl::optional<int> audio_jitter_buffer_min_delay_ms;
// Audio receiver jitter buffer (NetEq) should handle retransmitted packets.
absl::optional<bool> audio_jitter_buffer_enable_rtx_handling;
// Deprecated.
// TODO(bugs.webrtc.org/11226): Remove.
// Audio processing to detect typing.
absl::optional<bool> typing_detection;
// TODO(bugs.webrtc.org/11539): Deprecated, replaced by
// webrtc::CreateEchoDetector() and injection when creating the audio
// processing module.

92
api/field_trials.cc Normal file
View file

@ -0,0 +1,92 @@
/*
* Copyright (c) 2020 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/field_trials.h"
#include <atomic>
#include "rtc_base/checks.h"
#include "system_wrappers/include/field_trial.h"
namespace {
// This part is copied from system_wrappers/field_trial.cc.
webrtc::flat_map<std::string, std::string> InsertIntoMap(const std::string& s) {
std::string::size_type field_start = 0;
webrtc::flat_map<std::string, std::string> key_value_map;
while (field_start < s.size()) {
std::string::size_type separator_pos = s.find('/', field_start);
RTC_CHECK_NE(separator_pos, std::string::npos)
<< "Missing separator '/' after field trial key.";
RTC_CHECK_GT(separator_pos, field_start)
<< "Field trial key cannot be empty.";
std::string key = s.substr(field_start, separator_pos - field_start);
field_start = separator_pos + 1;
RTC_CHECK_LT(field_start, s.size())
<< "Missing value after field trial key. String ended.";
separator_pos = s.find('/', field_start);
RTC_CHECK_NE(separator_pos, std::string::npos)
<< "Missing terminating '/' in field trial string.";
RTC_CHECK_GT(separator_pos, field_start)
<< "Field trial value cannot be empty.";
std::string value = s.substr(field_start, separator_pos - field_start);
field_start = separator_pos + 1;
// If a key is specified multiple times, only the value linked to the first
// key is stored. note: This will crash in debug build when calling
// InitFieldTrialsFromString().
key_value_map.emplace(key, value);
}
// This check is technically redundant due to earlier checks.
// We nevertheless keep the check to make it clear that the entire
// string has been processed, and without indexing past the end.
RTC_CHECK_EQ(field_start, s.size());
return key_value_map;
}
// Makes sure that only one instance is created, since the usage
// of global string makes behaviour unpredicatable otherwise.
// TODO(bugs.webrtc.org/10335): Remove once global string is gone.
std::atomic<bool> instance_created_{false};
} // namespace
namespace webrtc {
FieldTrials::FieldTrials(const std::string& s)
: field_trial_string_(s),
previous_field_trial_string_(webrtc::field_trial::GetFieldTrialString()),
key_value_map_(InsertIntoMap(s)) {
// TODO(bugs.webrtc.org/10335): Remove the global string!
field_trial::InitFieldTrialsFromString(field_trial_string_.c_str());
RTC_CHECK(!instance_created_.exchange(true))
<< "Only one instance may be instanciated at any given time!";
}
FieldTrials::~FieldTrials() {
// TODO(bugs.webrtc.org/10335): Remove the global string!
field_trial::InitFieldTrialsFromString(previous_field_trial_string_);
RTC_CHECK(instance_created_.exchange(false));
}
std::string FieldTrials::Lookup(absl::string_view key) const {
auto it = key_value_map_.find(std::string(key));
if (it != key_value_map_.end())
return it->second;
// Check the global string so that programs using
// a mix between FieldTrials and the global string continue to work
// TODO(bugs.webrtc.org/10335): Remove the global string!
return field_trial::FindFullName(std::string(key));
}
} // namespace webrtc

50
api/field_trials.h Normal file
View file

@ -0,0 +1,50 @@
/*
* Copyright (c) 2022 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_FIELD_TRIALS_H_
#define API_FIELD_TRIALS_H_
#include <string>
#include "absl/strings/string_view.h"
#include "api/field_trials_view.h"
#include "rtc_base/containers/flat_map.h"
namespace webrtc {
// The FieldTrials class is used to inject field trials into webrtc.
//
// Field trials allow webrtc clients (such as Chromium) to turn on feature code
// in binaries out in the field and gather information with that.
//
// They are designed to be easy to use with Chromium field trials and to speed
// up developers by reducing the need to wire up APIs to control whether a
// feature is on/off.
//
// The field trials are injected into objects that use them at creation time.
//
// NOTE: Creating multiple FieldTrials-object is currently prohibited
// until we remove the global string (TODO(bugs.webrtc.org/10335))
class FieldTrials : public FieldTrialsView {
public:
explicit FieldTrials(const std::string& s);
~FieldTrials();
std::string Lookup(absl::string_view key) const override;
private:
const std::string field_trial_string_;
const char* const previous_field_trial_string_;
const flat_map<std::string, std::string> key_value_map_;
};
} // namespace webrtc
#endif // API_FIELD_TRIALS_H_

View file

@ -0,0 +1,73 @@
/*
* Copyright 2022 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/field_trials.h"
#include "api/transport/field_trial_based_config.h"
#include "system_wrappers/include/field_trial.h"
#include "test/gtest.h"
#if GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
#include "test/testsupport/rtc_expect_death.h"
#endif // GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
namespace webrtc {
TEST(FieldTrials, EmptyString) {
FieldTrials f("");
EXPECT_FALSE(f.IsEnabled("MyCoolTrial"));
EXPECT_FALSE(f.IsDisabled("MyCoolTrial"));
}
TEST(FieldTrials, EnableDisable) {
FieldTrials f("MyCoolTrial/Enabled/MyUncoolTrial/Disabled/");
EXPECT_TRUE(f.IsEnabled("MyCoolTrial"));
EXPECT_TRUE(f.IsDisabled("MyUncoolTrial"));
}
TEST(FieldTrials, SetGlobalStringAndReadFromFieldTrial) {
const char* s = "MyCoolTrial/Enabled/MyUncoolTrial/Disabled/";
webrtc::field_trial::InitFieldTrialsFromString(s);
FieldTrialBasedConfig f;
EXPECT_TRUE(f.IsEnabled("MyCoolTrial"));
EXPECT_TRUE(f.IsDisabled("MyUncoolTrial"));
}
TEST(FieldTrials, SetFieldTrialAndReadFromGlobalString) {
FieldTrials f("MyCoolTrial/Enabled/MyUncoolTrial/Disabled/");
EXPECT_TRUE(webrtc::field_trial::IsEnabled("MyCoolTrial"));
EXPECT_TRUE(webrtc::field_trial::IsDisabled("MyUncoolTrial"));
}
TEST(FieldTrials, RestoresGlobalString) {
const char* s = "SomeString/Enabled/";
webrtc::field_trial::InitFieldTrialsFromString(s);
{
FieldTrials f("SomeOtherString/Enabled/");
EXPECT_EQ(std::string("SomeOtherString/Enabled/"),
webrtc::field_trial::GetFieldTrialString());
}
EXPECT_EQ(s, webrtc::field_trial::GetFieldTrialString());
}
#if GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
TEST(FieldTrials, OnlyOneInstance) {
FieldTrials f("SomeString/Enabled/");
RTC_EXPECT_DEATH(FieldTrials("SomeOtherString/Enabled/").Lookup("Whatever"),
"Only one instance");
}
#endif // GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
TEST(FieldTrials, SequentialInstances) {
{ FieldTrials f("SomeString/Enabled/"); }
{ FieldTrials f("SomeOtherString/Enabled/"); }
}
} // namespace webrtc

46
api/field_trials_view.h Normal file
View file

@ -0,0 +1,46 @@
/*
* Copyright 2019 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_FIELD_TRIALS_VIEW_H_
#define API_FIELD_TRIALS_VIEW_H_
#include <string>
#include "absl/strings/string_view.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
// An interface that provides a key-value mapping for configuring internal
// details of WebRTC. Note that there's no guarantess that the meaning of a
// particular key value mapping will be preserved over time and no announcements
// will be made if they are changed. It's up to the library user to ensure that
// the behavior does not break.
class RTC_EXPORT FieldTrialsView {
public:
virtual ~FieldTrialsView() = default;
// The configured value for the given key. Defaults to an empty string.
virtual std::string Lookup(absl::string_view key) const = 0;
bool IsEnabled(absl::string_view key) const {
return Lookup(key).find("Enabled") == 0;
}
bool IsDisabled(absl::string_view key) const {
return Lookup(key).find("Disabled") == 0;
}
};
// TODO(bugs.webrtc.org/10335): Remove once all migrated to
// api/field_trials_view.h
typedef FieldTrialsView WebRtcKeyValueConfig;
} // namespace webrtc
#endif // API_FIELD_TRIALS_VIEW_H_

View file

@ -27,7 +27,7 @@ class IceControllerFactoryInterface;
} // namespace cricket
namespace webrtc {
class WebRtcKeyValueConfig;
class FieldTrialsView;
// An ICE transport, as represented to the outside world.
// This object is refcounted, and is therefore alive until the
@ -84,8 +84,8 @@ struct IceTransportInit final {
return ice_controller_factory_;
}
const WebRtcKeyValueConfig* field_trials() { return field_trials_; }
void set_field_trials(const WebRtcKeyValueConfig* field_trials) {
const FieldTrialsView* field_trials() { return field_trials_; }
void set_field_trials(const FieldTrialsView* field_trials) {
field_trials_ = field_trials;
}
@ -96,7 +96,7 @@ struct IceTransportInit final {
AsyncResolverFactory* async_resolver_factory_ = nullptr;
RtcEventLog* event_log_ = nullptr;
cricket::IceControllerFactoryInterface* ice_controller_factory_ = nullptr;
const WebRtcKeyValueConfig* field_trials_ = nullptr;
const FieldTrialsView* field_trials_ = nullptr;
// TODO(https://crbug.com/webrtc/12657): Redesign to have const members.
};

View file

@ -21,6 +21,7 @@ rtc_source_set("neteq_api") {
"..:rtp_packet_info",
"..:scoped_refptr",
"../../rtc_base:rtc_base_approved",
"../../rtc_base:stringutils",
"../../system_wrappers:system_wrappers",
"../audio_codecs:audio_codecs_api",
]

View file

@ -91,6 +91,7 @@
#include "api/data_channel_interface.h"
#include "api/dtls_transport_interface.h"
#include "api/fec_controller.h"
#include "api/field_trials_view.h"
#include "api/ice_gatherer_interface.h"
#include "api/ice_transport_interface.h"
#include "api/jsep.h"
@ -118,7 +119,6 @@
#include "api/transport/enums.h"
#include "api/transport/network_control.h"
#include "api/transport/sctp_transport_factory_interface.h"
#include "api/transport/webrtc_key_value_config.h"
#include "api/turn_customizer.h"
#include "api/video/video_bitrate_allocator_factory.h"
#include "call/rtp_packet_sink_interface.h"
@ -436,8 +436,8 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
//////////////////////////////////////////////////////////////////////////
// If set to true, don't gather IPv6 ICE candidates.
// TODO(deadbeef): Remove this? IPv6 support has long stopped being
// experimental
// TODO(https://crbug.com/1315576): Remove the ability to set it in Chromium
// and delete this flag.
bool disable_ipv6 = false;
// If set to true, don't gather IPv6 ICE candidates on Wi-Fi.
@ -465,11 +465,14 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
// Use new combined audio/video bandwidth estimation?
absl::optional<bool> combined_audio_video_bwe;
#if defined(WEBRTC_FUCHSIA)
// TODO(bugs.webrtc.org/11066): Remove entirely once Fuchsia does not use.
// TODO(bugs.webrtc.org/9891) - Move to crypto_options
// Can be used to disable DTLS-SRTP. This should never be done, but can be
// useful for testing purposes, for example in setting up a loopback call
// with a single PeerConnection.
absl::optional<bool> enable_dtls_srtp;
#endif
/////////////////////////////////////////////////
// The below fields are not part of the standard.
@ -1487,7 +1490,7 @@ struct RTC_EXPORT PeerConnectionFactoryDependencies final {
std::unique_ptr<rtc::NetworkMonitorFactory> network_monitor_factory;
std::unique_ptr<NetEqFactory> neteq_factory;
std::unique_ptr<SctpTransportFactoryInterface> sctp_factory;
std::unique_ptr<WebRtcKeyValueConfig> trials;
std::unique_ptr<FieldTrialsView> trials;
std::unique_ptr<RtpTransportControllerSendFactoryInterface>
transport_controller_send_factory;
std::unique_ptr<Metronome> metronome;

View file

@ -648,9 +648,6 @@ const char* StatsReport::Value::display_name() const {
return "googTrackId";
case kStatsValueNameTimingFrameInfo:
return "googTimingFrameInfo";
// TODO(bugs.webrtc.org/11226): Remove.
case kStatsValueNameTypingNoiseState:
return "googTypingNoiseState";
case kStatsValueNameWritable:
return "googWritable";
case kStatsValueNameAudioDeviceUnderrunCounter:

View file

@ -235,8 +235,6 @@ class RTC_EXPORT StatsReport {
kStatsValueNameTrackId,
kStatsValueNameTransmitBitrate,
kStatsValueNameTransportType,
// TODO(bugs.webrtc.org/11226): Remove.
kStatsValueNameTypingNoiseState,
kStatsValueNameWritable,
kStatsValueNameAudioDeviceUnderrunCounter,
kStatsValueNameLocalCandidateRelayProtocol,

View file

@ -27,8 +27,7 @@ namespace webrtc {
// FrameDecryptorInterface. It is constructed with a simple single digit key and
// a fixed postfix byte. This is just to validate that the core code works
// as expected.
class FakeFrameDecryptor final
: public rtc::RefCountedObject<FrameDecryptorInterface> {
class FakeFrameDecryptor : public FrameDecryptorInterface {
public:
// Provide a key (0,255) and some postfix byte (0,255) this should match the
// byte you expect from the FakeFrameEncryptor.

View file

@ -25,8 +25,7 @@
namespace webrtc {
class MockPeerConnectionInterface
: public rtc::RefCountedObject<webrtc::PeerConnectionInterface> {
class MockPeerConnectionInterface : public webrtc::PeerConnectionInterface {
public:
static rtc::scoped_refptr<MockPeerConnectionInterface> Create() {
return rtc::make_ref_counted<MockPeerConnectionInterface>();
@ -211,7 +210,9 @@ class MockPeerConnectionInterface
bool(bool));
};
static_assert(!std::is_abstract<MockPeerConnectionInterface>::value, "");
static_assert(
!std::is_abstract_v<rtc::RefCountedObject<MockPeerConnectionInterface>>,
"");
} // namespace webrtc

View file

@ -19,11 +19,12 @@
namespace webrtc {
class MockRtpTransceiver final
: public rtc::RefCountedObject<RtpTransceiverInterface> {
class MockRtpTransceiver : public RtpTransceiverInterface {
public:
MockRtpTransceiver() = default;
static rtc::scoped_refptr<MockRtpTransceiver> Create() {
return rtc::scoped_refptr<MockRtpTransceiver>(new MockRtpTransceiver());
return rtc::make_ref_counted<MockRtpTransceiver>();
}
MOCK_METHOD(cricket::MediaType, media_type, (), (const, override));
@ -79,9 +80,6 @@ class MockRtpTransceiver final
(rtc::ArrayView<const RtpHeaderExtensionCapability>
header_extensions_to_offer),
(override));
private:
MockRtpTransceiver() = default;
};
} // namespace webrtc

View file

@ -19,8 +19,12 @@
namespace webrtc {
class MockRtpSender : public rtc::RefCountedObject<RtpSenderInterface> {
class MockRtpSender : public RtpSenderInterface {
public:
static rtc::scoped_refptr<MockRtpSender> Create() {
return rtc::make_ref_counted<MockRtpSender>();
}
MOCK_METHOD(bool, SetTrack, (MediaStreamTrackInterface*), (override));
MOCK_METHOD(rtc::scoped_refptr<MediaStreamTrackInterface>,
track,
@ -42,6 +46,7 @@ class MockRtpSender : public rtc::RefCountedObject<RtpSenderInterface> {
(const, override));
};
static_assert(!std::is_abstract_v<rtc::RefCountedObject<MockRtpSender>>, "");
} // namespace webrtc
#endif // API_TEST_MOCK_RTPSENDER_H_

View file

@ -431,6 +431,8 @@ class PeerConnectionE2EQualityTestFixture {
virtual PeerConfigurer* SetAecDumpPath(std::string path) = 0;
virtual PeerConfigurer* SetRTCConfiguration(
PeerConnectionInterface::RTCConfiguration configuration) = 0;
virtual PeerConfigurer* SetRTCOfferAnswerOptions(
PeerConnectionInterface::RTCOfferAnswerOptions options) = 0;
// Set bitrate parameters on PeerConnection. This constraints will be
// applied to all summed RTP streams for this peer.
virtual PeerConfigurer* SetBitrateSettings(

View file

@ -32,7 +32,7 @@ rtc_library("network_control") {
]
deps = [
":webrtc_key_value_config",
"../../api:field_trials_view",
"../rtc_event_log",
"../units:data_rate",
"../units:data_size",
@ -45,16 +45,6 @@ rtc_library("network_control") {
]
}
rtc_source_set("webrtc_key_value_config") {
visibility = [ "*" ]
sources = [ "webrtc_key_value_config.h" ]
deps = [
"../../api:webrtc_key_value_config",
"../../rtc_base/system:rtc_export",
]
absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
}
rtc_library("field_trial_based_config") {
visibility = [ "*" ]
sources = [
@ -62,7 +52,7 @@ rtc_library("field_trial_based_config") {
"field_trial_based_config.h",
]
deps = [
":webrtc_key_value_config",
"../../api:field_trials_view",
"../../system_wrappers:field_trial",
]
absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
@ -88,8 +78,8 @@ rtc_library("goog_cc") {
]
deps = [
":network_control",
":webrtc_key_value_config",
"..:network_state_predictor_api",
"../../api:field_trials_view",
"../../modules/congestion_controller/goog_cc",
]
absl_deps = [ "//third_party/abseil-cpp/absl/base:core_headers" ]
@ -111,6 +101,7 @@ rtc_source_set("stun_types") {
"../../api:array_view",
"../../rtc_base:checks",
"../../rtc_base:ip_address",
"../../rtc_base:logging",
"../../rtc_base:rtc_base",
"../../rtc_base:rtc_base_approved",
"../../rtc_base:socket_address",
@ -150,6 +141,7 @@ if (rtc_include_tests) {
deps = [
":stun_types",
"../../rtc_base",
"../../rtc_base:macromagic",
"../../rtc_base:rtc_base_approved",
"../../rtc_base:socket_address",
"../../test:test_support",

View file

@ -13,11 +13,11 @@
#include <string>
#include "absl/strings/string_view.h"
#include "api/transport/webrtc_key_value_config.h"
#include "api/field_trials_view.h"
namespace webrtc {
// Implementation using the field trial API fo the key value lookup.
class FieldTrialBasedConfig : public WebRtcKeyValueConfig {
class FieldTrialBasedConfig : public FieldTrialsView {
public:
std::string Lookup(absl::string_view key) const override;
};

View file

@ -15,9 +15,9 @@
#include <memory>
#include "absl/base/attributes.h"
#include "api/field_trials_view.h"
#include "api/rtc_event_log/rtc_event_log.h"
#include "api/transport/network_types.h"
#include "api/transport/webrtc_key_value_config.h"
namespace webrtc {
@ -46,7 +46,7 @@ struct NetworkControllerConfig {
// Optional override of configuration of WebRTC internals. Using nullptr here
// indicates that the field trial API will be used.
const WebRtcKeyValueConfig* key_value_config = nullptr;
const FieldTrialsView* key_value_config = nullptr;
// Optional override of event log.
RtcEventLog* event_log = nullptr;
};
@ -132,7 +132,7 @@ class NetworkStateEstimator {
class NetworkStateEstimatorFactory {
public:
virtual std::unique_ptr<NetworkStateEstimator> Create(
const WebRtcKeyValueConfig* key_value_config) = 0;
const FieldTrialsView* key_value_config) = 0;
virtual ~NetworkStateEstimatorFactory() = default;
};
} // namespace webrtc

View file

@ -1,17 +0,0 @@
/*
* Copyright 2019 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_TRANSPORT_WEBRTC_KEY_VALUE_CONFIG_H_
#define API_TRANSPORT_WEBRTC_KEY_VALUE_CONFIG_H_
// TODO(bugs.webrtc.org/10335): Remove once all migrated to
// "api/webrtc_key_value_config.h".
#include "api/webrtc_key_value_config.h"
#endif // API_TRANSPORT_WEBRTC_KEY_VALUE_CONFIG_H_

View file

@ -28,7 +28,10 @@ rtc_library("video_rtp_headers") {
deps = [
"..:array_view",
"../../rtc_base:logging",
"../../rtc_base:rtc_base_approved",
"../../rtc_base:safe_conversions",
"../../rtc_base:stringutils",
"../../rtc_base/system:rtc_export",
"../units:data_rate",
"../units:time_delta",
@ -44,6 +47,8 @@ rtc_library("video_frame") {
sources = [
"i420_buffer.cc",
"i420_buffer.h",
"i422_buffer.cc",
"i422_buffer.h",
"i444_buffer.cc",
"i444_buffer.h",
"nv12_buffer.cc",
@ -65,7 +70,9 @@ rtc_library("video_frame") {
"..:scoped_refptr",
"..:video_track_source_constraints",
"../../rtc_base:checks",
"../../rtc_base:refcount",
"../../rtc_base:rtc_base_approved",
"../../rtc_base:timeutils",
"../../rtc_base/memory:aligned_malloc",
"../../rtc_base/system:rtc_export",
"//third_party/libyuv",
@ -91,6 +98,7 @@ rtc_library("video_frame_i010") {
"..:scoped_refptr",
"../../rtc_base",
"../../rtc_base:checks",
"../../rtc_base:refcount",
"../../rtc_base/memory:aligned_malloc",
"//third_party/libyuv",
]
@ -136,6 +144,7 @@ rtc_library("encoded_image") {
"..:rtp_packet_info",
"..:scoped_refptr",
"../../rtc_base:checks",
"../../rtc_base:refcount",
"../../rtc_base:rtc_base_approved",
"../../rtc_base/system:rtc_export",
]
@ -267,6 +276,7 @@ rtc_library("video_stream_decoder_create") {
deps = [
":video_stream_decoder",
"../../api:field_trials_view",
"../../rtc_base:rtc_base_approved",
"../../video:video_stream_decoder_impl",
"../task_queue",

View file

@ -18,6 +18,10 @@ specific_include_rules = {
"+rtc_base/memory/aligned_malloc.h",
],
"i422_buffer\.h": [
"+rtc_base/memory/aligned_malloc.h",
],
"i444_buffer\.h": [
"+rtc_base/memory/aligned_malloc.h",
],

355
api/video/i422_buffer.cc Normal file
View file

@ -0,0 +1,355 @@
/*
* Copyright (c) 2021 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "api/video/i422_buffer.h"
#include <string.h>
#include <algorithm>
#include <utility>
#include "api/video/i420_buffer.h"
#include "rtc_base/checks.h"
#include "rtc_base/ref_counted_object.h"
#include "third_party/libyuv/include/libyuv/convert.h"
#include "third_party/libyuv/include/libyuv/planar_functions.h"
#include "third_party/libyuv/include/libyuv/scale.h"
// Aligning pointer to 64 bytes for improved performance, e.g. use SIMD.
static const int kBufferAlignment = 64;
namespace webrtc {
namespace {
int I422DataSize(int height, int stride_y, int stride_u, int stride_v) {
return stride_y * height + stride_u * height + stride_v * height;
}
// TODO(sergio.garcia.murillo@gmail.com): Remove as soon it is available in
// libyuv. Due to the rotate&scale required, this function may not be merged in
// to libyuv inmediatelly.
// https://bugs.chromium.org/p/libyuv/issues/detail?id=926
int webrtcI422Rotate(const uint8_t* src_y,
int src_stride_y,
const uint8_t* src_u,
int src_stride_u,
const uint8_t* src_v,
int src_stride_v,
uint8_t* dst_y,
int dst_stride_y,
uint8_t* dst_u,
int dst_stride_u,
uint8_t* dst_v,
int dst_stride_v,
int width,
int height,
enum libyuv::RotationMode mode) {
int halfwidth = (width + 1) >> 1;
int halfheight = (height + 1) >> 1;
if (!src_y || !src_u || !src_v || width <= 0 || height == 0 || !dst_y ||
!dst_u || !dst_v) {
return -1;
}
// Negative height means invert the image.
if (height < 0) {
height = -height;
src_y = src_y + (height - 1) * src_stride_y;
src_u = src_u + (height - 1) * src_stride_u;
src_v = src_v + (height - 1) * src_stride_v;
src_stride_y = -src_stride_y;
src_stride_u = -src_stride_u;
src_stride_v = -src_stride_v;
}
switch (mode) {
case libyuv::kRotate0:
// copy frame
libyuv::CopyPlane(src_y, src_stride_y, dst_y, dst_stride_y, width,
height);
libyuv::CopyPlane(src_u, src_stride_u, dst_u, dst_stride_u, halfwidth,
height);
libyuv::CopyPlane(src_v, src_stride_v, dst_v, dst_stride_v, halfwidth,
height);
return 0;
case libyuv::kRotate90:
// We need to rotate and rescale, we use plane Y as temporal storage.
libyuv::RotatePlane90(src_u, src_stride_u, dst_y, height, halfwidth,
height);
libyuv::ScalePlane(dst_y, height, height, halfwidth, dst_u, halfheight,
halfheight, width, libyuv::kFilterBilinear);
libyuv::RotatePlane90(src_v, src_stride_v, dst_y, height, halfwidth,
height);
libyuv::ScalePlane(dst_y, height, height, halfwidth, dst_v, halfheight,
halfheight, width, libyuv::kFilterLinear);
libyuv::RotatePlane90(src_y, src_stride_y, dst_y, dst_stride_y, width,
height);
return 0;
case libyuv::kRotate270:
// We need to rotate and rescale, we use plane Y as temporal storage.
libyuv::RotatePlane270(src_u, src_stride_u, dst_y, height, halfwidth,
height);
libyuv::ScalePlane(dst_y, height, height, halfwidth, dst_u, halfheight,
halfheight, width, libyuv::kFilterBilinear);
libyuv::RotatePlane270(src_v, src_stride_v, dst_y, height, halfwidth,
height);
libyuv::ScalePlane(dst_y, height, height, halfwidth, dst_v, halfheight,
halfheight, width, libyuv::kFilterLinear);
libyuv::RotatePlane270(src_y, src_stride_y, dst_y, dst_stride_y, width,
height);
return 0;
case libyuv::kRotate180:
libyuv::RotatePlane180(src_y, src_stride_y, dst_y, dst_stride_y, width,
height);
libyuv::RotatePlane180(src_u, src_stride_u, dst_u, dst_stride_u,
halfwidth, height);
libyuv::RotatePlane180(src_v, src_stride_v, dst_v, dst_stride_v,
halfwidth, height);
return 0;
default:
break;
}
return -1;
}
// TODO(sergio.garcia.murillo@gmail.com): Remove this function with libyuv one
// as soon as the dependency is updated.
int webrtcI422Scale(const uint8_t* src_y,
int src_stride_y,
const uint8_t* src_u,
int src_stride_u,
const uint8_t* src_v,
int src_stride_v,
int src_width,
int src_height,
uint8_t* dst_y,
int dst_stride_y,
uint8_t* dst_u,
int dst_stride_u,
uint8_t* dst_v,
int dst_stride_v,
int dst_width,
int dst_height,
enum libyuv::FilterMode filtering) {
if (!src_y || !src_u || !src_v || src_width <= 0 || src_height == 0 ||
src_width > 32768 || src_height > 32768 || !dst_y || !dst_u || !dst_v ||
dst_width <= 0 || dst_height <= 0) {
return -1;
}
int src_halfwidth = (src_width + 1) >> 1;
int dst_halfwidth = (dst_width + 1) >> 1;
libyuv::ScalePlane(src_y, src_stride_y, src_width, src_height, dst_y,
dst_stride_y, dst_width, dst_height, filtering);
libyuv::ScalePlane(src_u, src_stride_u, src_halfwidth, src_height, dst_u,
dst_stride_u, dst_halfwidth, dst_height, filtering);
libyuv::ScalePlane(src_v, src_stride_v, src_halfwidth, src_height, dst_v,
dst_stride_v, dst_halfwidth, dst_height, filtering);
return 0;
}
} // namespace
I422Buffer::I422Buffer(int width, int height)
: I422Buffer(width, height, width, (width + 1) / 2, (width + 1) / 2) {}
I422Buffer::I422Buffer(int width,
int height,
int stride_y,
int stride_u,
int stride_v)
: width_(width),
height_(height),
stride_y_(stride_y),
stride_u_(stride_u),
stride_v_(stride_v),
data_(static_cast<uint8_t*>(
AlignedMalloc(I422DataSize(height, stride_y, stride_u, stride_v),
kBufferAlignment))) {
RTC_DCHECK_GT(width, 0);
RTC_DCHECK_GT(height, 0);
RTC_DCHECK_GE(stride_y, width);
RTC_DCHECK_GE(stride_u, (width + 1) / 2);
RTC_DCHECK_GE(stride_v, (width + 1) / 2);
}
I422Buffer::~I422Buffer() {}
// static
rtc::scoped_refptr<I422Buffer> I422Buffer::Create(int width, int height) {
return rtc::make_ref_counted<I422Buffer>(width, height);
}
// static
rtc::scoped_refptr<I422Buffer> I422Buffer::Create(int width,
int height,
int stride_y,
int stride_u,
int stride_v) {
return rtc::make_ref_counted<I422Buffer>(width, height, stride_y, stride_u,
stride_v);
}
// static
rtc::scoped_refptr<I422Buffer> I422Buffer::Copy(
const I422BufferInterface& source) {
return Copy(source.width(), source.height(), source.DataY(), source.StrideY(),
source.DataU(), source.StrideU(), source.DataV(),
source.StrideV());
}
// static
rtc::scoped_refptr<I422Buffer> I422Buffer::Copy(
const I420BufferInterface& source) {
const int width = source.width();
const int height = source.height();
rtc::scoped_refptr<I422Buffer> buffer = Create(width, height);
RTC_CHECK_EQ(
0, libyuv::I420ToI422(
source.DataY(), source.StrideY(), source.DataU(), source.StrideU(),
source.DataV(), source.StrideV(), buffer->MutableDataY(),
buffer->StrideY(), buffer->MutableDataU(), buffer->StrideU(),
buffer->MutableDataV(), buffer->StrideV(), width, height));
return buffer;
}
// static
rtc::scoped_refptr<I422Buffer> I422Buffer::Copy(int width,
int height,
const uint8_t* data_y,
int stride_y,
const uint8_t* data_u,
int stride_u,
const uint8_t* data_v,
int stride_v) {
// Note: May use different strides than the input data.
rtc::scoped_refptr<I422Buffer> buffer = Create(width, height);
RTC_CHECK_EQ(0, libyuv::I422Copy(data_y, stride_y, data_u, stride_u, data_v,
stride_v, buffer->MutableDataY(),
buffer->StrideY(), buffer->MutableDataU(),
buffer->StrideU(), buffer->MutableDataV(),
buffer->StrideV(), width, height));
return buffer;
}
// static
rtc::scoped_refptr<I422Buffer> I422Buffer::Rotate(
const I422BufferInterface& src,
VideoRotation rotation) {
RTC_CHECK(src.DataY());
RTC_CHECK(src.DataU());
RTC_CHECK(src.DataV());
int rotated_width = src.width();
int rotated_height = src.height();
if (rotation == webrtc::kVideoRotation_90 ||
rotation == webrtc::kVideoRotation_270) {
std::swap(rotated_width, rotated_height);
}
rtc::scoped_refptr<webrtc::I422Buffer> buffer =
I422Buffer::Create(rotated_width, rotated_height);
RTC_CHECK_EQ(0,
webrtcI422Rotate(
src.DataY(), src.StrideY(), src.DataU(), src.StrideU(),
src.DataV(), src.StrideV(), buffer->MutableDataY(),
buffer->StrideY(), buffer->MutableDataU(), buffer->StrideU(),
buffer->MutableDataV(), buffer->StrideV(), src.width(),
src.height(), static_cast<libyuv::RotationMode>(rotation)));
return buffer;
}
rtc::scoped_refptr<I420BufferInterface> I422Buffer::ToI420() {
rtc::scoped_refptr<I420Buffer> i420_buffer =
I420Buffer::Create(width(), height());
libyuv::I422ToI420(DataY(), StrideY(), DataU(), StrideU(), DataV(), StrideV(),
i420_buffer->MutableDataY(), i420_buffer->StrideY(),
i420_buffer->MutableDataU(), i420_buffer->StrideU(),
i420_buffer->MutableDataV(), i420_buffer->StrideV(),
width(), height());
return i420_buffer;
}
void I422Buffer::InitializeData() {
memset(data_.get(), 0,
I422DataSize(height_, stride_y_, stride_u_, stride_v_));
}
int I422Buffer::width() const {
return width_;
}
int I422Buffer::height() const {
return height_;
}
const uint8_t* I422Buffer::DataY() const {
return data_.get();
}
const uint8_t* I422Buffer::DataU() const {
return data_.get() + stride_y_ * height_;
}
const uint8_t* I422Buffer::DataV() const {
return data_.get() + stride_y_ * height_ + stride_u_ * height_;
}
int I422Buffer::StrideY() const {
return stride_y_;
}
int I422Buffer::StrideU() const {
return stride_u_;
}
int I422Buffer::StrideV() const {
return stride_v_;
}
uint8_t* I422Buffer::MutableDataY() {
return const_cast<uint8_t*>(DataY());
}
uint8_t* I422Buffer::MutableDataU() {
return const_cast<uint8_t*>(DataU());
}
uint8_t* I422Buffer::MutableDataV() {
return const_cast<uint8_t*>(DataV());
}
void I422Buffer::CropAndScaleFrom(const I422BufferInterface& src,
int offset_x,
int offset_y,
int crop_width,
int crop_height) {
RTC_CHECK_LE(crop_width, src.width());
RTC_CHECK_LE(crop_height, src.height());
RTC_CHECK_LE(crop_width + offset_x, src.width());
RTC_CHECK_LE(crop_height + offset_y, src.height());
RTC_CHECK_GE(offset_x, 0);
RTC_CHECK_GE(offset_y, 0);
// Make sure offset is even so that u/v plane becomes aligned.
const int uv_offset_x = offset_x / 2;
const int uv_offset_y = offset_y;
offset_x = uv_offset_x * 2;
const uint8_t* y_plane = src.DataY() + src.StrideY() * offset_y + offset_x;
const uint8_t* u_plane =
src.DataU() + src.StrideU() * uv_offset_y + uv_offset_x;
const uint8_t* v_plane =
src.DataV() + src.StrideV() * uv_offset_y + uv_offset_x;
int res =
webrtcI422Scale(y_plane, src.StrideY(), u_plane, src.StrideU(), v_plane,
src.StrideV(), crop_width, crop_height, MutableDataY(),
StrideY(), MutableDataU(), StrideU(), MutableDataV(),
StrideV(), width(), height(), libyuv::kFilterBox);
RTC_DCHECK_EQ(res, 0);
}
} // namespace webrtc

114
api/video/i422_buffer.h Normal file
View file

@ -0,0 +1,114 @@
/*
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef API_VIDEO_I422_BUFFER_H_
#define API_VIDEO_I422_BUFFER_H_
#include <stdint.h>
#include <memory>
#include "api/scoped_refptr.h"
#include "api/video/video_frame_buffer.h"
#include "api/video/video_rotation.h"
#include "rtc_base/memory/aligned_malloc.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
// Plain I422 buffer in standard memory.
class RTC_EXPORT I422Buffer : public I422BufferInterface {
public:
static rtc::scoped_refptr<I422Buffer> Create(int width, int height);
static rtc::scoped_refptr<I422Buffer> Create(int width,
int height,
int stride_y,
int stride_u,
int stride_v);
// Create a new buffer and copy the pixel data.
static rtc::scoped_refptr<I422Buffer> Copy(const I422BufferInterface& buffer);
/// Convert and put I420 buffer into a new buffer.
static rtc::scoped_refptr<I422Buffer> Copy(const I420BufferInterface& buffer);
static rtc::scoped_refptr<I422Buffer> Copy(int width,
int height,
const uint8_t* data_y,
int stride_y,
const uint8_t* data_u,
int stride_u,
const uint8_t* data_v,
int stride_v);
// Returns a rotated copy of `src`.
static rtc::scoped_refptr<I422Buffer> Rotate(const I422BufferInterface& src,
VideoRotation rotation);
rtc::scoped_refptr<I420BufferInterface> ToI420() final;
const I420BufferInterface* GetI420() const final { return nullptr; }
// Sets the buffer to all black.
static void SetBlack(I422Buffer* buffer);
// Sets all three planes to all zeros. Used to work around for
// quirks in memory checkers
// (https://bugs.chromium.org/p/libyuv/issues/detail?id=377) and
// ffmpeg (http://crbug.com/390941).
// TODO(nisse): Deprecated. Should be deleted if/when those issues
// are resolved in a better way. Or in the mean time, use SetBlack.
void InitializeData();
int width() const override;
int height() const override;
const uint8_t* DataY() const override;
const uint8_t* DataU() const override;
const uint8_t* DataV() const override;
int StrideY() const override;
int StrideU() const override;
int StrideV() const override;
uint8_t* MutableDataY();
uint8_t* MutableDataU();
uint8_t* MutableDataV();
// Scale the cropped area of `src` to the size of `this` buffer, and
// write the result into `this`.
void CropAndScaleFrom(const I422BufferInterface& src,
int offset_x,
int offset_y,
int crop_width,
int crop_height);
// The common case of a center crop, when needed to adjust the
// aspect ratio without distorting the image.
void CropAndScaleFrom(const I422BufferInterface& src);
// Scale all of `src` to the size of `this` buffer, with no cropping.
void ScaleFrom(const I422BufferInterface& src);
protected:
I422Buffer(int width, int height);
I422Buffer(int width, int height, int stride_y, int stride_u, int stride_v);
~I422Buffer() override;
private:
const int width_;
const int height_;
const int stride_y_;
const int stride_u_;
const int stride_v_;
const std::unique_ptr<uint8_t, AlignedFreeDeleter> data_;
};
} // namespace webrtc
#endif // API_VIDEO_I422_BUFFER_H_

View file

@ -12,6 +12,7 @@ rtc_library("rtc_api_video_unittests") {
testonly = true
sources = [
"color_space_unittest.cc",
"i422_buffer_unittest.cc",
"i444_buffer_unittest.cc",
"nv12_buffer_unittest.cc",
"video_adaptation_counters_unittest.cc",

View file

@ -0,0 +1,128 @@
/*
* Copyright (c) 2022 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/video/i422_buffer.h"
#include "api/video/i420_buffer.h"
#include "test/frame_utils.h"
#include "test/gmock.h"
#include "test/gtest.h"
namespace webrtc {
namespace {
int GetY(rtc::scoped_refptr<I422BufferInterface> buf, int col, int row) {
return buf->DataY()[row * buf->StrideY() + col];
}
int GetU(rtc::scoped_refptr<I422BufferInterface> buf, int col, int row) {
return buf->DataU()[row * buf->StrideU() + col];
}
int GetV(rtc::scoped_refptr<I422BufferInterface> buf, int col, int row) {
return buf->DataV()[row * buf->StrideV() + col];
}
void FillI422Buffer(rtc::scoped_refptr<I422Buffer> buf) {
const uint8_t Y = 1;
const uint8_t U = 2;
const uint8_t V = 3;
for (int row = 0; row < buf->height(); ++row) {
for (int col = 0; col < buf->width(); ++col) {
buf->MutableDataY()[row * buf->StrideY() + col] = Y;
}
}
for (int row = 0; row < buf->ChromaHeight(); ++row) {
for (int col = 0; col < buf->ChromaWidth(); ++col) {
buf->MutableDataU()[row * buf->StrideU() + col] = U;
buf->MutableDataV()[row * buf->StrideV() + col] = V;
}
}
}
} // namespace
TEST(I422BufferTest, InitialData) {
constexpr int stride = 3;
constexpr int halfstride = (stride + 1) >> 1;
constexpr int width = 3;
constexpr int halfwidth = (width + 1) >> 1;
constexpr int height = 3;
rtc::scoped_refptr<I422Buffer> i422_buffer(I422Buffer::Create(width, height));
EXPECT_EQ(width, i422_buffer->width());
EXPECT_EQ(height, i422_buffer->height());
EXPECT_EQ(stride, i422_buffer->StrideY());
EXPECT_EQ(halfstride, i422_buffer->StrideU());
EXPECT_EQ(halfstride, i422_buffer->StrideV());
EXPECT_EQ(halfwidth, i422_buffer->ChromaWidth());
EXPECT_EQ(height, i422_buffer->ChromaHeight());
}
TEST(I422BufferTest, ReadPixels) {
constexpr int width = 3;
constexpr int halfwidth = (width + 1) >> 1;
constexpr int height = 3;
rtc::scoped_refptr<I422Buffer> i422_buffer(I422Buffer::Create(width, height));
// Y = 1, U = 2, V = 3.
FillI422Buffer(i422_buffer);
for (int row = 0; row < height; row++) {
for (int col = 0; col < width; col++) {
EXPECT_EQ(1, GetY(i422_buffer, col, row));
}
}
for (int row = 0; row < height; row++) {
for (int col = 0; col < halfwidth; col++) {
EXPECT_EQ(2, GetU(i422_buffer, col, row));
EXPECT_EQ(3, GetV(i422_buffer, col, row));
}
}
}
TEST(I422BufferTest, ToI420) {
constexpr int width = 3;
constexpr int halfwidth = (width + 1) >> 1;
constexpr int height = 3;
constexpr int size = width * height;
constexpr int halfsize = (width + 1) / 2 * height;
constexpr int quartersize = (width + 1) / 2 * (height + 1) / 2;
rtc::scoped_refptr<I420Buffer> reference(I420Buffer::Create(width, height));
memset(reference->MutableDataY(), 8, size);
memset(reference->MutableDataU(), 4, quartersize);
memset(reference->MutableDataV(), 2, quartersize);
rtc::scoped_refptr<I422Buffer> i422_buffer(I422Buffer::Create(width, height));
// Convert the reference buffer to I422.
memset(i422_buffer->MutableDataY(), 8, size);
memset(i422_buffer->MutableDataU(), 4, halfsize);
memset(i422_buffer->MutableDataV(), 2, halfsize);
// Confirm YUV values are as expected.
for (int row = 0; row < height; row++) {
for (int col = 0; col < width; col++) {
EXPECT_EQ(8, GetY(i422_buffer, col, row));
}
}
for (int row = 0; row < height; row++) {
for (int col = 0; col < halfwidth; col++) {
EXPECT_EQ(4, GetU(i422_buffer, col, row));
EXPECT_EQ(2, GetV(i422_buffer, col, row));
}
}
rtc::scoped_refptr<I420BufferInterface> i420_buffer(i422_buffer->ToI420());
EXPECT_EQ(height, i420_buffer->height());
EXPECT_EQ(width, i420_buffer->width());
EXPECT_TRUE(test::FrameBufsEqual(reference, i420_buffer));
}
} // namespace webrtc

View file

@ -11,6 +11,7 @@
#include "api/video/video_frame_buffer.h"
#include "api/video/i420_buffer.h"
#include "api/video/i422_buffer.h"
#include "api/video/i444_buffer.h"
#include "api/video/nv12_buffer.h"
#include "rtc_base/checks.h"
@ -47,6 +48,11 @@ const I444BufferInterface* VideoFrameBuffer::GetI444() const {
return static_cast<const I444BufferInterface*>(this);
}
const I422BufferInterface* VideoFrameBuffer::GetI422() const {
RTC_CHECK(type() == Type::kI422);
return static_cast<const I422BufferInterface*>(this);
}
const I010BufferInterface* VideoFrameBuffer::GetI010() const {
RTC_CHECK(type() == Type::kI010);
return static_cast<const I010BufferInterface*>(this);
@ -77,6 +83,8 @@ const char* VideoFrameBufferTypeToString(VideoFrameBuffer::Type type) {
return "kI420A";
case VideoFrameBuffer::Type::kI444:
return "kI444";
case VideoFrameBuffer::Type::kI422:
return "kI422";
case VideoFrameBuffer::Type::kI010:
return "kI010";
case VideoFrameBuffer::Type::kNV12:
@ -131,6 +139,31 @@ rtc::scoped_refptr<VideoFrameBuffer> I444BufferInterface::CropAndScale(
return result;
}
VideoFrameBuffer::Type I422BufferInterface::type() const {
return Type::kI422;
}
int I422BufferInterface::ChromaWidth() const {
return (width() + 1) / 2;
}
int I422BufferInterface::ChromaHeight() const {
return height();
}
rtc::scoped_refptr<VideoFrameBuffer> I422BufferInterface::CropAndScale(
int offset_x,
int offset_y,
int crop_width,
int crop_height,
int scaled_width,
int scaled_height) {
rtc::scoped_refptr<I422Buffer> result =
I422Buffer::Create(scaled_width, scaled_height);
result->CropAndScaleFrom(*this, offset_x, offset_y, crop_width, crop_height);
return result;
}
VideoFrameBuffer::Type I010BufferInterface::type() const {
return Type::kI010;
}

View file

@ -22,6 +22,7 @@ namespace webrtc {
class I420BufferInterface;
class I420ABufferInterface;
class I422BufferInterface;
class I444BufferInterface;
class I010BufferInterface;
class NV12BufferInterface;
@ -52,6 +53,7 @@ class RTC_EXPORT VideoFrameBuffer : public rtc::RefCountInterface {
kNative,
kI420,
kI420A,
kI422,
kI444,
kI010,
kNV12,
@ -104,6 +106,7 @@ class RTC_EXPORT VideoFrameBuffer : public rtc::RefCountInterface {
// These functions should only be called if type() is of the correct type.
// Calling with a different type will result in a crash.
const I420ABufferInterface* GetI420A() const;
const I422BufferInterface* GetI422() const;
const I444BufferInterface* GetI444() const;
const I010BufferInterface* GetI010() const;
const NV12BufferInterface* GetNV12() const;
@ -140,7 +143,7 @@ class PlanarYuvBuffer : public VideoFrameBuffer {
};
// This interface represents 8-bit color depth formats: Type::kI420,
// Type::kI420A and Type::kI444.
// Type::kI420A, Type::kI422 and Type::kI444.
class PlanarYuv8Buffer : public PlanarYuvBuffer {
public:
// Returns pointer to the pixel data for a given plane. The memory is owned by
@ -177,6 +180,26 @@ class RTC_EXPORT I420ABufferInterface : public I420BufferInterface {
~I420ABufferInterface() override {}
};
// Represents Type::kI422, 4:2:2 planar with 8 bits per pixel.
class I422BufferInterface : public PlanarYuv8Buffer {
public:
Type type() const final;
int ChromaWidth() const final;
int ChromaHeight() const final;
rtc::scoped_refptr<VideoFrameBuffer> CropAndScale(int offset_x,
int offset_y,
int crop_width,
int crop_height,
int scaled_width,
int scaled_height) override;
protected:
~I422BufferInterface() override {}
};
// Represents Type::kI444, 4:4:4 planar with 8 bits per pixel.
class I444BufferInterface : public PlanarYuv8Buffer {
public:
Type type() const final;

View file

@ -20,10 +20,13 @@ std::unique_ptr<VideoStreamDecoderInterface> CreateVideoStreamDecoder(
VideoStreamDecoderInterface::Callbacks* callbacks,
VideoDecoderFactory* decoder_factory,
TaskQueueFactory* task_queue_factory,
std::map<int, std::pair<SdpVideoFormat, int>> decoder_settings) {
return std::make_unique<VideoStreamDecoderImpl>(callbacks, decoder_factory,
task_queue_factory,
std::move(decoder_settings));
std::map<int, std::pair<SdpVideoFormat, int>> decoder_settings,
// TODO(jonaso, webrtc:10335): Consider what to do with factories
// vs. field trials.
const FieldTrialsView* field_trials) {
return std::make_unique<VideoStreamDecoderImpl>(
callbacks, decoder_factory, task_queue_factory,
std::move(decoder_settings), field_trials);
}
} // namespace webrtc

View file

@ -15,6 +15,7 @@
#include <memory>
#include <utility>
#include "api/field_trials_view.h"
#include "api/task_queue/task_queue_factory.h"
#include "api/video/video_stream_decoder.h"
#include "api/video_codecs/sdp_video_format.h"
@ -28,7 +29,8 @@ std::unique_ptr<VideoStreamDecoderInterface> CreateVideoStreamDecoder(
VideoStreamDecoderInterface::Callbacks* callbacks,
VideoDecoderFactory* decoder_factory,
TaskQueueFactory* task_queue_factory,
std::map<int, std::pair<SdpVideoFormat, int>> decoder_settings);
std::map<int, std::pair<SdpVideoFormat, int>> decoder_settings,
const FieldTrialsView* field_trials = nullptr);
} // namespace webrtc

View file

@ -46,7 +46,10 @@ rtc_library("video_codecs_api") {
"../../api:array_view",
"../../modules/video_coding:codec_globals_headers",
"../../rtc_base:checks",
"../../rtc_base:macromagic",
"../../rtc_base:refcount",
"../../rtc_base:rtc_base_approved",
"../../rtc_base:stringutils",
"../../rtc_base/system:rtc_export",
"../units:data_rate",
"../video:encoded_image",
@ -191,6 +194,7 @@ rtc_library("rtc_software_fallback_wrappers") {
"../../modules/video_coding:video_codec_interface",
"../../modules/video_coding:video_coding_utility",
"../../rtc_base:checks",
"../../rtc_base:logging",
"../../rtc_base:rtc_base_approved",
"../../rtc_base/system:rtc_export",
"../../system_wrappers:field_trial",

View file

@ -29,6 +29,7 @@ namespace webrtc {
// Video codec
enum class VideoCodecComplexity {
kComplexityLow = -1,
kComplexityNormal = 0,
kComplexityHigh = 1,
kComplexityHigher = 2,

View file

@ -83,8 +83,9 @@ VideoDecoderSoftwareFallbackWrapper::VideoDecoderSoftwareFallbackWrapper(
hw_decoder_(std::move(hw_decoder)),
fallback_decoder_(std::move(sw_fallback_decoder)),
fallback_implementation_name_(
std::string(fallback_decoder_->ImplementationName()) +
" (fallback from: " + hw_decoder_->ImplementationName() + ")"),
fallback_decoder_->GetDecoderInfo().implementation_name +
" (fallback from: " +
hw_decoder_->GetDecoderInfo().implementation_name + ")"),
callback_(nullptr),
hw_decoded_frames_since_last_fallback_(0),
hw_consequtive_generic_errors_(0) {}

View file

@ -45,6 +45,7 @@ VideoCodecVP9 VideoEncoder::GetDefaultVp9Settings() {
vp9_settings.numberOfSpatialLayers = 1;
vp9_settings.flexibleMode = false;
vp9_settings.interLayerPred = InterLayerPredMode::kOn;
vp9_settings.complexity = VideoCodecComplexity::kComplexityNormal;
return vp9_settings;
}

View file

@ -17,6 +17,7 @@
#include "absl/types/optional.h"
#include "api/units/data_rate.h"
#include "api/video/render_resolution.h"
#include "api/video_codecs/sdp_video_format.h"
namespace webrtc {
@ -47,6 +48,13 @@ class VideoEncoderFactory {
virtual absl::optional<SdpVideoFormat> OnAvailableBitrate(
const DataRate& rate) = 0;
// Called every time the encoder input resolution change. Should return a
// non-empty if an encoder switch should be performed.
virtual absl::optional<SdpVideoFormat> OnResolutionChange(
const RenderResolution& resolution) {
return absl::nullopt;
}
// Called if the currently used encoder reports itself as broken. Should
// return a non-empty if an encoder switch should be performed.
virtual absl::optional<SdpVideoFormat> OnEncoderBroken() = 0;

View file

@ -10,32 +10,8 @@
#ifndef API_WEBRTC_KEY_VALUE_CONFIG_H_
#define API_WEBRTC_KEY_VALUE_CONFIG_H_
#include <string>
#include "absl/strings/string_view.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
// An interface that provides a key-value mapping for configuring internal
// details of WebRTC. Note that there's no guarantess that the meaning of a
// particular key value mapping will be preserved over time and no announcements
// will be made if they are changed. It's up to the library user to ensure that
// the behavior does not break.
class RTC_EXPORT WebRtcKeyValueConfig {
public:
virtual ~WebRtcKeyValueConfig() = default;
// The configured value for the given key. Defaults to an empty string.
virtual std::string Lookup(absl::string_view key) const = 0;
bool IsEnabled(absl::string_view key) const {
return Lookup(key).find("Enabled") == 0;
}
bool IsDisabled(absl::string_view key) const {
return Lookup(key).find("Disabled") == 0;
}
};
} // namespace webrtc
// TODO(bugs.webrtc.org/10335): Remove once all migrated to
// api/field_trials_view.h
#include "api/field_trials_view.h"
#endif // API_WEBRTC_KEY_VALUE_CONFIG_H_

View file

@ -42,6 +42,7 @@ rtc_library("audio") {
deps = [
"../api:array_view",
"../api:call_api",
"../api:field_trials_view",
"../api:frame_transformer_interface",
"../api:function_view",
"../api:rtp_headers",
@ -49,7 +50,6 @@ rtc_library("audio") {
"../api:scoped_refptr",
"../api:sequence_checker",
"../api:transport_api",
"../api:webrtc_key_value_config",
"../api/audio:aec3_factory",
"../api/audio:audio_frame_api",
"../api/audio:audio_frame_processor",
@ -87,11 +87,18 @@ rtc_library("audio") {
"../rtc_base",
"../rtc_base:audio_format_to_string",
"../rtc_base:checks",
"../rtc_base:logging",
"../rtc_base:macromagic",
"../rtc_base:rate_limiter",
"../rtc_base:refcount",
"../rtc_base:rtc_base_approved",
"../rtc_base:rtc_event",
"../rtc_base:rtc_task_queue",
"../rtc_base:safe_conversions",
"../rtc_base:safe_minmax",
"../rtc_base:stringutils",
"../rtc_base:threading",
"../rtc_base:timeutils",
"../rtc_base/containers:flat_set",
"../rtc_base/experiments:field_trial_parser",
"../rtc_base/synchronization:mutex",
@ -179,6 +186,8 @@ if (rtc_include_tests) {
"../modules/rtp_rtcp:rtp_rtcp_format",
"../modules/utility",
"../rtc_base:checks",
"../rtc_base:macromagic",
"../rtc_base:refcount",
"../rtc_base:rtc_base_approved",
"../rtc_base:rtc_base_tests_utils",
"../rtc_base:safe_compare",
@ -284,8 +293,6 @@ if (rtc_include_tests) {
if (is_mac) {
data += [ "../tools_webrtc/audio_quality/mac/pesq" ]
}
write_runtime_deps = "${root_out_dir}/${target_name}.runtime_deps"
}
}

View file

@ -88,7 +88,7 @@ std::unique_ptr<StructParametersParser> AudioAllocationConfig::Parser() {
}
AudioAllocationConfig::AudioAllocationConfig(
const WebRtcKeyValueConfig& field_trials) {
const FieldTrialsView& field_trials) {
Parser()->Parse(field_trials.Lookup(kKey));
if (priority_bitrate_raw && !priority_bitrate.IsZero()) {
RTC_LOG(LS_WARNING) << "'priority_bitrate' and '_raw' are mutually "
@ -107,7 +107,7 @@ AudioSendStream::AudioSendStream(
RtcEventLog* event_log,
RtcpRttStats* rtcp_rtt_stats,
const absl::optional<RtpState>& suspended_rtp_state,
const WebRtcKeyValueConfig& field_trials)
const FieldTrialsView& field_trials)
: AudioSendStream(
clock,
config,
@ -142,7 +142,7 @@ AudioSendStream::AudioSendStream(
RtcEventLog* event_log,
const absl::optional<RtpState>& suspended_rtp_state,
std::unique_ptr<voe::ChannelSendInterface> channel_send,
const WebRtcKeyValueConfig& field_trials)
const FieldTrialsView& field_trials)
: clock_(clock),
field_trials_(field_trials),
rtp_transport_queue_(rtp_transport->GetWorkerQueue()),
@ -475,7 +475,6 @@ webrtc::AudioSendStream::Stats AudioSendStream::GetStats(
stats.total_input_duration = audio_level_.TotalDuration();
}
stats.typing_noise_detected = audio_state()->typing_noise_detected();
stats.ana_statistics = channel_send_->GetANAStatistics();
AudioProcessing* ap = audio_state_->audio_processing();

View file

@ -15,8 +15,8 @@
#include <utility>
#include <vector>
#include "api/field_trials_view.h"
#include "api/sequence_checker.h"
#include "api/webrtc_key_value_config.h"
#include "audio/audio_level.h"
#include "audio/channel_send.h"
#include "call/audio_send_stream.h"
@ -47,7 +47,7 @@ struct AudioAllocationConfig {
absl::optional<double> bitrate_priority;
std::unique_ptr<StructParametersParser> Parser();
explicit AudioAllocationConfig(const WebRtcKeyValueConfig& field_trials);
explicit AudioAllocationConfig(const FieldTrialsView& field_trials);
};
namespace internal {
class AudioState;
@ -64,7 +64,7 @@ class AudioSendStream final : public webrtc::AudioSendStream,
RtcEventLog* event_log,
RtcpRttStats* rtcp_rtt_stats,
const absl::optional<RtpState>& suspended_rtp_state,
const WebRtcKeyValueConfig& field_trials);
const FieldTrialsView& field_trials);
// For unit tests, which need to supply a mock ChannelSend.
AudioSendStream(Clock* clock,
const webrtc::AudioSendStream::Config& config,
@ -75,7 +75,7 @@ class AudioSendStream final : public webrtc::AudioSendStream,
RtcEventLog* event_log,
const absl::optional<RtpState>& suspended_rtp_state,
std::unique_ptr<voe::ChannelSendInterface> channel_send,
const WebRtcKeyValueConfig& field_trials);
const FieldTrialsView& field_trials);
AudioSendStream() = delete;
AudioSendStream(const AudioSendStream&) = delete;
@ -172,7 +172,7 @@ class AudioSendStream final : public webrtc::AudioSendStream,
RTC_RUN_ON(worker_thread_checker_);
Clock* clock_;
const WebRtcKeyValueConfig& field_trials_;
const FieldTrialsView& field_trials_;
SequenceChecker worker_thread_checker_;
SequenceChecker pacer_thread_checker_;

View file

@ -472,7 +472,6 @@ TEST(AudioSendStreamTest, GetStats) {
stats.apm_statistics.residual_echo_likelihood);
EXPECT_EQ(kResidualEchoLikelihoodMax,
stats.apm_statistics.residual_echo_likelihood_recent_max);
EXPECT_FALSE(stats.typing_noise_detected);
}
}
}

View file

@ -50,11 +50,6 @@ AudioTransport* AudioState::audio_transport() {
return &audio_transport_;
}
bool AudioState::typing_noise_detected() const {
RTC_DCHECK(thread_checker_.IsCurrent());
return audio_transport_.typing_noise_detected();
}
void AudioState::AddReceivingStream(webrtc::AudioReceiveStream* stream) {
RTC_DCHECK(thread_checker_.IsCurrent());
RTC_DCHECK_EQ(0, receiving_streams_.count(stream));

View file

@ -51,8 +51,6 @@ class AudioState : public webrtc::AudioState {
return config_.audio_device_module.get();
}
bool typing_noise_detected() const;
void AddReceivingStream(webrtc::AudioReceiveStream* stream);
void RemoveReceivingStream(webrtc::AudioReceiveStream* stream);

View file

@ -20,7 +20,6 @@
#include "modules/async_audio_processing/async_audio_processing.h"
#include "modules/audio_device/include/audio_device.h"
#include "modules/audio_processing/include/audio_processing.h"
#include "modules/audio_processing/typing_detection.h"
#include "rtc_base/synchronization/mutex.h"
#include "rtc_base/thread_annotations.h"
@ -86,9 +85,6 @@ class AudioTransportImpl : public AudioTransport {
int send_sample_rate_hz,
size_t send_num_channels);
void SetStereoChannelSwapping(bool enable);
// Deprecated.
// TODO(bugs.webrtc.org/11226): Remove.
bool typing_noise_detected() const { return false; }
private:
void SendProcessedData(std::unique_ptr<AudioFrame> audio_frame);
@ -107,7 +103,6 @@ class AudioTransportImpl : public AudioTransport {
size_t send_num_channels_ RTC_GUARDED_BY(capture_lock_) = 1;
bool swap_stereo_channels_ RTC_GUARDED_BY(capture_lock_) = false;
PushResampler<int16_t> capture_resampler_;
TypingDetection typing_detection_;
// Render side.

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