Merge m123/6312

This commit is contained in:
Jim Gustafson 2024-06-12 22:25:35 -07:00
commit c43adafcd5
369 changed files with 9330 additions and 5924 deletions

View file

@ -1,76 +0,0 @@
# This is a vpython "spec" file.
#
# It describes patterns for python wheel dependencies of the python scripts in
# the chromium repo, particularly for dependencies that have compiled components
# (since pure-python dependencies can be easily vendored into third_party).
#
# When vpython is invoked, it finds this file and builds a python VirtualEnv,
# containing all of the dependencies described in this file, fetching them from
# CIPD (the "Chrome Infrastructure Package Deployer" service). Unlike `pip`,
# this never requires the end-user machine to have a working python extension
# compilation environment. All of these packages are built using:
# https://chromium.googlesource.com/infra/infra/+/main/infra/tools/dockerbuild/
#
# All python scripts in the repo share this same spec, to avoid dependency
# fragmentation.
#
# If you have depot_tools installed in your $PATH, you can invoke python scripts
# in this repo by running them as you normally would run them, except
# substituting `vpython` instead of `python` on the command line, e.g.:
# vpython path/to/script.py some --arguments
#
# Read more about `vpython` and how to modify this file here:
# https://chromium.googlesource.com/infra/infra/+/main/doc/users/vpython.md
python_version: "2.7"
# Used by:
# third_party/catapult
wheel: <
name: "infra/python/wheels/psutil/${platform}_${py_python}_${py_abi}"
version: "version:5.2.2"
>
# Used by tools_webrtc/perf/process_perf_results.py.
wheel: <
name: "infra/python/wheels/httplib2-py2_py3"
version: "version:0.10.3"
>
# Used by:
# build/toolchain/win
wheel: <
name: "infra/python/wheels/pypiwin32/${vpython_platform}"
version: "version:219"
match_tag: <
platform: "win32"
>
match_tag: <
platform: "win_amd64"
>
>
wheel: <
name: "infra/python/wheels/six-py2_py3"
version: "version:1.15.0"
>
wheel: <
name: "infra/python/wheels/pbr-py2_py3"
version: "version:3.0.0"
>
wheel: <
name: "infra/python/wheels/funcsigs-py2_py3"
version: "version:1.0.2"
>
wheel: <
name: "infra/python/wheels/mock-py2_py3"
version: "version:2.0.0"
>
wheel: <
name: "infra/python/wheels/protobuf-py2_py3"
version: "version:3.13.0"
>
wheel: <
name: "infra/python/wheels/requests-py2_py3"
version: "version:2.13.0"
>

View file

@ -22,24 +22,24 @@
# Read more about `vpython` and how to modify this file here:
# https://chromium.googlesource.com/infra/infra/+/main/doc/users/vpython.md
python_version: "3.8"
python_version: "3.11"
# Used by:
# third_party/catapult
wheel: <
name: "infra/python/wheels/psutil/${vpython_platform}"
version: "version:5.8.0.chromium.2"
version: "version:5.8.0.chromium.3"
>
# Used by tools_webrtc/perf/process_perf_results.py.
wheel: <
name: "infra/python/wheels/httplib2-py3"
version: "version:0.19.1"
version: "version:0.22.0"
>
wheel: <
name: "infra/python/wheels/pyparsing-py2_py3"
version: "version:2.4.7"
name: "infra/python/wheels/pyparsing-py3"
version: "version:3.1.1"
>
@ -47,7 +47,7 @@ wheel: <
# build/toolchain/win
wheel: <
name: "infra/python/wheels/pywin32/${vpython_platform}"
version: "version:300"
version: "version:306"
match_tag: <
platform: "win32"
>
@ -59,48 +59,48 @@ wheel: <
# GRPC used by iOS test.
wheel: <
name: "infra/python/wheels/grpcio/${vpython_platform}"
version: "version:1.44.0"
version: "version:1.57.0"
>
wheel: <
name: "infra/python/wheels/six-py2_py3"
version: "version:1.15.0"
version: "version:1.16.0"
>
wheel: <
name: "infra/python/wheels/pbr-py2_py3"
version: "version:3.0.0"
version: "version:5.9.0"
>
wheel: <
name: "infra/python/wheels/funcsigs-py2_py3"
version: "version:1.0.2"
>
wheel: <
name: "infra/python/wheels/mock-py2_py3"
version: "version:2.0.0"
name: "infra/python/wheels/mock-py3"
version: "version:4.0.3"
>
wheel: <
name: "infra/python/wheels/protobuf-py3"
version: "version:3.20.0"
version: "version:4.25.1"
>
wheel: <
name: "infra/python/wheels/requests-py3"
version: "version:2.31.0"
>
wheel: <
name: "infra/python/wheels/idna-py2_py3"
version: "version:2.8"
name: "infra/python/wheels/idna-py3"
version: "version:3.4"
>
wheel: <
name: "infra/python/wheels/urllib3-py2_py3"
version: "version:1.26.6"
name: "infra/python/wheels/urllib3-py3"
version: "version:2.1.0"
>
wheel: <
name: "infra/python/wheels/certifi-py2_py3"
version: "version:2020.11.8"
name: "infra/python/wheels/certifi-py3"
version: "version:2023.11.17"
>
wheel: <
name: "infra/python/wheels/charset_normalizer-py3"
version: "version:2.0.4"
version: "version:3.3.2"
>
wheel: <
name: "infra/python/wheels/brotli/${vpython_platform}"

View file

@ -65,6 +65,7 @@ Jie Mao <maojie0924@gmail.com>
Jiwon Kim <jwkim0000@gmail.com>
Johnny Wong <hellojinqiang@gmail.com>
Jose Antonio Olivera Ortega <josea.olivera@gmail.com>
Karim Hammache <karim@karhm.com>
Keiichi Enomoto <enm10k@gmail.com>
Kiran Thind <kiran.thind@gmail.com>
Korniltsev Anatoly <korniltsev.anatoly@gmail.com>

120
DEPS
View file

@ -10,7 +10,7 @@ vars = {
# chromium waterfalls. More info at: crbug.com/570091.
'checkout_configuration': 'default',
'checkout_instrumented_libraries': 'checkout_linux and checkout_configuration == "default"',
'chromium_revision': 'e1fb84c37d20b7b85bfdd24e4ab19967ce1b77df',
'chromium_revision': 'a4279f28422a0b59acdc9fcfe7233d9f0e3b2dc6',
# Fetch the prebuilt binaries for llvm-cov and llvm-profdata. Needed to
# process the raw profiles produced by instrumented targets (built with
@ -25,7 +25,7 @@ vars = {
# By default, download the fuchsia sdk from the public sdk directory.
'fuchsia_sdk_cipd_prefix': 'fuchsia/sdk/core/',
'fuchsia_version': 'version:17.20240120.1.1',
'fuchsia_version': 'version:18.20240207.3.1',
# By default, download the fuchsia images from the fuchsia GCS bucket.
'fuchsia_images_bucket': 'fuchsia',
'checkout_fuchsia': False,
@ -40,7 +40,7 @@ vars = {
# RBE instance to use for running remote builds
'rbe_instance': 'projects/rbe-webrtc-developer/instances/default_instance',
# reclient CIPD package version
'reclient_version': 're_client_version:0.126.0.4aaef37-gomaip',
'reclient_version': 're_client_version:0.131.1.784ddbb-gomaip',
# ninja CIPD package version
# https://chrome-infra-packages.appspot.com/p/infra/3pp/tools/ninja
@ -54,30 +54,30 @@ deps = {
# TODO(kjellander): Move this to be Android-only.
'src/base':
'https://chromium.googlesource.com/chromium/src/base@36ecc8e397422620def3bb19a7ba392810ca2442',
'https://chromium.googlesource.com/chromium/src/base@fd5eca261fa03e22f053a0eaa5b010ca01c6fe51',
'src/build':
'https://chromium.googlesource.com/chromium/src/build@28cd6ea727d171ec990e6174308451d4178d7f8e',
'https://chromium.googlesource.com/chromium/src/build@a3566ffdee8a4dda521d05c378d915427d049292',
'src/buildtools':
'https://chromium.googlesource.com/chromium/src/buildtools@aadc2aa5f7382cdb5bc8e9309971356cf7722773',
'https://chromium.googlesource.com/chromium/src/buildtools@f35a7d885ace0b7dd8e8ac2376ca759d3905f4dc',
# 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@e18cc47f9334d9dcf911c724467795542a472b51',
'url': 'https://chromium.googlesource.com/chromium/src/ios@37d33be47e19e2d4450fcb9cdf6d3213d8e4ef89',
'condition': 'checkout_ios',
},
'src/testing':
'https://chromium.googlesource.com/chromium/src/testing@450bfd79ee0369ac1a5465a12820b5d94a5956be',
'https://chromium.googlesource.com/chromium/src/testing@a7e90605df75793b837bea0d56815344e28fe071',
'src/third_party':
'https://chromium.googlesource.com/chromium/src/third_party@692fab5c0074bc6fa486dce1a4aa7b2cc5609928',
'https://chromium.googlesource.com/chromium/src/third_party@121de111a913373d1ac15e4605da24fd22b21bcf',
'src/buildtools/linux64': {
'packages': [
{
'package': 'gn/gn/linux-${{arch}}',
'version': 'git_revision:f99e015ac35f689cfdbf46e4eb174e5d2da78d8e',
'version': 'git_revision:a2e2717ea670249a34b0de4b3e54f268d320bdfa',
}
],
'dep_type': 'cipd',
@ -87,7 +87,7 @@ deps = {
'packages': [
{
'package': 'gn/gn/mac-${{arch}}',
'version': 'git_revision:f99e015ac35f689cfdbf46e4eb174e5d2da78d8e',
'version': 'git_revision:a2e2717ea670249a34b0de4b3e54f268d320bdfa',
}
],
'dep_type': 'cipd',
@ -97,7 +97,7 @@ deps = {
'packages': [
{
'package': 'gn/gn/windows-amd64',
'version': 'git_revision:f99e015ac35f689cfdbf46e4eb174e5d2da78d8e',
'version': 'git_revision:a2e2717ea670249a34b0de4b3e54f268d320bdfa',
}
],
'dep_type': 'cipd',
@ -119,11 +119,11 @@ deps = {
'src/third_party/clang-format/script':
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/clang/tools/clang-format.git@e5337933f2951cacd3aeacd238ce4578163ca0b9',
'src/third_party/libc++/src':
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxx.git@28aa23ffb4c7344914a5b4ac7169f12e5a12333f',
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxx.git@9d119c1f4a097b7d27210874f4eba3fc91a83a4e',
'src/third_party/libc++abi/src':
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxxabi.git@ea028d4d2b8a901f6302f5371c68a24480766e2b',
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxxabi.git@a7b3d968a3a923886fea64b424bd770e69dc4ea4',
'src/third_party/libunwind/src':
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libunwind.git@f400fdb561d4416b59b8f8a33d8ec8b79da60495',
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libunwind.git@8bad7bd6ec30f94bce82f7cb5b58ecbd6ce02996',
'src/third_party/ninja': {
'packages': [
@ -159,7 +159,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_build_tools/aapt2',
'version': 'y1G4s2RWI63L9ZLgzS3RzFdWdeblpCmYyAUzMphcQawC',
'version': 'G1S0vNnfv3f8FD-9mH5RFSUiK-mnSwri_IdiVQKwLP0C',
},
],
'condition': 'checkout_android',
@ -189,11 +189,11 @@ deps = {
},
'src/third_party/boringssl/src':
'https://boringssl.googlesource.com/boringssl.git@414f69504d30d0848b69f6453ea7fb5e88004cb4',
'https://boringssl.googlesource.com/boringssl.git@10a2132f50aaf7d49db7e258666f447b821588d9',
'src/third_party/breakpad/breakpad':
'https://chromium.googlesource.com/breakpad/breakpad.git@62ecd463583d09eb7d15b1d410055f30b2c7bcb4',
'https://chromium.googlesource.com/breakpad/breakpad.git@6551ac3632eb7236642366f70a2eb865b87a3329',
'src/third_party/catapult':
'https://chromium.googlesource.com/catapult.git@3e413d7b62c09fda8713146714ba2146a0369d86',
'https://chromium.googlesource.com/catapult.git@c712e9cc34286f512da4300ede35957ea7c138a6',
'src/third_party/ced/src': {
'url': 'https://chromium.googlesource.com/external/github.com/google/compact_enc_det.git@ba412eaaacd3186085babcd901679a48863c7dd5',
},
@ -206,9 +206,9 @@ 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@46cb7d0aca592cd20ddc2f6cb16ee386b2abbf0d',
'https://chromium.googlesource.com/chromium/tools/depot_tools.git@f76550541c751f956ef9287f2695a6c8a74bf709',
'src/third_party/ffmpeg':
'https://chromium.googlesource.com/chromium/third_party/ffmpeg.git@17525de887d54b970ffdd421a0879c1db1952307',
'https://chromium.googlesource.com/chromium/third_party/ffmpeg.git@7c1b0b524c639beeb25363b1d0809ebe5c6efe5e',
'src/third_party/flatbuffers/src':
'https://chromium.googlesource.com/external/github.com/google/flatbuffers.git@bcb9ef187628fe07514e57756d05e6a6296f7dc5',
'src/third_party/grpc/src': {
@ -216,11 +216,11 @@ deps = {
},
# Used for embedded builds. CrOS & Linux use the system version.
'src/third_party/fontconfig/src': {
'url': 'https://chromium.googlesource.com/external/fontconfig.git@2fb3419a92156569bc1ec707401258c922cd0d99',
'url': 'https://chromium.googlesource.com/external/fontconfig.git@14d466b30a8ab4a9d789977ed94f2c30e7209267',
'condition': 'checkout_linux',
},
'src/third_party/freetype/src':
'https://chromium.googlesource.com/chromium/src/third_party/freetype2.git@57617782464411201ce7bbc93b086c1b4d7d84a5',
'https://chromium.googlesource.com/chromium/src/third_party/freetype2.git@47574f7ea445c8bb751da0fa716424c9c29a6807',
'src/third_party/harfbuzz-ng/src':
'https://chromium.googlesource.com/external/github.com/harfbuzz/harfbuzz.git@155015f4bec434ecc2f94621665844218f05ce51',
'src/third_party/google_benchmark/src': {
@ -271,7 +271,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/kotlin_stdlib',
'version': '7f5xFu_YQrbg_vacQ5mMcUFIkMPpvM_mQ8QERRKYBvUC',
'version': '-uFeIws_FQzyqmgZlGL37ooRLAD8mwClD33O8rZwnTsC',
},
],
'condition': 'checkout_android',
@ -292,7 +292,7 @@ deps = {
'src/third_party/libFuzzer/src':
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/compiler-rt/lib/fuzzer.git@758bd21f103a501b362b1ca46fa8fcb692eaa303',
'src/third_party/fuzztest/src':
'https://chromium.googlesource.com/external/github.com/google/fuzztest.git@12e7428ab0847b1d1dc6c4b89203adfd1f16a1ad',
'https://chromium.googlesource.com/external/github.com/google/fuzztest.git@61d95200e7ece7d121cab26f0c39fbf392e6566e',
'src/third_party/libjpeg_turbo':
'https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git@9b894306ec3b28cea46e84c32b56773a98c483da',
'src/third_party/libsrtp':
@ -300,17 +300,17 @@ deps = {
'src/third_party/dav1d/libdav1d':
'https://chromium.googlesource.com/external/github.com/videolan/dav1d.git@47107e384bd1dc25674acf04d000a8cdc6195234',
'src/third_party/libaom/source/libaom':
'https://aomedia.googlesource.com/aom.git@646f28605eed1076d784451faa05a4e91e46ff6e',
'https://aomedia.googlesource.com/aom.git@0cee19cfc8b69661a4c808624d36def44450f14e',
'src/third_party/libunwindstack': {
'url': 'https://chromium.googlesource.com/chromium/src/third_party/libunwindstack.git@4dbfa0e8c844c8e243b297bc185e54a99ff94f9e',
'url': 'https://chromium.googlesource.com/chromium/src/third_party/libunwindstack.git@a3bb4cd02e0e984a235069f812cbef2b37c389e5',
'condition': 'checkout_android',
},
'src/third_party/perfetto':
'https://android.googlesource.com/platform/external/perfetto.git@d6af17fef257af28ee2417216ef87d5c5b743a1b',
'https://android.googlesource.com/platform/external/perfetto.git@e01c38d714f4d55c7ef67aa9414c69479b051b38',
'src/third_party/libvpx/source/libvpx':
'https://chromium.googlesource.com/webm/libvpx.git@b95d17572629c676bdcfd535fb3990b9f6f8fb11',
'https://chromium.googlesource.com/webm/libvpx.git@96b64eaac5adbac59e43e34d87af3ba0fb06bca6',
'src/third_party/libyuv':
'https://chromium.googlesource.com/libyuv/libyuv.git@04821d1e7d60845525e8db55c7bcd41ef5be9406',
'https://chromium.googlesource.com/libyuv/libyuv.git@2f2c04c1576534a7df953c2dc7c7ccf30beacd89',
'src/third_party/lss': {
'url': 'https://chromium.googlesource.com/linux-syscall-support.git@ce877209e11aa69dcfffbd53ef90ea1d07136521',
'condition': 'checkout_android or checkout_linux',
@ -329,13 +329,13 @@ deps = {
'https://chromium.googlesource.com/external/github.com/cisco/openh264@09a4f3ec842a8932341b195c5b01e141c8a16eb7',
'src/third_party/re2/src':
'https://chromium.googlesource.com/external/github.com/google/re2.git@826ad10e58a042faf57d7c329b0fd0a04b797e0b',
'https://chromium.googlesource.com/external/github.com/google/re2.git@ab7c5918b418428ed17dbe564e0d8402bd7d743d',
'src/third_party/r8': {
'packages': [
{
'package': 'chromium/third_party/r8',
'version': 'K1NPmXz0aZCAGGtC5UESEmqwT5-x6QNNb0Jo0umsez4C',
'version': 'tp4vVuXzmyHJxDFlwxDb7RYZLLEufc3EnGTyOTCTNkgC',
},
],
'condition': 'checkout_android',
@ -359,7 +359,7 @@ deps = {
'condition': 'checkout_android',
},
'src/tools':
'https://chromium.googlesource.com/chromium/src/tools@51d5368f2225c34a47d1be4feafebba3b6d19579',
'https://chromium.googlesource.com/chromium/src/tools@2b9f1d699f313c182606ca27cdc220d9c4034577',
'src/third_party/accessibility_test_framework': {
'packages': [
@ -383,6 +383,17 @@ deps = {
'dep_type': 'cipd',
},
'src/third_party/google-java-format': {
'packages': [
{
'package': 'chromium/third_party/google-java-format',
'version': 'AQn4F5NfPAs_GKX-z3OW_Q7-yJ9N6tPrDnmnDScjkTEC',
},
],
'condition': 'checkout_android or checkout_linux',
'dep_type': 'cipd',
},
'src/third_party/hamcrest': {
'packages': [
{
@ -409,7 +420,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/androidx',
'version': 'BW2v6j8vjcVQrdX9fXmf686JtkLjxn-KCWhAE1XT_n4C',
'version': 'W2mpTbVe6yo3_GJiaoEVjCGnpicqsSrxcRMEADDJzMMC',
},
],
'condition': 'checkout_android',
@ -420,7 +431,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_build_tools/manifest_merger',
'version': 'tFbjqslkduDT_-y8WEZlsl9iulzcm3mgienslcU71poC',
'version': 'DEhOvoBwWVbV8XAI9NG-tn5g27KeMh2pXa44mY4dY10C',
},
],
'condition': 'checkout_android',
@ -502,7 +513,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/turbine',
'version': 'ABguU2WKErRBdXX1LMt0zqZListLS_05X0Rp_V7pwAYC',
'version': 's-hdujub30RR2mH9Qf7pHv6h9uNGEiYVs6W1VXWeEe8C',
},
],
'condition': 'checkout_android',
@ -513,11 +524,11 @@ deps = {
'packages': [
{
'package': 'infra/tools/luci/isolate/${{platform}}',
'version': 'git_revision:0d11be367258bfe14a13ff1afcf43a0bc6aedb45',
'version': 'git_revision:c7b026b3a6a1f877ce46a90c5f761b10e5149891',
},
{
'package': 'infra/tools/luci/swarming/${{platform}}',
'version': 'git_revision:0d11be367258bfe14a13ff1afcf43a0bc6aedb45',
'version': 'git_revision:c7b026b3a6a1f877ce46a90c5f761b10e5149891',
},
],
'dep_type': 'cipd',
@ -1872,6 +1883,28 @@ deps = {
'dep_type': 'cipd',
},
'src/third_party/android_deps/libs/org_jetbrains_kotlin_kotlin_android_extensions_runtime': {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/org_jetbrains_kotlin_kotlin_android_extensions_runtime',
'version': 'version:2@1.9.22.cr1',
},
],
'condition': 'checkout_android',
'dep_type': 'cipd',
},
'src/third_party/android_deps/libs/org_jetbrains_kotlin_kotlin_parcelize_runtime': {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/org_jetbrains_kotlin_kotlin_parcelize_runtime',
'version': 'version:2@1.9.22.cr1',
},
],
'condition': 'checkout_android',
'dep_type': 'cipd',
},
'src/third_party/android_deps/libs/org_jetbrains_kotlin_kotlin_stdlib_jdk7': {
'packages': [
{
@ -1894,6 +1927,17 @@ deps = {
'dep_type': 'cipd',
},
'src/third_party/android_deps/libs/org_jetbrains_kotlinx_atomicfu_jvm': {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/org_jetbrains_kotlinx_atomicfu_jvm',
'version': 'version:2@0.23.2.cr1',
},
],
'condition': 'checkout_android',
'dep_type': 'cipd',
},
'src/third_party/android_deps/libs/org_jetbrains_kotlinx_kotlinx_coroutines_android': {
'packages': [
{

View file

@ -1067,6 +1067,8 @@ def CommonChecks(input_api, output_api):
results.extend(
CheckNewlineAtTheEndOfProtoFiles(
input_api, output_api, source_file_filter=non_third_party_sources))
results.extend(
CheckLFNewline(input_api, output_api, non_third_party_sources))
results.extend(
CheckNoStreamUsageIsAdded(input_api, output_api,
non_third_party_sources))
@ -1322,6 +1324,20 @@ def CheckNewlineAtTheEndOfProtoFiles(input_api, output_api,
return results
def CheckLFNewline(input_api, output_api, source_file_filter):
"""Checks that all files have LF newlines."""
error_msg = 'File {} must use LF newlines.'
results = []
file_filter = lambda x: input_api.FilterSourceFile(
x, files_to_check=(r'.+', )) and source_file_filter(x)
for f in input_api.AffectedSourceFiles(file_filter):
file_path = f.LocalPath()
with open(file_path, 'rb') as f:
if b'\r\n' in f.read():
results.append(
output_api.PresubmitError(error_msg.format(file_path)))
return results
def _ExtractAddRulesFromParsedDeps(parsed_deps):
"""Extract the rules that add dependencies from a parsed DEPS file.

View file

@ -337,6 +337,8 @@ rtc_library("libjingle_peerconnection_api") {
":sequence_checker",
":turn_customizer",
"../call:rtp_interfaces",
"../p2p:connection",
"../p2p:port_allocator",
"../p2p:rtc_p2p",
"../pc:media_factory",
"../rtc_base:copy_on_write_buffer",
@ -356,6 +358,7 @@ rtc_library("libjingle_peerconnection_api") {
"neteq:neteq_api",
"rtc_event_log",
"task_queue",
"transport:bandwidth_estimation_settings",
"transport:bitrate_settings",
"transport:enums",
"transport:network_control",
@ -777,7 +780,6 @@ rtc_source_set("rtc_stats_api") {
"stats/attribute.h",
"stats/rtc_stats.h",
"stats/rtc_stats_collector_callback.h",
"stats/rtc_stats_member.h",
"stats/rtc_stats_report.h",
"stats/rtcstats_objects.h",
]
@ -939,6 +941,11 @@ rtc_library("ice_transport_factory") {
":make_ref_counted",
":packet_socket_factory",
":scoped_refptr",
"../p2p:connection",
"../p2p:ice_transport_internal",
"../p2p:p2p_constants",
"../p2p:p2p_transport_channel",
"../p2p:port_allocator",
"../p2p:rtc_p2p",
"../rtc_base:threading",
"../rtc_base/system:rtc_export",
@ -1150,6 +1157,16 @@ if (rtc_include_tests) {
]
}
rtc_library("mock_frame_transformer") {
visibility = [ "*" ]
testonly = true
sources = [ "test/mock_frame_transformer.h" ]
deps = [
":frame_transformer_interface",
"../test:test_support",
]
}
rtc_library("mock_encoder_selector") {
visibility = [ "*" ]
testonly = true
@ -1348,6 +1365,7 @@ if (rtc_include_tests) {
deps = [
"../api/video_codecs:video_codecs_api",
"../test:test_support",
"environment",
]
}
@ -1416,6 +1434,7 @@ if (rtc_include_tests) {
sources = [
"array_view_unittest.cc",
"candidate_unittest.cc",
"field_trials_unittest.cc",
"function_view_unittest.cc",
"rtc_error_unittest.cc",
@ -1431,6 +1450,7 @@ if (rtc_include_tests) {
deps = [
":array_view",
":candidate",
":create_time_controller",
":field_trials",
":field_trials_view",
@ -1444,12 +1464,14 @@ if (rtc_include_tests) {
":scoped_refptr",
":sequence_checker",
":time_controller",
"../p2p:rtc_p2p",
"../rtc_base:buffer",
"../rtc_base:checks",
"../rtc_base:gunit_helpers",
"../rtc_base:platform_thread",
"../rtc_base:rtc_event",
"../rtc_base:rtc_task_queue",
"../rtc_base:ssl",
"../rtc_base:task_queue_for_test",
"../rtc_base/containers:flat_set",
"../rtc_base/task_utils:repeating_task",

View file

@ -42,6 +42,7 @@ rtc_library("audio_codecs_api") {
"../../rtc_base:refcount",
"../../rtc_base:sanitizer",
"../../rtc_base/system:rtc_export",
"../units:data_rate",
"../units:time_delta",
]
absl_deps = [

View file

@ -20,6 +20,7 @@
#include "absl/types/optional.h"
#include "api/array_view.h"
#include "api/call/bitrate_allocation.h"
#include "api/units/data_rate.h"
#include "api/units/time_delta.h"
#include "rtc_base/buffer.h"
#include "rtc_base/logging.h"
@ -280,12 +281,20 @@ class AudioEncoder {
// Get statistics related to audio network adaptation.
virtual ANAStats GetANAStats() const;
// The range of frame lengths that are supported or nullopt if there's no sch
// information. This is used to calculated the full bitrate range, including
// overhead.
// The range of frame lengths that are supported or nullopt if there's no such
// information. This is used together with the bitrate range to calculate the
// full bitrate range, including overhead.
virtual absl::optional<std::pair<TimeDelta, TimeDelta>> GetFrameLengthRange()
const = 0;
// The range of payload bitrates that are supported. This is used together
// with the frame length range to calculate the full bitrate range, including
// overhead.
virtual absl::optional<std::pair<DataRate, DataRate>> GetBitrateRange()
const {
return absl::nullopt;
}
// The maximum number of audio channels supported by WebRTC encoders.
static constexpr int kMaxNumberOfChannels = 24;

View file

@ -10,6 +10,7 @@
#include "api/candidate.h"
#include "absl/base/attributes.h"
#include "rtc_base/helpers.h"
#include "rtc_base/ip_address.h"
#include "rtc_base/logging.h"
@ -17,15 +18,16 @@
namespace cricket {
const char LOCAL_PORT_TYPE[] = "local";
const char STUN_PORT_TYPE[] = "stun";
const char PRFLX_PORT_TYPE[] = "prflx";
const char RELAY_PORT_TYPE[] = "relay";
ABSL_CONST_INIT const absl::string_view LOCAL_PORT_TYPE = "local";
ABSL_CONST_INIT const absl::string_view STUN_PORT_TYPE = "stun";
ABSL_CONST_INIT const absl::string_view PRFLX_PORT_TYPE = "prflx";
ABSL_CONST_INIT const absl::string_view RELAY_PORT_TYPE = "relay";
Candidate::Candidate()
: id_(rtc::CreateRandomString(8)),
component_(0),
priority_(0),
type_(LOCAL_PORT_TYPE),
network_type_(rtc::ADAPTER_TYPE_UNKNOWN),
underlying_type_for_vpn_(rtc::ADAPTER_TYPE_UNKNOWN),
generation_(0),
@ -62,6 +64,10 @@ Candidate::Candidate(const Candidate&) = default;
Candidate::~Candidate() = default;
void Candidate::generate_id() {
id_ = rtc::CreateRandomString(8);
}
bool Candidate::is_local() const {
return type_ == LOCAL_PORT_TYPE;
}
@ -75,6 +81,17 @@ bool Candidate::is_relay() const {
return type_ == RELAY_PORT_TYPE;
}
absl::string_view Candidate::type_name() const {
// The LOCAL_PORT_TYPE and STUN_PORT_TYPE constants are not the standard type
// names, so check for those specifically. For other types, `type_` will have
// the correct name.
if (is_local())
return "host";
if (is_stun())
return "srflx";
return type_;
}
bool Candidate::IsEquivalent(const Candidate& c) const {
// We ignore the network name, since that is just debug information, and
// the priority and the network cost, since they should be the same if the
@ -99,9 +116,10 @@ std::string Candidate::ToStringInternal(bool sensitive) const {
std::string related_address = sensitive ? related_address_.ToSensitiveString()
: related_address_.ToString();
ost << "Cand[" << transport_name_ << ":" << foundation_ << ":" << component_
<< ":" << protocol_ << ":" << priority_ << ":" << address << ":" << type_
<< ":" << related_address << ":" << username_ << ":" << password_ << ":"
<< network_id_ << ":" << network_cost_ << ":" << generation_ << "]";
<< ":" << protocol_ << ":" << priority_ << ":" << address << ":"
<< type_name() << ":" << related_address << ":" << username_ << ":"
<< password_ << ":" << network_id_ << ":" << network_cost_ << ":"
<< generation_ << "]";
return ost.Release();
}

View file

@ -24,14 +24,18 @@
#include "rtc_base/socket_address.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
enum class IceCandidateType : int { kHost, kSrflx, kPrflx, kRelay };
} // namespace webrtc
namespace cricket {
// TODO(tommi): These are temporarily here, moved from `port.h` and will
// eventually be removed once we use enums instead of strings for these values.
RTC_EXPORT extern const char LOCAL_PORT_TYPE[];
RTC_EXPORT extern const char STUN_PORT_TYPE[];
RTC_EXPORT extern const char PRFLX_PORT_TYPE[];
RTC_EXPORT extern const char RELAY_PORT_TYPE[];
RTC_EXPORT extern const absl::string_view LOCAL_PORT_TYPE;
RTC_EXPORT extern const absl::string_view STUN_PORT_TYPE;
RTC_EXPORT extern const absl::string_view PRFLX_PORT_TYPE;
RTC_EXPORT extern const absl::string_view RELAY_PORT_TYPE;
// TURN servers are limited to 32 in accordance with
// https://w3c.github.io/webrtc-pc/#dom-rtcconfiguration-iceservers
@ -59,8 +63,12 @@ class RTC_EXPORT Candidate {
Candidate(const Candidate&);
~Candidate();
// 8 character long randomized ID string for logging purposes.
const std::string& id() const { return id_; }
void set_id(absl::string_view id) { Assign(id_, id); }
// Generates a new, 8 character long, id.
void generate_id();
// TODO(tommi): Callers should use generate_id(). Remove.
[[deprecated]] void set_id(absl::string_view id) { Assign(id_, id); }
int component() const { return component_; }
void set_component(int component) { component_ = component; }
@ -89,6 +97,10 @@ class RTC_EXPORT Candidate {
const std::string& type() const { return type_; }
// Returns the name of the candidate type as specified in
// https://datatracker.ietf.org/doc/html/rfc5245#section-15.1
absl::string_view type_name() const;
// Setting the type requires a constant string (e.g.
// cricket::LOCAL_PORT_TYPE). The type should really be an enum rather than a
// string, but until we make that change the lifetime attribute helps us lock

56
api/candidate_unittest.cc Normal file
View file

@ -0,0 +1,56 @@
/*
* Copyright 2024 The WebRTC Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "api/candidate.h"
#include <string>
#include "p2p/base/p2p_constants.h"
#include "rtc_base/gunit.h"
namespace cricket {
TEST(CandidateTest, Id) {
Candidate c;
EXPECT_EQ(c.id().size(), 8u);
std::string current_id = c.id();
// Generate a new ID.
c.generate_id();
EXPECT_EQ(c.id().size(), 8u);
EXPECT_NE(current_id, c.id());
}
TEST(CandidateTest, Component) {
Candidate c;
EXPECT_EQ(c.component(), 0);
c.set_component(ICE_CANDIDATE_COMPONENT_DEFAULT);
EXPECT_EQ(c.component(), ICE_CANDIDATE_COMPONENT_DEFAULT);
}
TEST(CandidateTest, TypeName) {
Candidate c;
// The `type_name()` property defaults to "host".
EXPECT_EQ(c.type_name(), "host");
EXPECT_EQ(c.type(), LOCAL_PORT_TYPE);
c.set_type(STUN_PORT_TYPE);
EXPECT_EQ(c.type_name(), "srflx");
EXPECT_EQ(c.type(), STUN_PORT_TYPE);
c.set_type(PRFLX_PORT_TYPE);
EXPECT_EQ(c.type_name(), "prflx");
EXPECT_EQ(c.type(), PRFLX_PORT_TYPE);
c.set_type(RELAY_PORT_TYPE);
EXPECT_EQ(c.type_name(), "relay");
EXPECT_EQ(c.type(), RELAY_PORT_TYPE);
}
} // namespace cricket

View file

@ -73,11 +73,7 @@ class TransformableAudioFrameInterface : public TransformableFrameInterface {
virtual rtc::ArrayView<const uint32_t> GetContributingSources() const = 0;
// TODO(crbug.com/1453226): Change this to pure virtual after it
// is implemented everywhere.
virtual const absl::optional<uint16_t> SequenceNumber() const {
return absl::nullopt;
}
virtual const absl::optional<uint16_t> SequenceNumber() const = 0;
virtual absl::optional<uint64_t> AbsoluteCaptureTimestamp() const = 0;

View file

@ -24,8 +24,7 @@ NetEq::Config& NetEq::Config::operator=(Config&&) = default;
std::string NetEq::Config::ToString() const {
char buf[1024];
rtc::SimpleStringBuilder ss(buf);
ss << "sample_rate_hz=" << sample_rate_hz << ", enable_post_decode_vad="
<< (enable_post_decode_vad ? "true" : "false")
ss << "sample_rate_hz=" << sample_rate_hz
<< ", max_packets_in_buffer=" << max_packets_in_buffer
<< ", min_delay_ms=" << min_delay_ms << ", enable_fast_accelerate="
<< (enable_fast_accelerate ? "true" : "false")

View file

@ -130,7 +130,6 @@ class NetEq {
std::string ToString() const;
int sample_rate_hz = 48000; // Initial value. Will change with input data.
bool enable_post_decode_vad = false;
size_t max_packets_in_buffer = 200;
int max_delay_ms = 0;
int min_delay_ms = 0;
@ -197,18 +196,17 @@ class NetEq {
// Instructs NetEq to deliver 10 ms of audio data. The data is written to
// `audio_frame`. All data in `audio_frame` is wiped; `data_`, `speech_type_`,
// `num_channels_`, `sample_rate_hz_`, `samples_per_channel_`, and
// `vad_activity_` are updated upon success. If an error is returned, some
// fields may not have been updated, or may contain inconsistent values.
// If muted state is enabled (through Config::enable_muted_state), `muted`
// may be set to true after a prolonged expand period. When this happens, the
// `data_` in `audio_frame` is not written, but should be interpreted as being
// all zeros. For testing purposes, an override can be supplied in the
// `action_override` argument, which will cause NetEq to take this action
// next, instead of the action it would normally choose. An optional output
// argument for fetching the current sample rate can be provided, which
// will return the same value as last_output_sample_rate_hz() but will avoid
// additional synchronization.
// `num_channels_`, `sample_rate_hz_` and `samples_per_channel_` are updated
// upon success. If an error is returned, some fields may not have been
// updated, or may contain inconsistent values. If muted state is enabled
// (through Config::enable_muted_state), `muted` may be set to true after a
// prolonged expand period. When this happens, the `data_` in `audio_frame`
// is not written, but should be interpreted as being all zeros. For testing
// purposes, an override can be supplied in the `action_override` argument,
// which will cause NetEq to take this action next, instead of the action it
// would normally choose. An optional output argument for fetching the current
// sample rate can be provided, which will return the same value as
// last_output_sample_rate_hz() but will avoid additional synchronization.
// Returns kOK on success, or kFail in case of an error.
virtual int GetAudio(
AudioFrame* audio_frame,
@ -278,13 +276,6 @@ class NetEq {
// statistics are never reset.
virtual NetEqOperationsAndState GetOperationsAndState() const = 0;
// Enables post-decode VAD. When enabled, GetAudio() will return
// kOutputVADPassive when the signal contains no speech.
virtual void EnableVad() = 0;
// Disables post-decode VAD.
virtual void DisableVad() = 0;
// Returns the RTP timestamp for the last sample delivered by GetAudio().
// The return value will be empty if no valid timestamp is available.
virtual absl::optional<uint32_t> GetPlayoutTimestamp() const = 0;

View file

@ -113,6 +113,7 @@
#include "api/set_remote_description_observer_interface.h"
#include "api/stats/rtc_stats_collector_callback.h"
#include "api/task_queue/task_queue_factory.h"
#include "api/transport/bandwidth_estimation_settings.h"
#include "api/transport/bitrate_settings.h"
#include "api/transport/enums.h"
#include "api/transport/network_control.h"
@ -468,15 +469,6 @@ class RTC_EXPORT PeerConnectionInterface : public webrtc::RefCountInterface {
// when switching from a static scene to one with motion.
absl::optional<int> screencast_min_bitrate;
#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.
/////////////////////////////////////////////////
@ -1202,6 +1194,13 @@ class RTC_EXPORT PeerConnectionInterface : public webrtc::RefCountInterface {
// to the provided value.
virtual RTCError SetBitrate(const BitrateSettings& bitrate) = 0;
// Allows an application to reconfigure bandwidth estimation.
// The method can be called both before and after estimation has started.
// Estimation starts when the first RTP packet is sent.
// Estimation will be restarted if already started.
virtual void ReconfigureBandwidthEstimation(
const BandwidthEstimationSettings& settings) {}
// Enable/disable playout of received audio streams. Enabled by default. Note
// that even if playout is enabled, streams will only be played out if the
// appropriate SDP is also applied. Setting `playout` to false will stop

View file

@ -34,7 +34,8 @@ class RtcEventLogOutputFileTest : public ::testing::Test {
protected:
std::string GetOutputFilePath() const {
auto test_info = ::testing::UnitTest::GetInstance()->current_test_info();
return test::OutputPath() + test_info->test_case_name() + test_info->name();
return test::OutputPathWithRandomDirectory() + test_info->test_case_name() +
test_info->name();
}
std::string GetOutputFileContents() const {

View file

@ -16,37 +16,38 @@
#include <string>
#include <vector>
#include "absl/types/optional.h"
#include "absl/types/variant.h"
#include "api/stats/rtc_stats_member.h"
#include "rtc_base/checks.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
// A light-weight wrapper of an RTCStats attribute (an individual metric).
// A light-weight wrapper of an RTCStats attribute, i.e. an individual metric of
// type absl::optional<T>.
class RTC_EXPORT Attribute {
public:
// TODO(https://crbug.com/webrtc/15164): Replace uses of RTCStatsMember<T>
// with absl::optional<T> and update these pointer types.
typedef absl::variant<const RTCStatsMember<bool>*,
const RTCStatsMember<int32_t>*,
const RTCStatsMember<uint32_t>*,
const RTCStatsMember<int64_t>*,
const RTCStatsMember<uint64_t>*,
const RTCStatsMember<double>*,
const RTCStatsMember<std::string>*,
const RTCStatsMember<std::vector<bool>>*,
const RTCStatsMember<std::vector<int32_t>>*,
const RTCStatsMember<std::vector<uint32_t>>*,
const RTCStatsMember<std::vector<int64_t>>*,
const RTCStatsMember<std::vector<uint64_t>>*,
const RTCStatsMember<std::vector<double>>*,
const RTCStatsMember<std::vector<std::string>>*,
const RTCStatsMember<std::map<std::string, uint64_t>>*,
const RTCStatsMember<std::map<std::string, double>>*>
// All supported attribute types.
typedef absl::variant<const absl::optional<bool>*,
const absl::optional<int32_t>*,
const absl::optional<uint32_t>*,
const absl::optional<int64_t>*,
const absl::optional<uint64_t>*,
const absl::optional<double>*,
const absl::optional<std::string>*,
const absl::optional<std::vector<bool>>*,
const absl::optional<std::vector<int32_t>>*,
const absl::optional<std::vector<uint32_t>>*,
const absl::optional<std::vector<int64_t>>*,
const absl::optional<std::vector<uint64_t>>*,
const absl::optional<std::vector<double>>*,
const absl::optional<std::vector<std::string>>*,
const absl::optional<std::map<std::string, uint64_t>>*,
const absl::optional<std::map<std::string, double>>*>
StatVariant;
template <typename T>
explicit Attribute(const char* name, const RTCStatsMember<T>* attribute)
Attribute(const char* name, const absl::optional<T>* attribute)
: name_(name), attribute_(attribute) {}
const char* name() const;
@ -55,21 +56,18 @@ class RTC_EXPORT Attribute {
bool has_value() const;
template <typename T>
bool holds_alternative() const {
return absl::holds_alternative<const RTCStatsMember<T>*>(attribute_);
return absl::holds_alternative<const absl::optional<T>*>(attribute_);
}
template <typename T>
absl::optional<T> as_optional() const {
const absl::optional<T>& as_optional() const {
RTC_CHECK(holds_alternative<T>());
if (!has_value()) {
return absl::nullopt;
}
return absl::optional<T>(get<T>());
return *absl::get<const absl::optional<T>*>(attribute_);
}
template <typename T>
const T& get() const {
RTC_CHECK(holds_alternative<T>());
RTC_CHECK(has_value());
return absl::get<const RTCStatsMember<T>*>(attribute_)->value();
return absl::get<const absl::optional<T>*>(attribute_)->value();
}
bool is_sequence() const;

View file

@ -20,8 +20,8 @@
#include <utility>
#include <vector>
#include "absl/types/optional.h"
#include "api/stats/attribute.h"
#include "api/stats/rtc_stats_member.h"
#include "api/units/timestamp.h"
#include "rtc_base/checks.h"
#include "rtc_base/system/rtc_export.h"
@ -39,8 +39,8 @@ namespace webrtc {
// Use the `WEBRTC_RTCSTATS_IMPL` macro when implementing subclasses, see macro
// for details.
//
// Derived classes list their dictionary attributes (RTCStatsMember<T> to soon
// be replaced by absl::optional<T>) as public fields, allowing the following:
// Derived classes list their dictionary attributes, absl::optional<T>, as
// public fields, allowing the following:
//
// RTCFooStats foo("fooId", Timestamp::Micros(GetCurrentTime()));
// foo.bar = 42;
@ -52,7 +52,7 @@ namespace webrtc {
// iteration:
//
// for (const auto& attribute : foo.Attributes()) {
// printf("%s = %s\n", attribute.name(), attribute.ValueToString().c_str());
// printf("%s = %s\n", attribute.name(), attribute.ToString().c_str());
// }
class RTC_EXPORT RTCStats {
public:
@ -73,12 +73,12 @@ class RTC_EXPORT RTCStats {
// metrics as viewed via the Attribute wrapper.
std::vector<Attribute> Attributes() const;
template <typename T>
Attribute GetAttribute(const RTCStatsMember<T>& stat) const {
Attribute GetAttribute(const absl::optional<T>& stat) const {
for (const auto& attribute : Attributes()) {
if (!attribute.holds_alternative<T>()) {
continue;
}
if (absl::get<const RTCStatsMember<T>*>(attribute.as_variant()) ==
if (absl::get<const absl::optional<T>*>(attribute.as_variant()) ==
&stat) {
return attribute;
}
@ -136,8 +136,8 @@ class RTC_EXPORT RTCStats {
//
// RTCFooStats(const std::string& id, Timestamp timestamp);
//
// RTCStatsMember<int32_t> foo;
// RTCStatsMember<int32_t> bar;
// absl::optional<int32_t> foo;
// absl::optional<int32_t> bar;
// };
//
// rtcfoostats.cc:

View file

@ -1,185 +0,0 @@
/*
* Copyright 2023 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_STATS_RTC_STATS_MEMBER_H_
#define API_STATS_RTC_STATS_MEMBER_H_
#include <map>
#include <string>
#include <utility>
#include <vector>
#include "absl/types/optional.h"
#include "rtc_base/checks.h"
#include "rtc_base/system/rtc_export.h"
#include "rtc_base/system/rtc_export_template.h"
namespace webrtc {
// Interface for `RTCStats` members, which have a name and a value of a type
// defined in a subclass. Only the types listed in `Type` are supported, these
// are implemented by `RTCStatsMember<T>`. The value of a member may be
// undefined, the value can only be read if `is_defined`.
class RTCStatsMemberInterface {
public:
// Member value types.
enum Type {
kBool, // bool
kInt32, // int32_t
kUint32, // uint32_t
kInt64, // int64_t
kUint64, // uint64_t
kDouble, // double
kString, // std::string
kSequenceBool, // std::vector<bool>
kSequenceInt32, // std::vector<int32_t>
kSequenceUint32, // std::vector<uint32_t>
kSequenceInt64, // std::vector<int64_t>
kSequenceUint64, // std::vector<uint64_t>
kSequenceDouble, // std::vector<double>
kSequenceString, // std::vector<std::string>
kMapStringUint64, // std::map<std::string, uint64_t>
kMapStringDouble, // std::map<std::string, double>
};
virtual ~RTCStatsMemberInterface() {}
virtual Type type() const = 0;
virtual bool is_sequence() const = 0;
virtual bool is_string() const = 0;
virtual bool has_value() const = 0;
// Type and value comparator. The names are not compared. These operators are
// exposed for testing.
bool operator==(const RTCStatsMemberInterface& other) const {
return IsEqual(other);
}
bool operator!=(const RTCStatsMemberInterface& other) const {
return !(*this == other);
}
virtual const RTCStatsMemberInterface* member_ptr() const { return this; }
template <typename T>
const T& cast_to() const {
RTC_DCHECK_EQ(type(), T::StaticType());
return static_cast<const T&>(*member_ptr());
}
protected:
virtual bool IsEqual(const RTCStatsMemberInterface& other) const = 0;
};
// Template implementation of `RTCStatsMemberInterface`.
// The supported types are the ones described by
// `RTCStatsMemberInterface::Type`.
template <typename T>
class RTCStatsMember : public RTCStatsMemberInterface {
public:
RTCStatsMember() {}
explicit RTCStatsMember(const T& value) : value_(value) {}
static Type StaticType();
Type type() const override { return StaticType(); }
bool is_sequence() const override;
bool is_string() const override;
template <typename U>
inline T value_or(U default_value) const {
return value_.value_or(default_value);
}
// TODO(https://crbug.com/webrtc/15164): Migrate to value_or() and delete.
template <typename U>
inline T ValueOrDefault(U default_value) const {
return value_or(default_value);
}
// Assignment operators.
T& operator=(const T& value) {
value_ = value;
return value_.value();
}
T& operator=(const T&& value) {
value_ = std::move(value);
return value_.value();
}
// Getter methods that look the same as absl::optional<T>. Please prefer these
// in order to unblock replacing RTCStatsMember<T> with absl::optional<T> in
// the future (https://crbug.com/webrtc/15164).
bool has_value() const override { return value_.has_value(); }
const T& value() const { return value_.value(); }
T& value() { return value_.value(); }
T& operator*() {
RTC_DCHECK(value_);
return *value_;
}
const T& operator*() const {
RTC_DCHECK(value_);
return *value_;
}
T* operator->() {
RTC_DCHECK(value_);
return &(*value_);
}
const T* operator->() const {
RTC_DCHECK(value_);
return &(*value_);
}
bool IsEqual(const RTCStatsMemberInterface& other) const override {
if (type() != other.type())
return false;
const RTCStatsMember<T>& other_t =
static_cast<const RTCStatsMember<T>&>(other);
return value_ == other_t.value_;
}
private:
absl::optional<T> value_;
};
namespace rtc_stats_internal {
typedef std::map<std::string, uint64_t> MapStringUint64;
typedef std::map<std::string, double> MapStringDouble;
} // namespace rtc_stats_internal
#define WEBRTC_DECLARE_RTCSTATSMEMBER(T) \
template <> \
RTC_EXPORT RTCStatsMemberInterface::Type RTCStatsMember<T>::StaticType(); \
template <> \
RTC_EXPORT bool RTCStatsMember<T>::is_sequence() const; \
template <> \
RTC_EXPORT bool RTCStatsMember<T>::is_string() const; \
extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) \
RTCStatsMember<T>
WEBRTC_DECLARE_RTCSTATSMEMBER(bool);
WEBRTC_DECLARE_RTCSTATSMEMBER(int32_t);
WEBRTC_DECLARE_RTCSTATSMEMBER(uint32_t);
WEBRTC_DECLARE_RTCSTATSMEMBER(int64_t);
WEBRTC_DECLARE_RTCSTATSMEMBER(uint64_t);
WEBRTC_DECLARE_RTCSTATSMEMBER(double);
WEBRTC_DECLARE_RTCSTATSMEMBER(std::string);
WEBRTC_DECLARE_RTCSTATSMEMBER(std::vector<bool>);
WEBRTC_DECLARE_RTCSTATSMEMBER(std::vector<int32_t>);
WEBRTC_DECLARE_RTCSTATSMEMBER(std::vector<uint32_t>);
WEBRTC_DECLARE_RTCSTATSMEMBER(std::vector<int64_t>);
WEBRTC_DECLARE_RTCSTATSMEMBER(std::vector<uint64_t>);
WEBRTC_DECLARE_RTCSTATSMEMBER(std::vector<double>);
WEBRTC_DECLARE_RTCSTATSMEMBER(std::vector<std::string>);
WEBRTC_DECLARE_RTCSTATSMEMBER(rtc_stats_internal::MapStringUint64);
WEBRTC_DECLARE_RTCSTATSMEMBER(rtc_stats_internal::MapStringDouble);
} // namespace webrtc
#endif // API_STATS_RTC_STATS_MEMBER_H_

View file

@ -18,6 +18,7 @@
#include <string>
#include <vector>
#include "absl/types/optional.h"
#include "api/stats/rtc_stats.h"
#include "rtc_base/system/rtc_export.h"
@ -30,10 +31,10 @@ class RTC_EXPORT RTCCertificateStats final : public RTCStats {
RTCCertificateStats(std::string id, Timestamp timestamp);
~RTCCertificateStats() override;
RTCStatsMember<std::string> fingerprint;
RTCStatsMember<std::string> fingerprint_algorithm;
RTCStatsMember<std::string> base64_certificate;
RTCStatsMember<std::string> issuer_certificate_id;
absl::optional<std::string> fingerprint;
absl::optional<std::string> fingerprint_algorithm;
absl::optional<std::string> base64_certificate;
absl::optional<std::string> issuer_certificate_id;
};
// https://w3c.github.io/webrtc-stats/#codec-dict*
@ -43,12 +44,12 @@ class RTC_EXPORT RTCCodecStats final : public RTCStats {
RTCCodecStats(std::string id, Timestamp timestamp);
~RTCCodecStats() override;
RTCStatsMember<std::string> transport_id;
RTCStatsMember<uint32_t> payload_type;
RTCStatsMember<std::string> mime_type;
RTCStatsMember<uint32_t> clock_rate;
RTCStatsMember<uint32_t> channels;
RTCStatsMember<std::string> sdp_fmtp_line;
absl::optional<std::string> transport_id;
absl::optional<uint32_t> payload_type;
absl::optional<std::string> mime_type;
absl::optional<uint32_t> clock_rate;
absl::optional<uint32_t> channels;
absl::optional<std::string> sdp_fmtp_line;
};
// https://w3c.github.io/webrtc-stats/#dcstats-dict*
@ -58,14 +59,14 @@ class RTC_EXPORT RTCDataChannelStats final : public RTCStats {
RTCDataChannelStats(std::string id, Timestamp timestamp);
~RTCDataChannelStats() override;
RTCStatsMember<std::string> label;
RTCStatsMember<std::string> protocol;
RTCStatsMember<int32_t> data_channel_identifier;
RTCStatsMember<std::string> state;
RTCStatsMember<uint32_t> messages_sent;
RTCStatsMember<uint64_t> bytes_sent;
RTCStatsMember<uint32_t> messages_received;
RTCStatsMember<uint64_t> bytes_received;
absl::optional<std::string> label;
absl::optional<std::string> protocol;
absl::optional<int32_t> data_channel_identifier;
absl::optional<std::string> state;
absl::optional<uint32_t> messages_sent;
absl::optional<uint64_t> bytes_sent;
absl::optional<uint32_t> messages_received;
absl::optional<uint64_t> bytes_received;
};
// https://w3c.github.io/webrtc-stats/#candidatepair-dict*
@ -75,35 +76,35 @@ class RTC_EXPORT RTCIceCandidatePairStats final : public RTCStats {
RTCIceCandidatePairStats(std::string id, Timestamp timestamp);
~RTCIceCandidatePairStats() override;
RTCStatsMember<std::string> transport_id;
RTCStatsMember<std::string> local_candidate_id;
RTCStatsMember<std::string> remote_candidate_id;
RTCStatsMember<std::string> state;
absl::optional<std::string> transport_id;
absl::optional<std::string> local_candidate_id;
absl::optional<std::string> remote_candidate_id;
absl::optional<std::string> state;
// Obsolete: priority
RTCStatsMember<uint64_t> priority;
RTCStatsMember<bool> nominated;
absl::optional<uint64_t> priority;
absl::optional<bool> nominated;
// `writable` does not exist in the spec and old comments suggest it used to
// exist but was incorrectly implemented.
// TODO(https://crbug.com/webrtc/14171): Standardize and/or modify
// implementation.
RTCStatsMember<bool> writable;
RTCStatsMember<uint64_t> packets_sent;
RTCStatsMember<uint64_t> packets_received;
RTCStatsMember<uint64_t> bytes_sent;
RTCStatsMember<uint64_t> bytes_received;
RTCStatsMember<double> total_round_trip_time;
RTCStatsMember<double> current_round_trip_time;
RTCStatsMember<double> available_outgoing_bitrate;
RTCStatsMember<double> available_incoming_bitrate;
RTCStatsMember<uint64_t> requests_received;
RTCStatsMember<uint64_t> requests_sent;
RTCStatsMember<uint64_t> responses_received;
RTCStatsMember<uint64_t> responses_sent;
RTCStatsMember<uint64_t> consent_requests_sent;
RTCStatsMember<uint64_t> packets_discarded_on_send;
RTCStatsMember<uint64_t> bytes_discarded_on_send;
RTCStatsMember<double> last_packet_received_timestamp;
RTCStatsMember<double> last_packet_sent_timestamp;
absl::optional<bool> writable;
absl::optional<uint64_t> packets_sent;
absl::optional<uint64_t> packets_received;
absl::optional<uint64_t> bytes_sent;
absl::optional<uint64_t> bytes_received;
absl::optional<double> total_round_trip_time;
absl::optional<double> current_round_trip_time;
absl::optional<double> available_outgoing_bitrate;
absl::optional<double> available_incoming_bitrate;
absl::optional<uint64_t> requests_received;
absl::optional<uint64_t> requests_sent;
absl::optional<uint64_t> responses_received;
absl::optional<uint64_t> responses_sent;
absl::optional<uint64_t> consent_requests_sent;
absl::optional<uint64_t> packets_discarded_on_send;
absl::optional<uint64_t> bytes_discarded_on_send;
absl::optional<double> last_packet_received_timestamp;
absl::optional<double> last_packet_sent_timestamp;
};
// https://w3c.github.io/webrtc-stats/#icecandidate-dict*
@ -112,28 +113,28 @@ class RTC_EXPORT RTCIceCandidateStats : public RTCStats {
WEBRTC_RTCSTATS_DECL();
~RTCIceCandidateStats() override;
RTCStatsMember<std::string> transport_id;
absl::optional<std::string> transport_id;
// Obsolete: is_remote
RTCStatsMember<bool> is_remote;
RTCStatsMember<std::string> network_type;
RTCStatsMember<std::string> ip;
RTCStatsMember<std::string> address;
RTCStatsMember<int32_t> port;
RTCStatsMember<std::string> protocol;
RTCStatsMember<std::string> relay_protocol;
RTCStatsMember<std::string> candidate_type;
RTCStatsMember<int32_t> priority;
RTCStatsMember<std::string> url;
RTCStatsMember<std::string> foundation;
RTCStatsMember<std::string> related_address;
RTCStatsMember<int32_t> related_port;
RTCStatsMember<std::string> username_fragment;
RTCStatsMember<std::string> tcp_type;
absl::optional<bool> is_remote;
absl::optional<std::string> network_type;
absl::optional<std::string> ip;
absl::optional<std::string> address;
absl::optional<int32_t> port;
absl::optional<std::string> protocol;
absl::optional<std::string> relay_protocol;
absl::optional<std::string> candidate_type;
absl::optional<int32_t> priority;
absl::optional<std::string> url;
absl::optional<std::string> foundation;
absl::optional<std::string> related_address;
absl::optional<int32_t> related_port;
absl::optional<std::string> username_fragment;
absl::optional<std::string> tcp_type;
// The following metrics are NOT exposed to JavaScript. We should consider
// standardizing or removing them.
RTCStatsMember<bool> vpn;
RTCStatsMember<std::string> network_adapter_type;
absl::optional<bool> vpn;
absl::optional<std::string> network_adapter_type;
protected:
RTCIceCandidateStats(std::string id, Timestamp timestamp, bool is_remote);
@ -168,8 +169,8 @@ class RTC_EXPORT RTCPeerConnectionStats final : public RTCStats {
RTCPeerConnectionStats(std::string id, Timestamp timestamp);
~RTCPeerConnectionStats() override;
RTCStatsMember<uint32_t> data_channels_opened;
RTCStatsMember<uint32_t> data_channels_closed;
absl::optional<uint32_t> data_channels_opened;
absl::optional<uint32_t> data_channels_closed;
};
// https://w3c.github.io/webrtc-stats/#streamstats-dict*
@ -178,10 +179,10 @@ class RTC_EXPORT RTCRtpStreamStats : public RTCStats {
WEBRTC_RTCSTATS_DECL();
~RTCRtpStreamStats() override;
RTCStatsMember<uint32_t> ssrc;
RTCStatsMember<std::string> kind;
RTCStatsMember<std::string> transport_id;
RTCStatsMember<std::string> codec_id;
absl::optional<uint32_t> ssrc;
absl::optional<std::string> kind;
absl::optional<std::string> transport_id;
absl::optional<std::string> codec_id;
protected:
RTCRtpStreamStats(std::string id, Timestamp timestamp);
@ -193,8 +194,8 @@ class RTC_EXPORT RTCReceivedRtpStreamStats : public RTCRtpStreamStats {
WEBRTC_RTCSTATS_DECL();
~RTCReceivedRtpStreamStats() override;
RTCStatsMember<double> jitter;
RTCStatsMember<int32_t> packets_lost; // Signed per RFC 3550
absl::optional<double> jitter;
absl::optional<int32_t> packets_lost; // Signed per RFC 3550
protected:
RTCReceivedRtpStreamStats(std::string id, Timestamp timestamp);
@ -206,8 +207,8 @@ class RTC_EXPORT RTCSentRtpStreamStats : public RTCRtpStreamStats {
WEBRTC_RTCSTATS_DECL();
~RTCSentRtpStreamStats() override;
RTCStatsMember<uint64_t> packets_sent;
RTCStatsMember<uint64_t> bytes_sent;
absl::optional<uint64_t> packets_sent;
absl::optional<uint64_t> bytes_sent;
protected:
RTCSentRtpStreamStats(std::string id, Timestamp timestamp);
@ -221,51 +222,51 @@ class RTC_EXPORT RTCInboundRtpStreamStats final
RTCInboundRtpStreamStats(std::string id, Timestamp timestamp);
~RTCInboundRtpStreamStats() override;
RTCStatsMember<std::string> playout_id;
RTCStatsMember<std::string> track_identifier;
RTCStatsMember<std::string> mid;
RTCStatsMember<std::string> remote_id;
RTCStatsMember<uint32_t> packets_received;
RTCStatsMember<uint64_t> packets_discarded;
RTCStatsMember<uint64_t> fec_packets_received;
RTCStatsMember<uint64_t> fec_bytes_received;
RTCStatsMember<uint64_t> fec_packets_discarded;
absl::optional<std::string> playout_id;
absl::optional<std::string> track_identifier;
absl::optional<std::string> mid;
absl::optional<std::string> remote_id;
absl::optional<uint32_t> packets_received;
absl::optional<uint64_t> packets_discarded;
absl::optional<uint64_t> fec_packets_received;
absl::optional<uint64_t> fec_bytes_received;
absl::optional<uint64_t> fec_packets_discarded;
// Inbound FEC SSRC. Only present if a mechanism like FlexFEC is negotiated.
RTCStatsMember<uint32_t> fec_ssrc;
RTCStatsMember<uint64_t> bytes_received;
RTCStatsMember<uint64_t> header_bytes_received;
absl::optional<uint32_t> fec_ssrc;
absl::optional<uint64_t> bytes_received;
absl::optional<uint64_t> header_bytes_received;
// Inbound RTX stats. Only defined when RTX is used and it is therefore
// possible to distinguish retransmissions.
RTCStatsMember<uint64_t> retransmitted_packets_received;
RTCStatsMember<uint64_t> retransmitted_bytes_received;
RTCStatsMember<uint32_t> rtx_ssrc;
absl::optional<uint64_t> retransmitted_packets_received;
absl::optional<uint64_t> retransmitted_bytes_received;
absl::optional<uint32_t> rtx_ssrc;
RTCStatsMember<double> last_packet_received_timestamp;
RTCStatsMember<double> jitter_buffer_delay;
RTCStatsMember<double> jitter_buffer_target_delay;
RTCStatsMember<double> jitter_buffer_minimum_delay;
RTCStatsMember<uint64_t> jitter_buffer_emitted_count;
RTCStatsMember<uint64_t> total_samples_received;
RTCStatsMember<uint64_t> concealed_samples;
RTCStatsMember<uint64_t> silent_concealed_samples;
RTCStatsMember<uint64_t> concealment_events;
RTCStatsMember<uint64_t> inserted_samples_for_deceleration;
RTCStatsMember<uint64_t> removed_samples_for_acceleration;
RTCStatsMember<double> audio_level;
RTCStatsMember<double> total_audio_energy;
RTCStatsMember<double> total_samples_duration;
absl::optional<double> last_packet_received_timestamp;
absl::optional<double> jitter_buffer_delay;
absl::optional<double> jitter_buffer_target_delay;
absl::optional<double> jitter_buffer_minimum_delay;
absl::optional<uint64_t> jitter_buffer_emitted_count;
absl::optional<uint64_t> total_samples_received;
absl::optional<uint64_t> concealed_samples;
absl::optional<uint64_t> silent_concealed_samples;
absl::optional<uint64_t> concealment_events;
absl::optional<uint64_t> inserted_samples_for_deceleration;
absl::optional<uint64_t> removed_samples_for_acceleration;
absl::optional<double> audio_level;
absl::optional<double> total_audio_energy;
absl::optional<double> total_samples_duration;
// Stats below are only implemented or defined for video.
RTCStatsMember<uint32_t> frames_received;
RTCStatsMember<uint32_t> frame_width;
RTCStatsMember<uint32_t> frame_height;
RTCStatsMember<double> frames_per_second;
RTCStatsMember<uint32_t> frames_decoded;
RTCStatsMember<uint32_t> key_frames_decoded;
RTCStatsMember<uint32_t> frames_dropped;
RTCStatsMember<double> total_decode_time;
RTCStatsMember<double> total_processing_delay;
RTCStatsMember<double> total_assembly_time;
RTCStatsMember<uint32_t> frames_assembled_from_multiple_packets;
absl::optional<uint32_t> frames_received;
absl::optional<uint32_t> frame_width;
absl::optional<uint32_t> frame_height;
absl::optional<double> frames_per_second;
absl::optional<uint32_t> frames_decoded;
absl::optional<uint32_t> key_frames_decoded;
absl::optional<uint32_t> frames_dropped;
absl::optional<double> total_decode_time;
absl::optional<double> total_processing_delay;
absl::optional<double> total_assembly_time;
absl::optional<uint32_t> frames_assembled_from_multiple_packets;
// TODO(https://crbug.com/webrtc/15600): Implement framesRendered, which is
// incremented at the same time that totalInterFrameDelay and
// totalSquaredInterFrameDelay is incremented. (Dividing inter-frame delay by
@ -277,43 +278,43 @@ class RTC_EXPORT RTCInboundRtpStreamStats final
// at delivery to sink, not at actual render time. When we have an actual
// frame rendered callback, move the calculating of these metrics to there in
// order to make them more accurate.
RTCStatsMember<double> total_inter_frame_delay;
RTCStatsMember<double> total_squared_inter_frame_delay;
RTCStatsMember<uint32_t> pause_count;
RTCStatsMember<double> total_pauses_duration;
RTCStatsMember<uint32_t> freeze_count;
RTCStatsMember<double> total_freezes_duration;
absl::optional<double> total_inter_frame_delay;
absl::optional<double> total_squared_inter_frame_delay;
absl::optional<uint32_t> pause_count;
absl::optional<double> total_pauses_duration;
absl::optional<uint32_t> freeze_count;
absl::optional<double> total_freezes_duration;
// https://w3c.github.io/webrtc-provisional-stats/#dom-rtcinboundrtpstreamstats-contenttype
RTCStatsMember<std::string> content_type;
absl::optional<std::string> content_type;
// Only populated if audio/video sync is enabled.
// TODO(https://crbug.com/webrtc/14177): Expose even if A/V sync is off?
RTCStatsMember<double> estimated_playout_timestamp;
absl::optional<double> estimated_playout_timestamp;
// Only defined for video.
// In JavaScript, this is only exposed if HW exposure is allowed.
RTCStatsMember<std::string> decoder_implementation;
absl::optional<std::string> decoder_implementation;
// FIR and PLI counts are only defined for |kind == "video"|.
RTCStatsMember<uint32_t> fir_count;
RTCStatsMember<uint32_t> pli_count;
RTCStatsMember<uint32_t> nack_count;
RTCStatsMember<uint64_t> qp_sum;
absl::optional<uint32_t> fir_count;
absl::optional<uint32_t> pli_count;
absl::optional<uint32_t> nack_count;
absl::optional<uint64_t> qp_sum;
// This is a remnant of the legacy getStats() API. When the "video-timing"
// header extension is used,
// https://webrtc.github.io/webrtc-org/experiments/rtp-hdrext/video-timing/,
// `googTimingFrameInfo` is exposed with the value of
// TimingFrameInfo::ToString().
// TODO(https://crbug.com/webrtc/14586): Unship or standardize this metric.
RTCStatsMember<std::string> goog_timing_frame_info;
absl::optional<std::string> goog_timing_frame_info;
// In JavaScript, this is only exposed if HW exposure is allowed.
RTCStatsMember<bool> power_efficient_decoder;
absl::optional<bool> power_efficient_decoder;
// The following metrics are NOT exposed to JavaScript. We should consider
// standardizing or removing them.
RTCStatsMember<uint64_t> jitter_buffer_flushes;
RTCStatsMember<uint64_t> delayed_packet_outage_samples;
RTCStatsMember<double> relative_packet_arrival_delay;
RTCStatsMember<uint32_t> interruption_count;
RTCStatsMember<double> total_interruption_duration;
RTCStatsMember<double> min_playout_delay;
absl::optional<uint64_t> jitter_buffer_flushes;
absl::optional<uint64_t> delayed_packet_outage_samples;
absl::optional<double> relative_packet_arrival_delay;
absl::optional<uint32_t> interruption_count;
absl::optional<double> total_interruption_duration;
absl::optional<double> min_playout_delay;
};
// https://w3c.github.io/webrtc-stats/#outboundrtpstats-dict*
@ -324,46 +325,46 @@ class RTC_EXPORT RTCOutboundRtpStreamStats final
RTCOutboundRtpStreamStats(std::string id, Timestamp timestamp);
~RTCOutboundRtpStreamStats() override;
RTCStatsMember<std::string> media_source_id;
RTCStatsMember<std::string> remote_id;
RTCStatsMember<std::string> mid;
RTCStatsMember<std::string> rid;
RTCStatsMember<uint64_t> retransmitted_packets_sent;
RTCStatsMember<uint64_t> header_bytes_sent;
RTCStatsMember<uint64_t> retransmitted_bytes_sent;
RTCStatsMember<double> target_bitrate;
RTCStatsMember<uint32_t> frames_encoded;
RTCStatsMember<uint32_t> key_frames_encoded;
RTCStatsMember<double> total_encode_time;
RTCStatsMember<uint64_t> total_encoded_bytes_target;
RTCStatsMember<uint32_t> frame_width;
RTCStatsMember<uint32_t> frame_height;
RTCStatsMember<double> frames_per_second;
RTCStatsMember<uint32_t> frames_sent;
RTCStatsMember<uint32_t> huge_frames_sent;
RTCStatsMember<double> total_packet_send_delay;
RTCStatsMember<std::string> quality_limitation_reason;
RTCStatsMember<std::map<std::string, double>> quality_limitation_durations;
absl::optional<std::string> media_source_id;
absl::optional<std::string> remote_id;
absl::optional<std::string> mid;
absl::optional<std::string> rid;
absl::optional<uint64_t> retransmitted_packets_sent;
absl::optional<uint64_t> header_bytes_sent;
absl::optional<uint64_t> retransmitted_bytes_sent;
absl::optional<double> target_bitrate;
absl::optional<uint32_t> frames_encoded;
absl::optional<uint32_t> key_frames_encoded;
absl::optional<double> total_encode_time;
absl::optional<uint64_t> total_encoded_bytes_target;
absl::optional<uint32_t> frame_width;
absl::optional<uint32_t> frame_height;
absl::optional<double> frames_per_second;
absl::optional<uint32_t> frames_sent;
absl::optional<uint32_t> huge_frames_sent;
absl::optional<double> total_packet_send_delay;
absl::optional<std::string> quality_limitation_reason;
absl::optional<std::map<std::string, double>> quality_limitation_durations;
// https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-qualitylimitationresolutionchanges
RTCStatsMember<uint32_t> quality_limitation_resolution_changes;
absl::optional<uint32_t> quality_limitation_resolution_changes;
// https://w3c.github.io/webrtc-provisional-stats/#dom-rtcoutboundrtpstreamstats-contenttype
RTCStatsMember<std::string> content_type;
absl::optional<std::string> content_type;
// In JavaScript, this is only exposed if HW exposure is allowed.
// Only implemented for video.
// TODO(https://crbug.com/webrtc/14178): Implement for audio as well.
RTCStatsMember<std::string> encoder_implementation;
absl::optional<std::string> encoder_implementation;
// FIR and PLI counts are only defined for |kind == "video"|.
RTCStatsMember<uint32_t> fir_count;
RTCStatsMember<uint32_t> pli_count;
RTCStatsMember<uint32_t> nack_count;
RTCStatsMember<uint64_t> qp_sum;
RTCStatsMember<bool> active;
absl::optional<uint32_t> fir_count;
absl::optional<uint32_t> pli_count;
absl::optional<uint32_t> nack_count;
absl::optional<uint64_t> qp_sum;
absl::optional<bool> active;
// In JavaScript, this is only exposed if HW exposure is allowed.
RTCStatsMember<bool> power_efficient_encoder;
RTCStatsMember<std::string> scalability_mode;
absl::optional<bool> power_efficient_encoder;
absl::optional<std::string> scalability_mode;
// RTX ssrc. Only present if RTX is negotiated.
RTCStatsMember<uint32_t> rtx_ssrc;
absl::optional<uint32_t> rtx_ssrc;
};
// https://w3c.github.io/webrtc-stats/#remoteinboundrtpstats-dict*
@ -374,11 +375,11 @@ class RTC_EXPORT RTCRemoteInboundRtpStreamStats final
RTCRemoteInboundRtpStreamStats(std::string id, Timestamp timestamp);
~RTCRemoteInboundRtpStreamStats() override;
RTCStatsMember<std::string> local_id;
RTCStatsMember<double> round_trip_time;
RTCStatsMember<double> fraction_lost;
RTCStatsMember<double> total_round_trip_time;
RTCStatsMember<int32_t> round_trip_time_measurements;
absl::optional<std::string> local_id;
absl::optional<double> round_trip_time;
absl::optional<double> fraction_lost;
absl::optional<double> total_round_trip_time;
absl::optional<int32_t> round_trip_time_measurements;
};
// https://w3c.github.io/webrtc-stats/#remoteoutboundrtpstats-dict*
@ -389,12 +390,12 @@ class RTC_EXPORT RTCRemoteOutboundRtpStreamStats final
RTCRemoteOutboundRtpStreamStats(std::string id, Timestamp timestamp);
~RTCRemoteOutboundRtpStreamStats() override;
RTCStatsMember<std::string> local_id;
RTCStatsMember<double> remote_timestamp;
RTCStatsMember<uint64_t> reports_sent;
RTCStatsMember<double> round_trip_time;
RTCStatsMember<uint64_t> round_trip_time_measurements;
RTCStatsMember<double> total_round_trip_time;
absl::optional<std::string> local_id;
absl::optional<double> remote_timestamp;
absl::optional<uint64_t> reports_sent;
absl::optional<double> round_trip_time;
absl::optional<uint64_t> round_trip_time_measurements;
absl::optional<double> total_round_trip_time;
};
// https://w3c.github.io/webrtc-stats/#dom-rtcmediasourcestats
@ -403,8 +404,8 @@ class RTC_EXPORT RTCMediaSourceStats : public RTCStats {
WEBRTC_RTCSTATS_DECL();
~RTCMediaSourceStats() override;
RTCStatsMember<std::string> track_identifier;
RTCStatsMember<std::string> kind;
absl::optional<std::string> track_identifier;
absl::optional<std::string> kind;
protected:
RTCMediaSourceStats(std::string id, Timestamp timestamp);
@ -417,11 +418,11 @@ class RTC_EXPORT RTCAudioSourceStats final : public RTCMediaSourceStats {
RTCAudioSourceStats(std::string id, Timestamp timestamp);
~RTCAudioSourceStats() override;
RTCStatsMember<double> audio_level;
RTCStatsMember<double> total_audio_energy;
RTCStatsMember<double> total_samples_duration;
RTCStatsMember<double> echo_return_loss;
RTCStatsMember<double> echo_return_loss_enhancement;
absl::optional<double> audio_level;
absl::optional<double> total_audio_energy;
absl::optional<double> total_samples_duration;
absl::optional<double> echo_return_loss;
absl::optional<double> echo_return_loss_enhancement;
};
// https://w3c.github.io/webrtc-stats/#dom-rtcvideosourcestats
@ -431,10 +432,10 @@ class RTC_EXPORT RTCVideoSourceStats final : public RTCMediaSourceStats {
RTCVideoSourceStats(std::string id, Timestamp timestamp);
~RTCVideoSourceStats() override;
RTCStatsMember<uint32_t> width;
RTCStatsMember<uint32_t> height;
RTCStatsMember<uint32_t> frames;
RTCStatsMember<double> frames_per_second;
absl::optional<uint32_t> width;
absl::optional<uint32_t> height;
absl::optional<uint32_t> frames;
absl::optional<double> frames_per_second;
};
// https://w3c.github.io/webrtc-stats/#transportstats-dict*
@ -444,23 +445,23 @@ class RTC_EXPORT RTCTransportStats final : public RTCStats {
RTCTransportStats(std::string id, Timestamp timestamp);
~RTCTransportStats() override;
RTCStatsMember<uint64_t> bytes_sent;
RTCStatsMember<uint64_t> packets_sent;
RTCStatsMember<uint64_t> bytes_received;
RTCStatsMember<uint64_t> packets_received;
RTCStatsMember<std::string> rtcp_transport_stats_id;
RTCStatsMember<std::string> dtls_state;
RTCStatsMember<std::string> selected_candidate_pair_id;
RTCStatsMember<std::string> local_certificate_id;
RTCStatsMember<std::string> remote_certificate_id;
RTCStatsMember<std::string> tls_version;
RTCStatsMember<std::string> dtls_cipher;
RTCStatsMember<std::string> dtls_role;
RTCStatsMember<std::string> srtp_cipher;
RTCStatsMember<uint32_t> selected_candidate_pair_changes;
RTCStatsMember<std::string> ice_role;
RTCStatsMember<std::string> ice_local_username_fragment;
RTCStatsMember<std::string> ice_state;
absl::optional<uint64_t> bytes_sent;
absl::optional<uint64_t> packets_sent;
absl::optional<uint64_t> bytes_received;
absl::optional<uint64_t> packets_received;
absl::optional<std::string> rtcp_transport_stats_id;
absl::optional<std::string> dtls_state;
absl::optional<std::string> selected_candidate_pair_id;
absl::optional<std::string> local_certificate_id;
absl::optional<std::string> remote_certificate_id;
absl::optional<std::string> tls_version;
absl::optional<std::string> dtls_cipher;
absl::optional<std::string> dtls_role;
absl::optional<std::string> srtp_cipher;
absl::optional<uint32_t> selected_candidate_pair_changes;
absl::optional<std::string> ice_role;
absl::optional<std::string> ice_local_username_fragment;
absl::optional<std::string> ice_state;
};
// https://w3c.github.io/webrtc-stats/#playoutstats-dict*
@ -470,12 +471,12 @@ class RTC_EXPORT RTCAudioPlayoutStats final : public RTCStats {
RTCAudioPlayoutStats(const std::string& id, Timestamp timestamp);
~RTCAudioPlayoutStats() override;
RTCStatsMember<std::string> kind;
RTCStatsMember<double> synthesized_samples_duration;
RTCStatsMember<uint64_t> synthesized_samples_events;
RTCStatsMember<double> total_samples_duration;
RTCStatsMember<double> total_playout_delay;
RTCStatsMember<uint64_t> total_samples_count;
absl::optional<std::string> kind;
absl::optional<double> synthesized_samples_duration;
absl::optional<uint64_t> synthesized_samples_events;
absl::optional<double> total_samples_duration;
absl::optional<double> total_playout_delay;
absl::optional<uint64_t> total_samples_count;
};
} // namespace webrtc

View file

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef TEST_MOCK_FRAME_TRANSFORMER_H_
#define TEST_MOCK_FRAME_TRANSFORMER_H_
#ifndef API_TEST_MOCK_FRAME_TRANSFORMER_H_
#define API_TEST_MOCK_FRAME_TRANSFORMER_H_
#include <memory>
#include <vector>
@ -42,4 +42,4 @@ class MockFrameTransformer : public FrameTransformerInterface {
} // namespace webrtc
#endif // TEST_MOCK_FRAME_TRANSFORMER_H_
#endif // API_TEST_MOCK_FRAME_TRANSFORMER_H_

View file

@ -177,6 +177,10 @@ class MockPeerConnectionInterface : public webrtc::PeerConnectionInterface {
(const std::vector<cricket::Candidate>&),
(override));
MOCK_METHOD(RTCError, SetBitrate, (const BitrateSettings&), (override));
MOCK_METHOD(void,
ReconfigureBandwidthEstimation,
(const BandwidthEstimationSettings&),
(override));
MOCK_METHOD(void, SetAudioPlayout, (bool), (override));
MOCK_METHOD(void, SetAudioRecording, (bool), (override));
MOCK_METHOD(rtc::scoped_refptr<DtlsTransportInterface>,

View file

@ -14,6 +14,7 @@
#include <memory>
#include <vector>
#include "api/environment/environment.h"
#include "api/video_codecs/sdp_video_format.h"
#include "api/video_codecs/video_decoder.h"
#include "api/video_codecs/video_decoder_factory.h"
@ -21,17 +22,21 @@
namespace webrtc {
class MockVideoDecoderFactory : public webrtc::VideoDecoderFactory {
class MockVideoDecoderFactory : public VideoDecoderFactory {
public:
~MockVideoDecoderFactory() override { Die(); }
MOCK_METHOD(std::vector<webrtc::SdpVideoFormat>,
MOCK_METHOD(std::vector<SdpVideoFormat>,
GetSupportedFormats,
(),
(const, override));
MOCK_METHOD(std::unique_ptr<webrtc::VideoDecoder>,
MOCK_METHOD(std::unique_ptr<VideoDecoder>,
Create,
(const Environment&, const SdpVideoFormat&),
(override));
MOCK_METHOD(std::unique_ptr<VideoDecoder>,
CreateVideoDecoder,
(const webrtc::SdpVideoFormat&),
(const SdpVideoFormat&),
(override));
MOCK_METHOD(void, Die, ());
};

View file

@ -74,6 +74,8 @@ rtc_library("media_quality_test_params") {
"../../../api/transport:network_control",
"../../../api/video_codecs:video_codecs_api",
"../../../modules/audio_processing:api",
"../../../p2p:connection",
"../../../p2p:port_allocator",
"../../../p2p:rtc_p2p",
"../../../rtc_base:network",
"../../../rtc_base:rtc_certificate_generator",

View file

@ -18,6 +18,7 @@ rtc_library("function_video_factory") {
deps = [
"../../../rtc_base:checks",
"../../environment",
"../../video_codecs:video_codecs_api",
]
}

View file

@ -16,6 +16,7 @@
#include <utility>
#include <vector>
#include "api/environment/environment.h"
#include "api/video_codecs/sdp_video_format.h"
#include "api/video_codecs/video_decoder.h"
#include "api/video_codecs/video_decoder_factory.h"
@ -29,17 +30,20 @@ class FunctionVideoDecoderFactory final : public VideoDecoderFactory {
public:
explicit FunctionVideoDecoderFactory(
std::function<std::unique_ptr<VideoDecoder>()> create)
: create_([create = std::move(create)](const SdpVideoFormat&) {
: create_([create = std::move(create)](const Environment&,
const SdpVideoFormat&) {
return create();
}) {}
explicit FunctionVideoDecoderFactory(
std::function<std::unique_ptr<VideoDecoder>(const SdpVideoFormat&)>
std::function<std::unique_ptr<VideoDecoder>(const Environment&,
const SdpVideoFormat&)>
create)
: create_(std::move(create)) {}
FunctionVideoDecoderFactory(
std::function<std::unique_ptr<VideoDecoder>()> create,
std::vector<SdpVideoFormat> sdp_video_formats)
: create_([create = std::move(create)](const SdpVideoFormat&) {
: create_([create = std::move(create)](const Environment&,
const SdpVideoFormat&) {
return create();
}),
sdp_video_formats_(std::move(sdp_video_formats)) {}
@ -48,13 +52,14 @@ class FunctionVideoDecoderFactory final : public VideoDecoderFactory {
return sdp_video_formats_;
}
std::unique_ptr<VideoDecoder> CreateVideoDecoder(
const SdpVideoFormat& format) override {
return create_(format);
std::unique_ptr<VideoDecoder> Create(const Environment& env,
const SdpVideoFormat& format) override {
return create_(env, format);
}
private:
const std::function<std::unique_ptr<VideoDecoder>(const SdpVideoFormat&)>
const std::function<std::unique_ptr<VideoDecoder>(const Environment& env,
const SdpVideoFormat&)>
create_;
const std::vector<SdpVideoFormat> sdp_video_formats_;
};

View file

@ -18,6 +18,12 @@ rtc_library("bitrate_settings") {
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
}
rtc_library("bandwidth_estimation_settings") {
visibility = [ "*" ]
sources = [ "bandwidth_estimation_settings.h" ]
deps = [ "../../rtc_base/system:rtc_export" ]
}
rtc_source_set("enums") {
visibility = [ "*" ]
sources = [ "enums.h" ]

View file

@ -0,0 +1,27 @@
/*
* Copyright (c) 2024 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef API_TRANSPORT_BANDWIDTH_ESTIMATION_SETTINGS_H_
#define API_TRANSPORT_BANDWIDTH_ESTIMATION_SETTINGS_H_
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
// Configuration settings affecting bandwidth estimation.
// These settings can be set and changed by an application.
struct RTC_EXPORT BandwidthEstimationSettings {
// A bandwith estimation probe may be sent using a RtpTransceiver with
// direction SendOnly or SendRecv that supports RTX. The probe can be sent
// without first sending media packets in which case Rtp padding packets are
// used.
bool allow_probe_without_media = false;
};
} // namespace webrtc
#endif // API_TRANSPORT_BANDWIDTH_ESTIMATION_SETTINGS_H_

View file

@ -58,6 +58,7 @@ rtc_library("video_codecs_api") {
"video_codec.h",
"video_decoder.cc",
"video_decoder.h",
"video_decoder_factory.cc",
"video_decoder_factory.h",
"video_encoder.cc",
"video_encoder.h",
@ -84,6 +85,7 @@ rtc_library("video_codecs_api") {
"..:scoped_refptr",
"../../api:array_view",
"../../api:rtp_parameters",
"../../media:media_constants",
"../../modules/video_coding:codec_globals_headers",
"../../rtc_base:checks",
"../../rtc_base:logging",
@ -91,6 +93,7 @@ rtc_library("video_codecs_api") {
"../../rtc_base:refcount",
"../../rtc_base:stringutils",
"../../rtc_base/system:rtc_export",
"../environment",
"../units:data_rate",
"../video:encoded_image",
"../video:render_resolution",
@ -302,6 +305,8 @@ rtc_library("rtc_software_fallback_wrappers") {
deps = [
":video_codecs_api",
"..:fec_controller_api",
"../../api:field_trials_view",
"../../api/environment",
"../../api/transport:field_trial_based_config",
"../../api/video:video_frame",
"../../media:rtc_media_base",

View file

@ -13,13 +13,11 @@
#include <map>
#include <utility>
#include "media/base/media_constants.h"
#include "rtc_base/string_to_number.h"
namespace webrtc {
// Parameter name in the format parameter map for AV1 video.
const char kAV1FmtpProfile[] = "profile";
absl::string_view AV1ProfileToString(AV1Profile profile) {
switch (profile) {
case AV1Profile::kProfile0:
@ -51,7 +49,7 @@ absl::optional<AV1Profile> StringToAV1Profile(absl::string_view str) {
absl::optional<AV1Profile> ParseSdpForAV1Profile(
const CodecParameterMap& params) {
const auto profile_it = params.find(kAV1FmtpProfile);
const auto profile_it = params.find(cricket::kAv1FmtpProfile);
if (profile_it == params.end())
return AV1Profile::kProfile0;
const std::string& profile_str = profile_it->second;

View file

@ -20,9 +20,6 @@
namespace webrtc {
// Profile information for AV1 video.
extern RTC_EXPORT const char kAV1FmtpProfile[];
// Profiles can be found at:
// https://aomedia.org/av1/specification/annex-a/#profiles
// The enum values match the number specified in the SDP.

View file

@ -20,6 +20,7 @@
#endif
#include "api/video_codecs/video_codec.h"
#include "api/video_codecs/vp9_profile.h"
#include "media/base/media_constants.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/strings/string_builder.h"
@ -28,15 +29,21 @@ namespace webrtc {
namespace {
std::string H264GetPacketizationModeOrDefault(const CodecParameterMap& params) {
constexpr char kH264FmtpPacketizationMode[] = "packetization-mode";
const auto it = params.find(kH264FmtpPacketizationMode);
std::string GetFmtpParameterOrDefault(const CodecParameterMap& params,
const std::string& name,
const std::string& default_value) {
const auto it = params.find(name);
if (it != params.end()) {
return it->second;
}
return default_value;
}
std::string H264GetPacketizationModeOrDefault(const CodecParameterMap& params) {
// If packetization-mode is not present, default to "0".
// https://tools.ietf.org/html/rfc6184#section-6.2
return "0";
return GetFmtpParameterOrDefault(params, cricket::kH264FmtpPacketizationMode,
"0");
}
bool H264IsSamePacketizationMode(const CodecParameterMap& left,
@ -45,6 +52,28 @@ bool H264IsSamePacketizationMode(const CodecParameterMap& left,
H264GetPacketizationModeOrDefault(right);
}
std::string AV1GetTierOrDefault(const CodecParameterMap& params) {
// If the parameter is not present, the tier MUST be inferred to be 0.
// https://aomediacodec.github.io/av1-rtp-spec/#72-sdp-parameters
return GetFmtpParameterOrDefault(params, cricket::kAv1FmtpTier, "0");
}
bool AV1IsSameTier(const CodecParameterMap& left,
const CodecParameterMap& right) {
return AV1GetTierOrDefault(left) == AV1GetTierOrDefault(right);
}
std::string AV1GetLevelIdxOrDefault(const CodecParameterMap& params) {
// If the parameter is not present, it MUST be inferred to be 5 (level 3.1).
// https://aomediacodec.github.io/av1-rtp-spec/#72-sdp-parameters
return GetFmtpParameterOrDefault(params, cricket::kAv1FmtpLevelIdx, "5");
}
bool AV1IsSameLevelIdx(const CodecParameterMap& left,
const CodecParameterMap& right) {
return AV1GetLevelIdxOrDefault(left) == AV1GetLevelIdxOrDefault(right);
}
// Some (video) codecs are actually families of codecs and rely on parameters
// to distinguish different incompatible family members.
bool IsSameCodecSpecific(const SdpVideoFormat& format1,
@ -62,7 +91,9 @@ bool IsSameCodecSpecific(const SdpVideoFormat& format1,
case kVideoCodecVP9:
return VP9IsSameProfile(format1.parameters, format2.parameters);
case kVideoCodecAV1:
return AV1IsSameProfile(format1.parameters, format2.parameters);
return AV1IsSameProfile(format1.parameters, format2.parameters) &&
AV1IsSameTier(format1.parameters, format2.parameters) &&
AV1IsSameLevelIdx(format1.parameters, format2.parameters);
#ifdef RTC_ENABLE_H265
case kVideoCodecH265:
return H265IsSameProfileTierLevel(format1.parameters, format2.parameters);
@ -71,6 +102,7 @@ bool IsSameCodecSpecific(const SdpVideoFormat& format1,
return true;
}
}
} // namespace
SdpVideoFormat::SdpVideoFormat(const std::string& name) : name(name) {}

View file

@ -39,10 +39,13 @@ if (rtc_include_tests) {
"../../../modules/video_coding:webrtc_vp8",
"../../../rtc_base:checks",
"../../../rtc_base:rtc_base_tests_utils",
"../../../test:explicit_key_value_config",
"../../../test:fake_video_codecs",
"../../../test:field_trial",
"../../../test:test_support",
"../../../test:video_test_common",
"../../environment",
"../../environment:environment_factory",
"../../video:encoded_image",
"../../video:video_bitrate_allocation",
"../../video:video_frame",

View file

@ -13,6 +13,8 @@
#include <stdint.h>
#include "absl/types/optional.h"
#include "api/environment/environment.h"
#include "api/environment/environment_factory.h"
#include "api/video/encoded_image.h"
#include "api/video/video_frame.h"
#include "api/video_codecs/video_decoder.h"
@ -20,7 +22,7 @@
#include "modules/video_coding/include/video_codec_interface.h"
#include "modules/video_coding/include/video_error_codes.h"
#include "rtc_base/checks.h"
#include "test/field_trial.h"
#include "test/explicit_key_value_config.h"
#include "test/gtest.h"
namespace webrtc {
@ -31,10 +33,12 @@ class VideoDecoderSoftwareFallbackWrapperTest : public ::testing::Test {
: VideoDecoderSoftwareFallbackWrapperTest("") {}
explicit VideoDecoderSoftwareFallbackWrapperTest(
const std::string& field_trials)
: override_field_trials_(field_trials),
: field_trials_(field_trials),
env_(CreateEnvironment(&field_trials_)),
fake_decoder_(new CountingFakeDecoder()),
fallback_wrapper_(CreateVideoDecoderSoftwareFallbackWrapper(
std::unique_ptr<VideoDecoder>(VP8Decoder::Create()),
env_,
CreateVp8Decoder(env_),
std::unique_ptr<VideoDecoder>(fake_decoder_))) {}
class CountingFakeDecoder : public VideoDecoder {
@ -71,7 +75,8 @@ class VideoDecoderSoftwareFallbackWrapperTest : public ::testing::Test {
int release_count_ = 0;
int reset_count_ = 0;
};
test::ScopedFieldTrials override_field_trials_;
test::ExplicitKeyValueConfig field_trials_;
const Environment env_;
// `fake_decoder_` is owned and released by `fallback_wrapper_`.
CountingFakeDecoder* fake_decoder_;
std::unique_ptr<VideoDecoder> fallback_wrapper_;
@ -275,7 +280,7 @@ class ForcedSoftwareDecoderFallbackTest
fake_decoder_ = new CountingFakeDecoder();
sw_fallback_decoder_ = new CountingFakeDecoder();
fallback_wrapper_ = CreateVideoDecoderSoftwareFallbackWrapper(
std::unique_ptr<VideoDecoder>(sw_fallback_decoder_),
env_, std::unique_ptr<VideoDecoder>(sw_fallback_decoder_),
std::unique_ptr<VideoDecoder>(fake_decoder_));
}

View file

@ -16,6 +16,7 @@
#include "absl/strings/match.h"
#include "rtc_base/checks.h"
#include "rtc_base/strings/string_builder.h"
namespace webrtc {
namespace {
@ -73,6 +74,35 @@ VideoCodec::VideoCodec()
codec_specific_(),
complexity_(VideoCodecComplexity::kComplexityNormal) {}
std::string VideoCodec::ToString() const {
char string_buf[2048];
rtc::SimpleStringBuilder ss(string_buf);
ss << "VideoCodec {" << "type: " << CodecTypeToPayloadString(codecType)
<< ", mode: "
<< (mode == VideoCodecMode::kRealtimeVideo ? "RealtimeVideo"
: "Screensharing");
if (IsSinglecast()) {
absl::optional<ScalabilityMode> scalability_mode = GetScalabilityMode();
if (scalability_mode.has_value()) {
ss << ", Singlecast: {" << width << "x" << height << " "
<< ScalabilityModeToString(*scalability_mode)
<< (active ? ", active" : ", inactive") << "}";
}
} else {
ss << ", Simulcast: {";
for (size_t i = 0; i < numberOfSimulcastStreams; ++i) {
const SimulcastStream stream = simulcastStream[i];
ss << "[" << stream.width << "x" << stream.height << " "
<< ScalabilityModeToString(stream.GetScalabilityMode())
<< (stream.active ? ", active" : ", inactive") << "]";
}
ss << "}";
}
ss << "}";
return ss.str();
}
VideoCodecVP8* VideoCodec::VP8() {
RTC_DCHECK_EQ(codecType, kVideoCodecVP8);
return &codec_specific_.VP8;

View file

@ -141,6 +141,9 @@ class RTC_EXPORT VideoCodec {
bool GetFrameDropEnabled() const;
void SetFrameDropEnabled(bool enabled);
bool IsSinglecast() const { return numberOfSimulcastStreams <= 1; }
bool IsSimulcast() const { return !IsSinglecast(); }
// Public variables. TODO(hta): Make them private with accessors.
VideoCodecType codecType;
@ -193,6 +196,7 @@ class RTC_EXPORT VideoCodec {
bool operator==(const VideoCodec& other) const = delete;
bool operator!=(const VideoCodec& other) const = delete;
std::string ToString() const;
// Accessors for codec specific information.
// There is a const version of each that returns a reference,

View file

@ -0,0 +1,45 @@
/*
* Copyright (c) 2024 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "api/video_codecs/video_decoder_factory.h"
#include <memory>
#include "api/video_codecs/sdp_video_format.h"
#include "api/video_codecs/video_decoder.h"
#include "rtc_base/checks.h"
namespace webrtc {
VideoDecoderFactory::CodecSupport VideoDecoderFactory::QueryCodecSupport(
const SdpVideoFormat& format,
bool reference_scaling) const {
// Default implementation, query for supported formats and check if the
// specified format is supported. Returns false if `reference_scaling` is
// true.
return {.is_supported = !reference_scaling &&
format.IsCodecInList(GetSupportedFormats())};
}
std::unique_ptr<VideoDecoder> VideoDecoderFactory::Create(
const Environment& env,
const SdpVideoFormat& format) {
return CreateVideoDecoder(format);
}
std::unique_ptr<VideoDecoder> VideoDecoderFactory::CreateVideoDecoder(
const SdpVideoFormat& format) {
// Newer code shouldn't call this function,
// Older code should implement it in derived classes.
RTC_CHECK_NOTREACHED();
return nullptr;
}
} // namespace webrtc

View file

@ -12,17 +12,15 @@
#define API_VIDEO_CODECS_VIDEO_DECODER_FACTORY_H_
#include <memory>
#include <string>
#include <vector>
#include "absl/types/optional.h"
#include "api/environment/environment.h"
#include "api/video_codecs/sdp_video_format.h"
#include "api/video_codecs/video_decoder.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
class VideoDecoder;
// A factory that creates VideoDecoders.
// NOTE: This class is still under development and may change without notice.
class RTC_EXPORT VideoDecoderFactory {
@ -32,6 +30,8 @@ class RTC_EXPORT VideoDecoderFactory {
bool is_power_efficient = false;
};
virtual ~VideoDecoderFactory() = default;
// Returns a list of supported video formats in order of preference, to use
// for signaling etc.
virtual std::vector<SdpVideoFormat> GetSupportedFormats() const = 0;
@ -47,21 +47,18 @@ class RTC_EXPORT VideoDecoderFactory {
// different scalabilty modes. NOTE: QueryCodecSupport is currently an
// experimental feature that is subject to change without notice.
virtual CodecSupport QueryCodecSupport(const SdpVideoFormat& format,
bool reference_scaling) const {
// Default implementation, query for supported formats and check if the
// specified format is supported. Returns false if `reference_scaling` is
// true.
CodecSupport codec_support;
codec_support.is_supported =
!reference_scaling && format.IsCodecInList(GetSupportedFormats());
return codec_support;
}
bool reference_scaling) const;
// Creates a VideoDecoder for the specified format.
// Creates a VideoDecoder for the specified `format`.
// TODO: bugs.webrtc.org/15791 - Make pure virtual when implemented in all
// derived classes.
virtual std::unique_ptr<VideoDecoder> Create(const Environment& env,
const SdpVideoFormat& format);
// TODO: bugs.webrtc.org/15791 - Make private or delete when all callers are
// migrated to `Create`.
virtual std::unique_ptr<VideoDecoder> CreateVideoDecoder(
const SdpVideoFormat& format) = 0;
virtual ~VideoDecoderFactory() {}
const SdpVideoFormat& format);
};
} // namespace webrtc

View file

@ -23,7 +23,7 @@ struct Dav1dDecoderTemplateAdapter {
static std::vector<SdpVideoFormat> SupportedFormats() {
return {SdpVideoFormat("AV1"),
SdpVideoFormat(
"AV1", {{kAV1FmtpProfile,
"AV1", {{"profile",
AV1ProfileToString(AV1Profile::kProfile1).data()}})};
}

View file

@ -16,6 +16,7 @@
#include <string>
#include <utility>
#include "api/field_trials_view.h"
#include "api/video/encoded_image.h"
#include "api/video_codecs/video_decoder.h"
#include "modules/video_coding/include/video_error_codes.h"
@ -35,7 +36,8 @@ class VideoDecoderSoftwareFallbackWrapper final : public VideoDecoder {
public:
VideoDecoderSoftwareFallbackWrapper(
std::unique_ptr<VideoDecoder> sw_fallback_decoder,
std::unique_ptr<VideoDecoder> hw_decoder);
std::unique_ptr<VideoDecoder> hw_decoder,
bool force_sw_decoder_fallback);
~VideoDecoderSoftwareFallbackWrapper() override;
bool Configure(const Settings& settings) override;
@ -67,6 +69,7 @@ class VideoDecoderSoftwareFallbackWrapper final : public VideoDecoder {
} decoder_type_;
std::unique_ptr<VideoDecoder> hw_decoder_;
const bool force_sw_decoder_fallback_;
Settings decoder_settings_;
const std::unique_ptr<VideoDecoder> fallback_decoder_;
const std::string fallback_implementation_name_;
@ -77,9 +80,11 @@ class VideoDecoderSoftwareFallbackWrapper final : public VideoDecoder {
VideoDecoderSoftwareFallbackWrapper::VideoDecoderSoftwareFallbackWrapper(
std::unique_ptr<VideoDecoder> sw_fallback_decoder,
std::unique_ptr<VideoDecoder> hw_decoder)
std::unique_ptr<VideoDecoder> hw_decoder,
bool force_sw_decoder_fallback)
: decoder_type_(DecoderType::kNone),
hw_decoder_(std::move(hw_decoder)),
force_sw_decoder_fallback_(force_sw_decoder_fallback),
fallback_decoder_(std::move(sw_fallback_decoder)),
fallback_implementation_name_(
fallback_decoder_->GetDecoderInfo().implementation_name +
@ -94,7 +99,7 @@ VideoDecoderSoftwareFallbackWrapper::~VideoDecoderSoftwareFallbackWrapper() =
bool VideoDecoderSoftwareFallbackWrapper::Configure(const Settings& settings) {
decoder_settings_ = settings;
if (webrtc::field_trial::IsEnabled("WebRTC-Video-ForcedSwDecoderFallback")) {
if (force_sw_decoder_fallback_) {
RTC_LOG(LS_INFO) << "Forced software decoder fallback enabled.";
RTC_DCHECK(decoder_type_ == DecoderType::kNone);
return InitFallbackDecoder();
@ -276,10 +281,20 @@ VideoDecoder& VideoDecoderSoftwareFallbackWrapper::active_decoder() const {
} // namespace
std::unique_ptr<VideoDecoder> CreateVideoDecoderSoftwareFallbackWrapper(
const Environment& env,
std::unique_ptr<VideoDecoder> sw_fallback_decoder,
std::unique_ptr<VideoDecoder> hw_decoder) {
return std::make_unique<VideoDecoderSoftwareFallbackWrapper>(
std::move(sw_fallback_decoder), std::move(hw_decoder));
std::move(sw_fallback_decoder), std::move(hw_decoder),
env.field_trials().IsEnabled("WebRTC-Video-ForcedSwDecoderFallback"));
}
std::unique_ptr<VideoDecoder> CreateVideoDecoderSoftwareFallbackWrapper(
std::unique_ptr<VideoDecoder> sw_fallback_decoder,
std::unique_ptr<VideoDecoder> hw_decoder) {
return std::make_unique<VideoDecoderSoftwareFallbackWrapper>(
std::move(sw_fallback_decoder), std::move(hw_decoder),
webrtc::field_trial::IsEnabled("WebRTC-Video-ForcedSwDecoderFallback"));
}
} // namespace webrtc

View file

@ -13,6 +13,7 @@
#include <memory>
#include "api/environment/environment.h"
#include "api/video_codecs/video_decoder.h"
#include "rtc_base/system/rtc_export.h"
@ -22,6 +23,13 @@ namespace webrtc {
// software decoding when a hardware decoder fails to decode a stream due to
// hardware restrictions, such as max resolution.
RTC_EXPORT std::unique_ptr<VideoDecoder>
CreateVideoDecoderSoftwareFallbackWrapper(
const Environment& env,
std::unique_ptr<VideoDecoder> sw_fallback_decoder,
std::unique_ptr<VideoDecoder> hw_decoder);
// TODO: bugs.webrtc.org/15791 - Deprecated, remove when not used by chromium.
RTC_EXPORT std::unique_ptr<VideoDecoder>
CreateVideoDecoderSoftwareFallbackWrapper(
std::unique_ptr<VideoDecoder> sw_fallback_decoder,
std::unique_ptr<VideoDecoder> hw_decoder);

View file

@ -28,6 +28,7 @@
#include "api/video_codecs/video_encoder.h"
#include "media/base/video_common.h"
#include "modules/video_coding/include/video_error_codes.h"
#include "modules/video_coding/include/video_error_codes_utils.h"
#include "modules/video_coding/utility/simulcast_utility.h"
#include "rtc_base/checks.h"
#include "rtc_base/experiments/field_trial_parser.h"
@ -264,14 +265,17 @@ void VideoEncoderSoftwareFallbackWrapper::PrimeEncoder(
}
bool VideoEncoderSoftwareFallbackWrapper::InitFallbackEncoder(bool is_forced) {
RTC_LOG(LS_WARNING) << "Encoder falling back to software encoding.";
RTC_LOG(LS_WARNING) << "[VESFW] " << __func__
<< "(is_forced=" << (is_forced ? "true" : "false") << ")";
RTC_DCHECK(encoder_settings_.has_value());
const int ret = fallback_encoder_->InitEncode(&codec_settings_,
encoder_settings_.value());
if (ret != WEBRTC_VIDEO_CODEC_OK) {
RTC_LOG(LS_ERROR) << "Failed to initialize software-encoder fallback.";
RTC_LOG(LS_ERROR)
<< "[VESFW] software-encoder fallback initialization failed with"
<< " error code: " << WebRtcVideoCodecErrorToString(ret);
fallback_encoder_->Release();
return false;
}
@ -305,6 +309,12 @@ void VideoEncoderSoftwareFallbackWrapper::SetFecControllerOverride(
int32_t VideoEncoderSoftwareFallbackWrapper::InitEncode(
const VideoCodec* codec_settings,
const VideoEncoder::Settings& settings) {
RTC_LOG(LS_INFO) << "[VESFW] " << __func__
<< "(codec=" << codec_settings->ToString()
<< ", settings={number_of_cores: "
<< settings.number_of_cores
<< ", max_payload_size: " << settings.max_payload_size
<< "})";
// Store settings, in case we need to dynamically switch to the fallback
// encoder after a failed Encode call.
codec_settings_ = *codec_settings;
@ -327,6 +337,8 @@ int32_t VideoEncoderSoftwareFallbackWrapper::InitEncode(
PrimeEncoder(current_encoder());
return ret;
}
RTC_LOG(LS_WARNING) << "[VESFW] Hardware encoder initialization failed with"
<< " error code: " << WebRtcVideoCodecErrorToString(ret);
// Try to instantiate software codec.
if (InitFallbackEncoder(/*is_forced=*/false)) {
@ -335,6 +347,8 @@ int32_t VideoEncoderSoftwareFallbackWrapper::InitEncode(
}
// Software encoder failed too, use original return code.
RTC_LOG(LS_WARNING)
<< "[VESFW] Software fallback encoder initialization also failed.";
encoder_state_ = EncoderState::kUninitialized;
return ret;
}

View file

@ -167,6 +167,8 @@ if (rtc_include_tests) {
"../api:mock_audio_mixer",
"../api:mock_frame_decryptor",
"../api:mock_frame_encryptor",
"../api:mock_frame_transformer",
"../api:mock_transformable_audio_frame",
"../api:scoped_refptr",
"../api/audio:audio_frame_api",
"../api/audio_codecs:audio_codecs_api",
@ -210,8 +212,6 @@ if (rtc_include_tests) {
"../system_wrappers",
"../test:audio_codec_mocks",
"../test:field_trial",
"../test:mock_frame_transformer",
"../test:mock_transformable_frame",
"../test:mock_transport",
"../test:rtp_test_utils",
"../test:run_loop",
@ -234,6 +234,7 @@ if (rtc_include_tests) {
sources = [ "channel_receive_unittest.cc" ]
deps = [
":audio",
"../api:mock_frame_transformer",
"../api/audio_codecs:builtin_audio_decoder_factory",
"../api/crypto:frame_decryptor_interface",
"../api/task_queue:default_task_queue_factory",
@ -245,7 +246,6 @@ if (rtc_include_tests) {
"../rtc_base:logging",
"../rtc_base:threading",
"../test:audio_codec_mocks",
"../test:mock_frame_transformer",
"../test:mock_transport",
"../test:test_support",
"../test/time_controller",

View file

@ -157,6 +157,8 @@ AudioSendStream::AudioSendStream(
event_log_(event_log),
use_legacy_overhead_calculation_(
field_trials_.IsEnabled("WebRTC-Audio-LegacyOverhead")),
enable_priority_bitrate_(
!field_trials_.IsDisabled("WebRTC-Audio-PriorityBitrate")),
bitrate_allocator_(bitrate_allocator),
rtp_transport_(rtp_transport),
rtp_rtcp_module_(channel_send_->GetRtpRtcp()),
@ -171,7 +173,6 @@ AudioSendStream::AudioSendStream(
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
ConfigureStream(config, true, nullptr);
UpdateCachedTargetAudioBitrateConstraints();
}
AudioSendStream::~AudioSendStream() {
@ -324,10 +325,7 @@ void AudioSendStream::ConfigureStream(
}
// Set currently known overhead (used in ANA, opus only).
{
MutexLock lock(&overhead_per_packet_lock_);
UpdateOverheadForEncoder();
}
UpdateOverheadPerPacket();
channel_send_->CallEncoder([this](AudioEncoder* encoder) {
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
@ -335,7 +333,7 @@ void AudioSendStream::ConfigureStream(
return;
}
frame_length_range_ = encoder->GetFrameLengthRange();
UpdateCachedTargetAudioBitrateConstraints();
bitrate_range_ = encoder->GetBitrateRange();
});
if (sending_) {
@ -343,9 +341,6 @@ void AudioSendStream::ConfigureStream(
}
config_ = new_config;
if (!first_time) {
UpdateCachedTargetAudioBitrateConstraints();
}
webrtc::InvokeSetParametersCallback(callback, webrtc::RTCError::OK());
}
@ -488,30 +483,23 @@ webrtc::AudioSendStream::Stats AudioSendStream::GetStats(
void AudioSendStream::DeliverRtcp(const uint8_t* packet, size_t length) {
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
channel_send_->ReceivedRTCPPacket(packet, length);
{
// Poll if overhead has changed, which it can do if ack triggers us to stop
// sending mid/rid.
MutexLock lock(&overhead_per_packet_lock_);
UpdateOverheadForEncoder();
}
UpdateCachedTargetAudioBitrateConstraints();
// Poll if overhead has changed, which it can do if ack triggers us to stop
// sending mid/rid.
UpdateOverheadPerPacket();
}
uint32_t AudioSendStream::OnBitrateUpdated(BitrateAllocationUpdate update) {
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
// Pick a target bitrate between the constraints. Overrules the allocator if
// it 1) allocated a bitrate of zero to disable the stream or 2) allocated a
// higher than max to allow for e.g. extra FEC.
RTC_DCHECK(cached_constraints_.has_value());
update.target_bitrate.Clamp(cached_constraints_->min,
cached_constraints_->max);
update.stable_target_bitrate.Clamp(cached_constraints_->min,
cached_constraints_->max);
absl::optional<TargetAudioBitrateConstraints> constraints =
GetMinMaxBitrateConstraints();
if (constraints) {
update.target_bitrate.Clamp(constraints->min, constraints->max);
update.stable_target_bitrate.Clamp(constraints->min, constraints->max);
}
channel_send_->OnBitrateAllocation(update);
// The amount of audio protection is not exposed by the encoder, hence
// always returning 0.
return 0;
@ -520,41 +508,30 @@ uint32_t AudioSendStream::OnBitrateUpdated(BitrateAllocationUpdate update) {
void AudioSendStream::SetTransportOverhead(
int transport_overhead_per_packet_bytes) {
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
{
MutexLock lock(&overhead_per_packet_lock_);
transport_overhead_per_packet_bytes_ = transport_overhead_per_packet_bytes;
UpdateOverheadForEncoder();
}
UpdateCachedTargetAudioBitrateConstraints();
transport_overhead_per_packet_bytes_ = transport_overhead_per_packet_bytes;
UpdateOverheadPerPacket();
}
void AudioSendStream::UpdateOverheadForEncoder() {
void AudioSendStream::UpdateOverheadPerPacket() {
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
size_t overhead_per_packet_bytes = GetPerPacketOverheadBytes();
size_t overhead_per_packet_bytes =
transport_overhead_per_packet_bytes_ +
rtp_rtcp_module_->ExpectedPerPacketOverhead();
if (overhead_per_packet_ == overhead_per_packet_bytes) {
return;
}
overhead_per_packet_ = overhead_per_packet_bytes;
channel_send_->CallEncoder([&](AudioEncoder* encoder) {
encoder->OnReceivedOverhead(overhead_per_packet_bytes);
});
if (total_packet_overhead_bytes_ != overhead_per_packet_bytes) {
total_packet_overhead_bytes_ = overhead_per_packet_bytes;
if (registered_with_allocator_) {
ConfigureBitrateObserver();
}
if (registered_with_allocator_) {
ConfigureBitrateObserver();
}
}
size_t AudioSendStream::TestOnlyGetPerPacketOverheadBytes() const {
MutexLock lock(&overhead_per_packet_lock_);
return GetPerPacketOverheadBytes();
}
size_t AudioSendStream::GetPerPacketOverheadBytes() const {
return transport_overhead_per_packet_bytes_ +
rtp_rtcp_module_->ExpectedPerPacketOverhead();
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
return overhead_per_packet_;
}
RtpState AudioSendStream::GetRtpState() const {
@ -648,13 +625,9 @@ bool AudioSendStream::SetupSendCodec(const Config& new_config) {
}
// Set currently known overhead (used in ANA, opus only).
// If overhead changes later, it will be updated in UpdateOverheadForEncoder.
{
MutexLock lock(&overhead_per_packet_lock_);
size_t overhead = GetPerPacketOverheadBytes();
if (overhead > 0) {
encoder->OnReceivedOverhead(overhead);
}
// If overhead changes later, it will be updated in UpdateOverheadPerPacket.
if (overhead_per_packet_ > 0) {
encoder->OnReceivedOverhead(overhead_per_packet_);
}
StoreEncoderProperties(encoder->SampleRateHz(), encoder->NumChannels());
@ -716,18 +689,14 @@ void AudioSendStream::ReconfigureANA(const Config& new_config) {
return;
}
if (new_config.audio_network_adaptor_config) {
// This lock needs to be acquired before CallEncoder, since it aquires
// another lock and we need to maintain the same order at all call sites to
// avoid deadlock.
MutexLock lock(&overhead_per_packet_lock_);
size_t overhead = GetPerPacketOverheadBytes();
channel_send_->CallEncoder([&](AudioEncoder* encoder) {
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
if (encoder->EnableAudioNetworkAdaptor(
*new_config.audio_network_adaptor_config, event_log_)) {
RTC_LOG(LS_INFO) << "Audio network adaptor enabled on SSRC "
<< new_config.rtp.ssrc;
if (overhead > 0) {
encoder->OnReceivedOverhead(overhead);
if (overhead_per_packet_ > 0) {
encoder->OnReceivedOverhead(overhead_per_packet_);
}
} else {
RTC_LOG(LS_INFO) << "Failed to enable Audio network adaptor on SSRC "
@ -832,8 +801,7 @@ void AudioSendStream::ConfigureBitrateObserver() {
priority_bitrate += max_overhead;
} else {
RTC_DCHECK(frame_length_range_);
const DataSize overhead_per_packet =
DataSize::Bytes(total_packet_overhead_bytes_);
const DataSize overhead_per_packet = DataSize::Bytes(overhead_per_packet_);
DataRate min_overhead = overhead_per_packet / frame_length_range_->second;
priority_bitrate += min_overhead;
}
@ -842,6 +810,10 @@ void AudioSendStream::ConfigureBitrateObserver() {
priority_bitrate = *allocation_settings_.priority_bitrate_raw;
}
if (!enable_priority_bitrate_) {
priority_bitrate = DataRate::BitsPerSec(0);
}
bitrate_allocator_->AddObserver(
this,
MediaStreamAllocationConfig{
@ -877,6 +849,12 @@ AudioSendStream::GetMinMaxBitrateConstraints() const {
if (allocation_settings_.max_bitrate)
constraints.max = *allocation_settings_.max_bitrate;
// Use encoder defined bitrate range if available.
if (bitrate_range_) {
constraints.min = bitrate_range_->first;
constraints.max = bitrate_range_->second;
}
RTC_DCHECK_GE(constraints.min, DataRate::Zero());
RTC_DCHECK_GE(constraints.max, DataRate::Zero());
if (constraints.max < constraints.min) {
@ -897,10 +875,9 @@ AudioSendStream::GetMinMaxBitrateConstraints() const {
RTC_LOG(LS_WARNING) << "frame_length_range_ is not set";
return absl::nullopt;
}
const DataSize kOverheadPerPacket =
DataSize::Bytes(total_packet_overhead_bytes_);
constraints.min += kOverheadPerPacket / frame_length_range_->second;
constraints.max += kOverheadPerPacket / frame_length_range_->first;
const DataSize overhead_per_packet = DataSize::Bytes(overhead_per_packet_);
constraints.min += overhead_per_packet / frame_length_range_->second;
constraints.max += overhead_per_packet / frame_length_range_->first;
}
return constraints;
}
@ -910,15 +887,6 @@ void AudioSendStream::RegisterCngPayloadType(int payload_type,
channel_send_->RegisterCngPayloadType(payload_type, clockrate_hz);
}
void AudioSendStream::UpdateCachedTargetAudioBitrateConstraints() {
absl::optional<AudioSendStream::TargetAudioBitrateConstraints>
new_constraints = GetMinMaxBitrateConstraints();
if (!new_constraints.has_value()) {
return;
}
cached_constraints_ = new_constraints;
}
// RingRTC change to configure opus
void AudioSendStream::ConfigureEncoder(const webrtc::AudioEncoder::Config& config) {
RTC_DCHECK_RUN_ON(&worker_thread_checker_);

View file

@ -110,8 +110,7 @@ class AudioSendStream final : public webrtc::AudioSendStream,
const voe::ChannelSendInterface* GetChannel() const;
// Returns combined per-packet overhead.
size_t TestOnlyGetPerPacketOverheadBytes() const
RTC_LOCKS_EXCLUDED(overhead_per_packet_lock_);
size_t TestOnlyGetPerPacketOverheadBytes() const;
// RingRTC change to configure opus
void ConfigureEncoder(const webrtc::AudioEncoder::Config& config) override;
@ -161,19 +160,11 @@ class AudioSendStream final : public webrtc::AudioSendStream,
// Sets per-packet overhead on encoded (for ANA) based on current known values
// of transport and packetization overheads.
void UpdateOverheadForEncoder()
RTC_EXCLUSIVE_LOCKS_REQUIRED(overhead_per_packet_lock_);
// Returns combined per-packet overhead.
size_t GetPerPacketOverheadBytes() const
RTC_EXCLUSIVE_LOCKS_REQUIRED(overhead_per_packet_lock_);
void UpdateOverheadPerPacket();
void RegisterCngPayloadType(int payload_type, int clockrate_hz)
RTC_RUN_ON(worker_thread_checker_);
void UpdateCachedTargetAudioBitrateConstraints()
RTC_RUN_ON(worker_thread_checker_);
Clock* clock_;
const FieldTrialsView& field_trials_;
@ -191,6 +182,7 @@ class AudioSendStream final : public webrtc::AudioSendStream,
const std::unique_ptr<voe::ChannelSendInterface> channel_send_;
RtcEventLog* const event_log_;
const bool use_legacy_overhead_calculation_;
const bool enable_priority_bitrate_;
int encoder_sample_rate_hz_ RTC_GUARDED_BY(worker_thread_checker_) = 0;
size_t encoder_num_channels_ RTC_GUARDED_BY(worker_thread_checker_) = 0;
@ -202,9 +194,6 @@ class AudioSendStream final : public webrtc::AudioSendStream,
BitrateAllocatorInterface* const bitrate_allocator_
RTC_GUARDED_BY(worker_thread_checker_);
absl::optional<AudioSendStream::TargetAudioBitrateConstraints>
cached_constraints_ RTC_GUARDED_BY(worker_thread_checker_) =
absl::nullopt;
RtpTransportControllerSendInterface* const rtp_transport_;
RtpRtcpInterface* const rtp_rtcp_module_;
@ -226,19 +215,18 @@ class AudioSendStream final : public webrtc::AudioSendStream,
const std::vector<RtpExtension>& extensions);
static int TransportSeqNumId(const Config& config);
mutable Mutex overhead_per_packet_lock_;
size_t overhead_per_packet_ RTC_GUARDED_BY(overhead_per_packet_lock_) = 0;
// Current transport overhead (ICE, TURN, etc.)
size_t transport_overhead_per_packet_bytes_
RTC_GUARDED_BY(overhead_per_packet_lock_) = 0;
RTC_GUARDED_BY(worker_thread_checker_) = 0;
// Total overhead, including transport and RTP headers.
size_t overhead_per_packet_ RTC_GUARDED_BY(worker_thread_checker_) = 0;
bool registered_with_allocator_ RTC_GUARDED_BY(worker_thread_checker_) =
false;
size_t total_packet_overhead_bytes_ RTC_GUARDED_BY(worker_thread_checker_) =
0;
absl::optional<std::pair<TimeDelta, TimeDelta>> frame_length_range_
RTC_GUARDED_BY(worker_thread_checker_);
absl::optional<std::pair<DataRate, DataRate>> bitrate_range_
RTC_GUARDED_BY(worker_thread_checker_);
};
} // namespace internal
} // namespace webrtc

View file

@ -21,6 +21,7 @@
#include "audio/audio_state.h"
#include "audio/conversion.h"
#include "audio/mock_voe_channel_proxy.h"
#include "call/test/mock_bitrate_allocator.h"
#include "call/test/mock_rtp_transport_controller_send.h"
#include "logging/rtc_event_log/mock/mock_rtc_event_log.h"
#include "modules/audio_device/include/mock_audio_device.h"
@ -155,7 +156,6 @@ struct ConfigHelper {
use_null_audio_processing
? nullptr
: rtc::make_ref_counted<NiceMock<MockAudioProcessing>>()),
bitrate_allocator_(&limit_observer_),
audio_encoder_(nullptr) {
using ::testing::Invoke;
@ -203,6 +203,7 @@ struct ConfigHelper {
MockRtpRtcpInterface* rtp_rtcp() { return &rtp_rtcp_; }
MockChannelSend* channel_send() { return channel_send_; }
RtpTransportControllerSendInterface* transport() { return &rtp_transport_; }
MockBitrateAllocator* bitrate_allocator() { return &bitrate_allocator_; }
static void AddBweToConfig(AudioSendStream::Config* config) {
config->rtp.extensions.push_back(RtpExtension(
@ -328,7 +329,7 @@ struct ConfigHelper {
::testing::NiceMock<MockRtpTransportControllerSend> rtp_transport_;
::testing::NiceMock<MockRtpRtcpInterface> rtp_rtcp_;
::testing::NiceMock<MockLimitObserver> limit_observer_;
BitrateAllocator bitrate_allocator_;
::testing::NiceMock<MockBitrateAllocator> bitrate_allocator_;
std::unique_ptr<AudioEncoder> audio_encoder_;
};
@ -560,8 +561,7 @@ TEST(AudioSendStreamTest, AudioNetworkAdaptorReceivesOverhead) {
InSequence s;
EXPECT_CALL(
*mock_encoder,
OnReceivedOverhead(Eq(kOverheadPerPacket.bytes<size_t>())))
.Times(2);
OnReceivedOverhead(Eq(kOverheadPerPacket.bytes<size_t>())));
EXPECT_CALL(*mock_encoder,
EnableAudioNetworkAdaptor(StrEq(kAnaConfigString), _))
.WillOnce(Return(true));
@ -847,7 +847,6 @@ TEST(AudioSendStreamTest, AudioOverheadChanged) {
EXPECT_CALL(*helper.rtp_rtcp(), ExpectedPerPacketOverhead)
.WillRepeatedly(Return(audio_overhead_per_packet_bytes));
auto send_stream = helper.CreateAudioSendStream();
auto new_config = helper.config();
BitrateAllocationUpdate update;
update.target_bitrate =
@ -861,6 +860,8 @@ TEST(AudioSendStreamTest, AudioOverheadChanged) {
EXPECT_CALL(*helper.rtp_rtcp(), ExpectedPerPacketOverhead)
.WillRepeatedly(Return(audio_overhead_per_packet_bytes + 20));
// RTP overhead can only change in response to RTCP or configuration change.
send_stream->Reconfigure(helper.config(), nullptr);
EXPECT_CALL(*helper.channel_send(), OnBitrateAllocation);
send_stream->OnBitrateUpdated(update);
@ -924,5 +925,65 @@ TEST(AudioSendStreamTest, ReconfigureWithFrameEncryptor) {
send_stream->Reconfigure(new_config, nullptr);
}
}
TEST(AudioSendStreamTest, DefaultsHonorsPriorityBitrate) {
ConfigHelper helper(true, true, true);
ScopedKeyValueConfig field_trials(helper.field_trials,
"WebRTC-Audio-Allocation/prio_rate:20/");
auto send_stream = helper.CreateAudioSendStream();
EXPECT_CALL(*helper.bitrate_allocator(), AddObserver(send_stream.get(), _))
.WillOnce(Invoke(
[&](BitrateAllocatorObserver*, MediaStreamAllocationConfig config) {
EXPECT_EQ(config.priority_bitrate_bps, 20000);
}));
EXPECT_CALL(*helper.channel_send(), StartSend());
send_stream->Start();
EXPECT_CALL(*helper.channel_send(), StopSend());
send_stream->Stop();
}
TEST(AudioSendStreamTest, OverridesPriorityBitrate) {
ConfigHelper helper(true, true, true);
ScopedKeyValueConfig field_trials(helper.field_trials,
"WebRTC-Audio-Allocation/prio_rate:20/"
"WebRTC-Audio-PriorityBitrate/Disabled/");
auto send_stream = helper.CreateAudioSendStream();
EXPECT_CALL(*helper.bitrate_allocator(), AddObserver(send_stream.get(), _))
.WillOnce(Invoke(
[&](BitrateAllocatorObserver*, MediaStreamAllocationConfig config) {
EXPECT_EQ(config.priority_bitrate_bps, 0);
}));
EXPECT_CALL(*helper.channel_send(), StartSend());
send_stream->Start();
EXPECT_CALL(*helper.channel_send(), StopSend());
send_stream->Stop();
}
TEST(AudioSendStreamTest, UseEncoderBitrateRange) {
ConfigHelper helper(true, true, true);
std::pair<DataRate, DataRate> bitrate_range{DataRate::BitsPerSec(5000),
DataRate::BitsPerSec(10000)};
EXPECT_CALL(helper.mock_encoder_factory(), MakeAudioEncoderMock(_, _, _, _))
.WillOnce(Invoke([&](int payload_type, const SdpAudioFormat& format,
absl::optional<AudioCodecPairId> codec_pair_id,
std::unique_ptr<AudioEncoder>* return_value) {
auto mock_encoder = SetupAudioEncoderMock(payload_type, format);
EXPECT_CALL(*mock_encoder, GetBitrateRange())
.WillRepeatedly(Return(bitrate_range));
*return_value = std::move(mock_encoder);
}));
auto send_stream = helper.CreateAudioSendStream();
EXPECT_CALL(*helper.bitrate_allocator(), AddObserver(send_stream.get(), _))
.WillOnce(Invoke(
[&](BitrateAllocatorObserver*, MediaStreamAllocationConfig config) {
EXPECT_EQ(config.min_bitrate_bps, bitrate_range.first.bps());
EXPECT_EQ(config.max_bitrate_bps, bitrate_range.second.bps());
}));
EXPECT_CALL(*helper.channel_send(), StartSend());
send_stream->Start();
EXPECT_CALL(*helper.channel_send(), StopSend());
send_stream->Stop();
}
} // namespace test
} // namespace webrtc

View file

@ -579,13 +579,8 @@ ChannelReceive::ChannelReceive(
network_thread_checker_.Detach();
acm_receiver_.ResetInitialDelay();
acm_receiver_.SetMinimumDelay(0);
// RingRTC change to configure the jitter buffer's max target delay.
acm_receiver_.SetMaximumDelay(jitter_buffer_max_target_delay_ms);
acm_receiver_.FlushBuffers();
_outputAudioLevel.ResetLevelFullRange();
rtp_receive_statistics_->EnableRetransmitDetection(remote_ssrc_, true);
RtpRtcpInterface::Configuration configuration;

View file

@ -13,11 +13,11 @@
#include <memory>
#include <utility>
#include "api/test/mock_frame_transformer.h"
#include "api/test/mock_transformable_audio_frame.h"
#include "audio/channel_send_frame_transformer_delegate.h"
#include "test/gmock.h"
#include "test/gtest.h"
#include "test/mock_frame_transformer.h"
#include "test/mock_transformable_frame.h"
namespace webrtc {
namespace {

View file

@ -14,6 +14,7 @@
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
#include "api/crypto/frame_decryptor_interface.h"
#include "api/task_queue/default_task_queue_factory.h"
#include "api/test/mock_frame_transformer.h"
#include "logging/rtc_event_log/mock/mock_rtc_event_log.h"
#include "modules/audio_device/include/audio_device.h"
#include "modules/audio_device/include/mock_audio_device.h"
@ -29,7 +30,6 @@
#include "test/gmock.h"
#include "test/gtest.h"
#include "test/mock_audio_decoder_factory.h"
#include "test/mock_frame_transformer.h"
#include "test/mock_transport.h"
#include "test/time_controller/simulated_time_controller.h"

View file

@ -58,7 +58,8 @@ class TransformableOutgoingAudioFrame
absl::optional<uint64_t> absolute_capture_timestamp_ms,
uint32_t ssrc,
std::vector<uint32_t> csrcs,
const std::string& codec_mime_type)
const std::string& codec_mime_type,
absl::optional<uint16_t> sequence_number)
: frame_type_(frame_type),
payload_type_(payload_type),
rtp_timestamp_with_offset_(rtp_timestamp_with_offset),
@ -66,7 +67,8 @@ class TransformableOutgoingAudioFrame
absolute_capture_timestamp_ms_(absolute_capture_timestamp_ms),
ssrc_(ssrc),
csrcs_(std::move(csrcs)),
codec_mime_type_(codec_mime_type) {}
codec_mime_type_(codec_mime_type),
sequence_number_(sequence_number) {}
~TransformableOutgoingAudioFrame() override = default;
rtc::ArrayView<const uint8_t> GetData() const override { return payload_; }
void SetData(rtc::ArrayView<const uint8_t> data) override {
@ -88,7 +90,7 @@ class TransformableOutgoingAudioFrame
}
const absl::optional<uint16_t> SequenceNumber() const override {
return absl::nullopt;
return sequence_number_;
}
void SetRTPTimestamp(uint32_t rtp_timestamp_with_offset) override {
@ -108,6 +110,7 @@ class TransformableOutgoingAudioFrame
uint32_t ssrc_;
std::vector<uint32_t> csrcs_;
std::string codec_mime_type_;
absl::optional<uint16_t> sequence_number_;
};
} // namespace
@ -155,7 +158,8 @@ void ChannelSendFrameTransformerDelegate::Transform(
std::make_unique<TransformableOutgoingAudioFrame>(
frame_type, payload_type, rtp_timestamp, payload_data, payload_size,
absolute_capture_timestamp_ms, ssrc,
/*csrcs=*/std::vector<uint32_t>(), codec_mimetype));
/*csrcs=*/std::vector<uint32_t>(), codec_mimetype,
/*sequence_number=*/absl::nullopt));
}
void ChannelSendFrameTransformerDelegate::OnTransformedFrame(
@ -203,7 +207,7 @@ std::unique_ptr<TransformableAudioFrameInterface> CloneSenderAudioFrame(
original->GetPayloadType(), original->GetTimestamp(),
original->GetData().data(), original->GetData().size(),
original->AbsoluteCaptureTimestamp(), original->GetSsrc(),
std::move(csrcs), original->GetMimeType());
std::move(csrcs), original->GetMimeType(), original->SequenceNumber());
}
} // namespace webrtc

View file

@ -15,11 +15,11 @@
#include <vector>
#include "absl/memory/memory.h"
#include "api/test/mock_frame_transformer.h"
#include "api/test/mock_transformable_audio_frame.h"
#include "rtc_base/task_queue_for_test.h"
#include "test/gmock.h"
#include "test/gtest.h"
#include "test/mock_frame_transformer.h"
#include "test/mock_transformable_frame.h"
namespace webrtc {
namespace {
@ -59,7 +59,7 @@ class MockChannelSend {
};
std::unique_ptr<TransformableAudioFrameInterface> CreateMockReceiverFrame(
std::vector<const uint32_t> csrcs) {
const std::vector<uint32_t>& csrcs) {
std::unique_ptr<MockTransformableAudioFrame> mock_frame =
std::make_unique<NiceMock<MockTransformableAudioFrame>>();
rtc::ArrayView<const uint8_t> payload(mock_data);
@ -68,6 +68,7 @@ std::unique_ptr<TransformableAudioFrameInterface> CreateMockReceiverFrame(
ON_CALL(*mock_frame, GetDirection)
.WillByDefault(Return(TransformableFrameInterface::Direction::kReceiver));
ON_CALL(*mock_frame, GetContributingSources).WillByDefault(Return(csrcs));
ON_CALL(*mock_frame, SequenceNumber).WillByDefault(Return(987654321));
return mock_frame;
}
@ -167,7 +168,7 @@ TEST(ChannelSendFrameTransformerDelegateTest,
delegate->Init();
ASSERT_TRUE(callback);
std::vector<const uint32_t> csrcs = {123, 234, 345, 456};
const std::vector<uint32_t> csrcs = {123, 234, 345, 456};
EXPECT_CALL(mock_channel, SendFrame).Times(0);
EXPECT_CALL(mock_channel, SendFrame(_, 0, 0, ElementsAreArray(mock_data), _,
ElementsAreArray(csrcs)));
@ -252,6 +253,7 @@ TEST(ChannelSendFrameTransformerDelegateTest, CloningReceiverFrameWithCsrcs) {
ASSERT_NE(frame->GetContributingSources().size(), 0u);
EXPECT_THAT(cloned_frame->GetContributingSources(),
ElementsAreArray(frame->GetContributingSources()));
EXPECT_EQ(cloned_frame->SequenceNumber(), frame->SequenceNumber());
}
} // namespace

View file

@ -17,12 +17,12 @@
#include "api/environment/environment.h"
#include "api/environment/environment_factory.h"
#include "api/scoped_refptr.h"
#include "api/test/mock_frame_transformer.h"
#include "api/units/time_delta.h"
#include "api/units/timestamp.h"
#include "call/rtp_transport_controller_send.h"
#include "rtc_base/gunit.h"
#include "test/gtest.h"
#include "test/mock_frame_transformer.h"
#include "test/mock_transport.h"
#include "test/scoped_key_value_config.h"
#include "test/time_controller/simulated_time_controller.h"

View file

@ -117,6 +117,7 @@ rtc_library("rtp_interfaces") {
"../api/crypto:options",
"../api/environment",
"../api/rtc_event_log",
"../api/transport:bandwidth_estimation_settings",
"../api/transport:bitrate_settings",
"../api/transport:network_control",
"../api/units:time_delta",
@ -481,6 +482,7 @@ if (rtc_include_tests) {
"../api:array_view",
"../api:create_frame_generator",
"../api:mock_audio_mixer",
"../api:mock_frame_transformer",
"../api:rtp_headers",
"../api:rtp_parameters",
"../api:transport_api",
@ -525,7 +527,6 @@ if (rtc_include_tests) {
"../test:fake_video_codecs",
"../test:field_trial",
"../test:frame_generator_capturer",
"../test:mock_frame_transformer",
"../test:mock_transport",
"../test:run_loop",
"../test:scoped_key_value_config",

View file

@ -159,6 +159,37 @@ void RtpTransportControllerSend::DestroyRtpVideoSender(
video_rtp_senders_.erase(it);
}
void RtpTransportControllerSend::RegisterSendingRtpStream(
RtpRtcpInterface& rtp_module) {
RTC_DCHECK_RUN_ON(&sequence_checker_);
// Allow pacer to send packets using this module.
packet_router_.AddSendRtpModule(&rtp_module,
/*remb_candidate=*/true);
pacer_.SetAllowProbeWithoutMediaPacket(
bwe_settings_.allow_probe_without_media &&
packet_router_.SupportsRtxPayloadPadding());
}
void RtpTransportControllerSend::DeRegisterSendingRtpStream(
RtpRtcpInterface& rtp_module) {
RTC_DCHECK_RUN_ON(&sequence_checker_);
// Disabling media, remove from packet router map to reduce size and
// prevent any stray packets in the pacer from asynchronously arriving
// to a disabled module.
packet_router_.RemoveSendRtpModule(&rtp_module);
// Clear the pacer queue of any packets pertaining to this module.
pacer_.RemovePacketsForSsrc(rtp_module.SSRC());
if (rtp_module.RtxSsrc().has_value()) {
pacer_.RemovePacketsForSsrc(*rtp_module.RtxSsrc());
}
if (rtp_module.FlexfecSsrc().has_value()) {
pacer_.RemovePacketsForSsrc(*rtp_module.FlexfecSsrc());
}
pacer_.SetAllowProbeWithoutMediaPacket(
bwe_settings_.allow_probe_without_media &&
packet_router_.SupportsRtxPayloadPadding());
}
void RtpTransportControllerSend::UpdateControlState() {
absl::optional<TargetTransferRate> update = control_handler_->GetUpdate();
if (!update)
@ -224,6 +255,29 @@ RtpTransportControllerSend::GetStreamFeedbackProvider() {
return &feedback_demuxer_;
}
void RtpTransportControllerSend::ReconfigureBandwidthEstimation(
const BandwidthEstimationSettings& settings) {
RTC_DCHECK_RUN_ON(&sequence_checker_);
bwe_settings_ = settings;
if (controller_) {
// Recreate the controller and handler.
control_handler_ = nullptr;
controller_ = nullptr;
// The BWE controller is created when/if the network is available.
MaybeCreateControllers();
if (controller_) {
BitrateConstraints constraints = bitrate_configurator_.GetConfig();
UpdateBitrateConstraints(constraints);
UpdateStreamsConfig();
UpdateNetworkAvailability();
}
}
pacer_.SetAllowProbeWithoutMediaPacket(
bwe_settings_.allow_probe_without_media &&
packet_router_.SupportsRtxPayloadPadding());
}
void RtpTransportControllerSend::RegisterTargetTransferRateObserver(
TargetTransferRateObserver* observer) {
RTC_DCHECK_RUN_ON(&sequence_checker_);
@ -325,9 +379,6 @@ void RtpTransportControllerSend::OnNetworkAvailability(bool network_available) {
RTC_DCHECK_RUN_ON(&sequence_checker_);
RTC_LOG(LS_VERBOSE) << "SignalNetworkState "
<< (network_available ? "Up" : "Down");
NetworkAvailability msg;
msg.at_time = Timestamp::Millis(env_.clock().TimeInMilliseconds());
msg.network_available = network_available;
network_available_ = network_available;
if (network_available) {
pacer_.Resume();
@ -340,11 +391,7 @@ void RtpTransportControllerSend::OnNetworkAvailability(bool network_available) {
if (!controller_) {
MaybeCreateControllers();
}
if (controller_) {
control_handler_->SetNetworkAvailability(network_available);
PostUpdates(controller_->OnNetworkAvailability(msg));
UpdateControlState();
}
UpdateNetworkAvailability();
for (auto& rtp_sender : video_rtp_senders_) {
rtp_sender->OnNetworkAvailability(network_available);
}
@ -587,6 +634,18 @@ void RtpTransportControllerSend::MaybeCreateControllers() {
StartProcessPeriodicTasks();
}
void RtpTransportControllerSend::UpdateNetworkAvailability() {
if (!controller_) {
return;
}
NetworkAvailability msg;
msg.at_time = Timestamp::Millis(env_.clock().TimeInMilliseconds());
msg.network_available = network_available_;
control_handler_->SetNetworkAvailability(network_available_);
PostUpdates(controller_->OnNetworkAvailability(msg));
UpdateControlState();
}
void RtpTransportControllerSend::UpdateInitialConstraints(
TargetRateConstraints new_contraints) {
if (!new_contraints.starting_rate)

View file

@ -75,6 +75,8 @@ class RtpTransportControllerSend final
RtpVideoSenderInterface* rtp_video_sender) override;
// Implements RtpTransportControllerSendInterface
void RegisterSendingRtpStream(RtpRtcpInterface& rtp_module) override;
void DeRegisterSendingRtpStream(RtpRtcpInterface& rtp_module) override;
PacketRouter* packet_router() override;
NetworkStateEstimateObserver* network_state_estimate_observer() override;
@ -82,6 +84,8 @@ class RtpTransportControllerSend final
RtpPacketSender* packet_sender() override;
void SetAllocatedSendBitrateLimits(BitrateAllocationLimits limits) override;
void ReconfigureBandwidthEstimation(
const BandwidthEstimationSettings& settings) override;
void SetPacingFactor(float pacing_factor) override;
void SetQueueTimeLimit(int limit_ms) override;
@ -125,6 +129,7 @@ class RtpTransportControllerSend final
private:
void MaybeCreateControllers() RTC_RUN_ON(sequence_checker_);
void UpdateNetworkAvailability() RTC_RUN_ON(sequence_checker_);
void UpdateInitialConstraints(TargetRateConstraints new_contraints)
RTC_RUN_ON(sequence_checker_);
@ -155,6 +160,7 @@ class RtpTransportControllerSend final
RtpBitrateConfigurator bitrate_configurator_;
std::map<std::string, rtc::NetworkRoute> network_routes_
RTC_GUARDED_BY(sequence_checker_);
BandwidthEstimationSettings bwe_settings_ RTC_GUARDED_BY(sequence_checker_);
bool pacer_started_ RTC_GUARDED_BY(sequence_checker_);
TaskQueuePacedSender pacer_;

View file

@ -24,6 +24,7 @@
#include "api/fec_controller.h"
#include "api/frame_transformer_interface.h"
#include "api/rtc_event_log/rtc_event_log.h"
#include "api/transport/bandwidth_estimation_settings.h"
#include "api/transport/bitrate_settings.h"
#include "api/units/timestamp.h"
#include "call/rtp_config.h"
@ -47,6 +48,7 @@ class Transport;
class PacketRouter;
class RtpVideoSenderInterface;
class RtpPacketSender;
class RtpRtcpInterface;
struct RtpSenderObservers {
RtcpRttStats* rtcp_rtt_stats;
@ -108,6 +110,12 @@ class RtpTransportControllerSendInterface {
virtual void DestroyRtpVideoSender(
RtpVideoSenderInterface* rtp_video_sender) = 0;
// Register a specific RTP stream as sending. This means that the pacer and
// packet router can send packets using this RTP stream.
virtual void RegisterSendingRtpStream(RtpRtcpInterface& rtp_module) = 0;
// Pacer and PacketRouter stop using this RTP stream.
virtual void DeRegisterSendingRtpStream(RtpRtcpInterface& rtp_module) = 0;
virtual NetworkStateEstimateObserver* network_state_estimate_observer() = 0;
virtual TransportFeedbackObserver* transport_feedback_observer() = 0;
@ -118,6 +126,9 @@ class RtpTransportControllerSendInterface {
virtual void SetAllocatedSendBitrateLimits(
BitrateAllocationLimits limits) = 0;
virtual void ReconfigureBandwidthEstimation(
const BandwidthEstimationSettings& settings) = 0;
virtual void SetPacingFactor(float pacing_factor) = 0;
virtual void SetQueueTimeLimit(int limit_ms) = 0;

View file

@ -470,85 +470,41 @@ RtpVideoSender::RtpVideoSender(
}
RtpVideoSender::~RtpVideoSender() {
// TODO(bugs.webrtc.org/13517): Remove once RtpVideoSender gets deleted on the
// transport task queue.
transport_checker_.Detach();
RTC_DCHECK_RUN_ON(&transport_checker_);
SetActiveModulesLocked(
std::vector<bool>(rtp_streams_.size(), /*active=*/false));
RTC_DCHECK(!registered_for_feedback_);
/*sending=*/false);
}
void RtpVideoSender::Stop() {
void RtpVideoSender::SetSending(bool enabled) {
RTC_DCHECK_RUN_ON(&transport_checker_);
MutexLock lock(&mutex_);
if (!active_)
if (enabled == active_) {
return;
const std::vector<bool> active_modules(rtp_streams_.size(), false);
SetActiveModulesLocked(active_modules);
}
SetActiveModulesLocked(/*sending=*/enabled);
}
void RtpVideoSender::SetActiveModules(const std::vector<bool>& active_modules) {
void RtpVideoSender::SetActiveModulesLocked(bool sending) {
RTC_DCHECK_RUN_ON(&transport_checker_);
MutexLock lock(&mutex_);
return SetActiveModulesLocked(active_modules);
}
void RtpVideoSender::SetActiveModulesLocked(
const std::vector<bool>& active_modules) {
RTC_DCHECK_RUN_ON(&transport_checker_);
RTC_CHECK_EQ(rtp_streams_.size(), active_modules.size());
active_ = false;
for (size_t i = 0; i < active_modules.size(); ++i) {
if (active_modules[i]) {
active_ = true;
}
if (active_ == sending) {
return;
}
active_ = sending;
for (size_t i = 0; i < rtp_streams_.size(); ++i) {
RtpRtcpInterface& rtp_module = *rtp_streams_[i].rtp_rtcp;
const bool was_active = rtp_module.Sending();
const bool should_be_active = active_modules[i];
rtp_module.SetSendingStatus(active_modules[i]);
if (was_active && !should_be_active) {
// Disabling media, remove from packet router map to reduce size and
// prevent any stray packets in the pacer from asynchronously arriving
// to a disabled module.
transport_->packet_router()->RemoveSendRtpModule(&rtp_module);
// Clear the pacer queue of any packets pertaining to this module.
transport_->packet_sender()->RemovePacketsForSsrc(rtp_module.SSRC());
if (rtp_module.RtxSsrc().has_value()) {
transport_->packet_sender()->RemovePacketsForSsrc(
*rtp_module.RtxSsrc());
}
if (rtp_module.FlexfecSsrc().has_value()) {
transport_->packet_sender()->RemovePacketsForSsrc(
*rtp_module.FlexfecSsrc());
}
}
// If set to false this module won't send media.
rtp_module.SetSendingMediaStatus(active_modules[i]);
if (!was_active && should_be_active) {
// Turning on media, register with packet router.
transport_->packet_router()->AddSendRtpModule(&rtp_module,
/*remb_candidate=*/true);
rtp_module.SetSendingStatus(sending);
rtp_module.SetSendingMediaStatus(sending);
if (sending) {
transport_->RegisterSendingRtpStream(rtp_module);
} else {
transport_->DeRegisterSendingRtpStream(rtp_module);
}
}
if (!active_) {
auto* feedback_provider = transport_->GetStreamFeedbackProvider();
if (registered_for_feedback_) {
feedback_provider->DeRegisterStreamFeedbackObserver(this);
registered_for_feedback_ = false;
}
} else if (!registered_for_feedback_) {
auto* feedback_provider = transport_->GetStreamFeedbackProvider();
auto* feedback_provider = transport_->GetStreamFeedbackProvider();
if (!sending) {
feedback_provider->DeRegisterStreamFeedbackObserver(this);
} else {
feedback_provider->RegisterStreamFeedbackObserver(rtp_config_.ssrcs, this);
registered_for_feedback_ = true;
}
}

View file

@ -95,11 +95,7 @@ class RtpVideoSender : public RtpVideoSenderInterface,
RtpVideoSender(const RtpVideoSender&) = delete;
RtpVideoSender& operator=(const RtpVideoSender&) = delete;
// Sets the sending status of the rtp modules and appropriately sets the
// payload router to active if any rtp modules are active.
void SetActiveModules(const std::vector<bool>& active_modules)
RTC_LOCKS_EXCLUDED(mutex_) override;
void Stop() RTC_LOCKS_EXCLUDED(mutex_) override;
void SetSending(bool enabled) RTC_LOCKS_EXCLUDED(mutex_) override;
bool IsActive() RTC_LOCKS_EXCLUDED(mutex_) override;
void OnNetworkAvailability(bool network_available)
@ -160,7 +156,7 @@ class RtpVideoSender : public RtpVideoSenderInterface,
private:
bool IsActiveLocked() RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
void SetActiveModulesLocked(const std::vector<bool>& active_modules)
void SetActiveModulesLocked(bool sending)
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
void UpdateModuleSendingState() RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
void ConfigureProtection();
@ -184,7 +180,6 @@ class RtpVideoSender : public RtpVideoSenderInterface,
// transport task queue.
mutable Mutex mutex_;
bool active_ RTC_GUARDED_BY(mutex_);
bool registered_for_feedback_ RTC_GUARDED_BY(transport_checker_) = false;
const std::unique_ptr<FecController> fec_controller_;
bool fec_allowed_ RTC_GUARDED_BY(mutex_);

View file

@ -31,12 +31,8 @@ struct FecProtectionParams;
class RtpVideoSenderInterface : public EncodedImageCallback,
public FecControllerOverride {
public:
// Sets the sending status of the rtp modules and appropriately sets the
// RtpVideoSender to active if any rtp modules are active.
// A module will only send packet if beeing active.
virtual void SetActiveModules(const std::vector<bool>& active_modules) = 0;
// Set the sending status of all rtp modules to inactive.
virtual void Stop() = 0;
// Sets weather or not RTP packets is allowed to be sent on this sender.
virtual void SetSending(bool enabled) = 0;
virtual bool IsActive() = 0;
virtual void OnNetworkAvailability(bool network_available) = 0;

View file

@ -18,6 +18,7 @@
#include "absl/functional/any_invocable.h"
#include "api/environment/environment.h"
#include "api/environment/environment_factory.h"
#include "api/test/mock_frame_transformer.h"
#include "call/rtp_transport_controller_send.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "modules/rtp_rtcp/source/byte_io.h"
@ -29,7 +30,6 @@
#include "rtc_base/rate_limiter.h"
#include "test/gmock.h"
#include "test/gtest.h"
#include "test/mock_frame_transformer.h"
#include "test/mock_transport.h"
#include "test/scenario/scenario.h"
#include "test/scoped_key_value_config.h"
@ -180,17 +180,13 @@ class RtpVideoSenderTestFixture {
/*frame_transformer=*/nullptr,
field_trials) {}
~RtpVideoSenderTestFixture() { Stop(); }
~RtpVideoSenderTestFixture() { SetSending(false); }
RtpVideoSender* router() { return router_.get(); }
MockTransport& transport() { return transport_; }
void AdvanceTime(TimeDelta delta) { time_controller_.AdvanceTime(delta); }
void Stop() { router_->Stop(); }
void SetActiveModules(const std::vector<bool>& active_modules) {
router_->SetActiveModules(active_modules);
}
void SetSending(bool sending) { router_->SetSending(sending); }
private:
test::ScopedKeyValueConfig field_trials_;
@ -227,20 +223,20 @@ TEST(RtpVideoSenderTest, SendOnOneModule) {
EXPECT_NE(EncodedImageCallback::Result::OK,
test.router()->OnEncodedImage(encoded_image, nullptr).error);
test.SetActiveModules({true});
test.SetSending(true);
EXPECT_EQ(EncodedImageCallback::Result::OK,
test.router()->OnEncodedImage(encoded_image, nullptr).error);
test.SetActiveModules({false});
test.SetSending(false);
EXPECT_NE(EncodedImageCallback::Result::OK,
test.router()->OnEncodedImage(encoded_image, nullptr).error);
test.SetActiveModules({true});
test.SetSending(true);
EXPECT_EQ(EncodedImageCallback::Result::OK,
test.router()->OnEncodedImage(encoded_image, nullptr).error);
}
TEST(RtpVideoSenderTest, SendSimulcastSetActive) {
TEST(RtpVideoSenderTest, OnEncodedImageReturnOkWhenSendingTrue) {
constexpr uint8_t kPayload = 'a';
EncodedImage encoded_image_1;
encoded_image_1.SetRtpTimestamp(1);
@ -254,7 +250,7 @@ TEST(RtpVideoSenderTest, SendSimulcastSetActive) {
CodecSpecificInfo codec_info;
codec_info.codecType = kVideoCodecVP8;
test.SetActiveModules({true, true});
test.SetSending(true);
EXPECT_EQ(EncodedImageCallback::Result::OK,
test.router()->OnEncodedImage(encoded_image_1, &codec_info).error);
@ -262,20 +258,9 @@ TEST(RtpVideoSenderTest, SendSimulcastSetActive) {
encoded_image_2.SetSimulcastIndex(1);
EXPECT_EQ(EncodedImageCallback::Result::OK,
test.router()->OnEncodedImage(encoded_image_2, &codec_info).error);
// Inactive.
test.Stop();
EXPECT_NE(EncodedImageCallback::Result::OK,
test.router()->OnEncodedImage(encoded_image_1, &codec_info).error);
EXPECT_NE(EncodedImageCallback::Result::OK,
test.router()->OnEncodedImage(encoded_image_2, &codec_info).error);
}
// Tests how setting individual rtp modules to active affects the overall
// behavior of the payload router. First sets one module to active and checks
// that outgoing data can be sent on this module, and checks that no data can
// be sent if both modules are inactive.
TEST(RtpVideoSenderTest, SendSimulcastSetActiveModules) {
TEST(RtpVideoSenderTest, OnEncodedImageReturnErrorCodeWhenSendingFalse) {
constexpr uint8_t kPayload = 'a';
EncodedImage encoded_image_1;
encoded_image_1.SetRtpTimestamp(1);
@ -291,23 +276,15 @@ TEST(RtpVideoSenderTest, SendSimulcastSetActiveModules) {
CodecSpecificInfo codec_info;
codec_info.codecType = kVideoCodecVP8;
// Only setting one stream to active will still set the payload router to
// active and allow sending data on the active stream.
std::vector<bool> active_modules({true, false});
test.SetActiveModules(active_modules);
EXPECT_EQ(EncodedImageCallback::Result::OK,
test.router()->OnEncodedImage(encoded_image_1, &codec_info).error);
// Setting both streams to inactive will turn the payload router to
// Setting rtp streams to inactive will turn the payload router to
// inactive.
active_modules = {false, false};
test.SetActiveModules(active_modules);
test.SetSending(false);
// An incoming encoded image will not ask the module to send outgoing data
// because the payload router is inactive.
EXPECT_NE(EncodedImageCallback::Result::OK,
test.router()->OnEncodedImage(encoded_image_1, &codec_info).error);
EXPECT_NE(EncodedImageCallback::Result::OK,
test.router()->OnEncodedImage(encoded_image_1, &codec_info).error);
test.router()->OnEncodedImage(encoded_image_2, &codec_info).error);
}
TEST(RtpVideoSenderTest,
@ -324,7 +301,7 @@ TEST(RtpVideoSenderTest,
codec_info.codecType = kVideoCodecVP8;
RtpVideoSenderTestFixture test({kSsrc1, kSsrc2}, {kRtxSsrc1, kRtxSsrc2},
kPayloadType, {});
test.SetActiveModules({true, true});
test.SetSending(true);
// A layer is sent on both rtp streams.
test.router()->OnVideoLayersAllocationUpdated(
{.active_spatial_layers = {{.rtp_stream_index = 0},
@ -347,7 +324,7 @@ TEST(RtpVideoSenderTest,
TEST(RtpVideoSenderTest, CreateWithNoPreviousStates) {
RtpVideoSenderTestFixture test({kSsrc1, kSsrc2}, {kRtxSsrc1, kRtxSsrc2},
kPayloadType, {});
test.SetActiveModules({true, true});
test.SetSending(true);
std::map<uint32_t, RtpPayloadState> initial_states =
test.router()->GetRtpPayloadStates();
@ -372,7 +349,7 @@ TEST(RtpVideoSenderTest, CreateWithPreviousStates) {
RtpVideoSenderTestFixture test({kSsrc1, kSsrc2}, {kRtxSsrc1, kRtxSsrc2},
kPayloadType, states);
test.SetActiveModules({true, true});
test.SetSending(true);
std::map<uint32_t, RtpPayloadState> initial_states =
test.router()->GetRtpPayloadStates();
@ -412,7 +389,7 @@ TEST(RtpVideoSenderTest, FrameCountCallbacks) {
test.router()->OnEncodedImage(encoded_image, nullptr).error);
::testing::Mock::VerifyAndClearExpectations(&callback);
test.SetActiveModules({true});
test.SetSending(true);
FrameCounts frame_counts;
EXPECT_CALL(callback, FrameCountUpdated(_, kSsrc1))
@ -441,7 +418,7 @@ TEST(RtpVideoSenderTest, FrameCountCallbacks) {
TEST(RtpVideoSenderTest, DoesNotRetrasmitAckedPackets) {
RtpVideoSenderTestFixture test({kSsrc1, kSsrc2}, {kRtxSsrc1, kRtxSsrc2},
kPayloadType, {});
test.SetActiveModules({true, true});
test.SetSending(true);
constexpr uint8_t kPayload = 'a';
EncodedImage encoded_image;
@ -606,7 +583,7 @@ TEST(RtpVideoSenderTest, RetransmitsOnTransportWideLossInfo) {
TEST(RtpVideoSenderTest, EarlyRetransmits) {
RtpVideoSenderTestFixture test({kSsrc1, kSsrc2}, {kRtxSsrc1, kRtxSsrc2},
kPayloadType, {});
test.SetActiveModules({true, true});
test.SetSending(true);
const uint8_t kPayload[1] = {'a'};
EncodedImage encoded_image;
@ -701,7 +678,7 @@ TEST(RtpVideoSenderTest, EarlyRetransmits) {
TEST(RtpVideoSenderTest, SupportsDependencyDescriptor) {
RtpVideoSenderTestFixture test({kSsrc1}, {}, kPayloadType, {});
test.SetActiveModules({true});
test.SetSending(true);
RtpHeaderExtensionMap extensions;
extensions.Register<RtpDependencyDescriptorExtension>(
@ -773,7 +750,7 @@ TEST(RtpVideoSenderTest,
EXPECT_TRUE(sent_packets.emplace_back(&extensions).Parse(packet));
return true;
});
test.SetActiveModules({true});
test.SetSending(true);
EncodedImage key_frame_image;
key_frame_image._frameType = VideoFrameType::kVideoFrameKey;
@ -807,7 +784,7 @@ TEST(RtpVideoSenderTest,
TEST(RtpVideoSenderTest, SupportsDependencyDescriptorForVp9) {
RtpVideoSenderTestFixture test({kSsrc1}, {}, kPayloadType, {});
test.SetActiveModules({true});
test.SetSending(true);
RtpHeaderExtensionMap extensions;
extensions.Register<RtpDependencyDescriptorExtension>(
@ -863,7 +840,7 @@ TEST(RtpVideoSenderTest, SupportsDependencyDescriptorForVp9) {
TEST(RtpVideoSenderTest,
SupportsDependencyDescriptorForVp9NotProvidedByEncoder) {
RtpVideoSenderTestFixture test({kSsrc1}, {}, kPayloadType, {});
test.SetActiveModules({true});
test.SetSending(true);
RtpHeaderExtensionMap extensions;
extensions.Register<RtpDependencyDescriptorExtension>(
@ -918,7 +895,7 @@ TEST(RtpVideoSenderTest, GenerateDependecyDescriptorForGenericCodecs) {
test::ScopedKeyValueConfig field_trials(
"WebRTC-GenericCodecDependencyDescriptor/Enabled/");
RtpVideoSenderTestFixture test({kSsrc1}, {}, kPayloadType, {}, &field_trials);
test.SetActiveModules({true});
test.SetSending(true);
RtpHeaderExtensionMap extensions;
extensions.Register<RtpDependencyDescriptorExtension>(
@ -964,7 +941,7 @@ TEST(RtpVideoSenderTest, GenerateDependecyDescriptorForGenericCodecs) {
TEST(RtpVideoSenderTest, SupportsStoppingUsingDependencyDescriptor) {
RtpVideoSenderTestFixture test({kSsrc1}, {}, kPayloadType, {});
test.SetActiveModules({true});
test.SetSending(true);
RtpHeaderExtensionMap extensions;
extensions.Register<RtpDependencyDescriptorExtension>(
@ -1049,7 +1026,7 @@ TEST(RtpVideoSenderTest, OverheadIsSubtractedFromTargetBitrate) {
kRtpHeaderSizeBytes + kTransportPacketOverheadBytes;
RtpVideoSenderTestFixture test({kSsrc1}, {}, kPayloadType, {}, &field_trials);
test.router()->OnTransportOverheadChanged(kTransportPacketOverheadBytes);
test.SetActiveModules({true});
test.SetSending(true);
{
test.router()->OnBitrateUpdated(CreateBitrateAllocationUpdate(300000),
@ -1076,7 +1053,7 @@ TEST(RtpVideoSenderTest, OverheadIsSubtractedFromTargetBitrate) {
TEST(RtpVideoSenderTest, ClearsPendingPacketsOnInactivation) {
RtpVideoSenderTestFixture test({kSsrc1}, {kRtxSsrc1}, kPayloadType, {});
test.SetActiveModules({true});
test.SetSending(true);
RtpHeaderExtensionMap extensions;
extensions.Register<RtpDependencyDescriptorExtension>(
@ -1127,13 +1104,13 @@ TEST(RtpVideoSenderTest, ClearsPendingPacketsOnInactivation) {
// Disable the sending module and advance time slightly. No packets should be
// sent.
test.SetActiveModules({false});
test.SetSending(false);
test.AdvanceTime(TimeDelta::Millis(20));
EXPECT_TRUE(sent_packets.empty());
// Reactive the send module - any packets should have been removed, so nothing
// should be transmitted.
test.SetActiveModules({true});
test.SetSending(true);
test.AdvanceTime(TimeDelta::Millis(33));
EXPECT_TRUE(sent_packets.empty());
@ -1156,7 +1133,7 @@ TEST(RtpVideoSenderTest, ClearsPendingPacketsOnInactivation) {
TEST(RtpVideoSenderTest, RetransmitsBaseLayerOnly) {
RtpVideoSenderTestFixture test({kSsrc1, kSsrc2}, {kRtxSsrc1, kRtxSsrc2},
kPayloadType, {});
test.SetActiveModules({true, true});
test.SetSending(true);
test.router()->SetRetransmissionMode(kRetransmitBaseLayer);
constexpr uint8_t kPayload = 'a';

View file

@ -50,6 +50,11 @@ class MockRtpTransportControllerSend
DestroyRtpVideoSender,
(RtpVideoSenderInterface*),
(override));
MOCK_METHOD(void, RegisterSendingRtpStream, (RtpRtcpInterface&), (override));
MOCK_METHOD(void,
DeRegisterSendingRtpStream,
(RtpRtcpInterface&),
(override));
MOCK_METHOD(PacketRouter*, packet_router, (), (override));
MOCK_METHOD(NetworkStateEstimateObserver*,
network_state_estimate_observer,
@ -64,6 +69,10 @@ class MockRtpTransportControllerSend
SetAllocatedSendBitrateLimits,
(BitrateAllocationLimits),
(override));
MOCK_METHOD(void,
ReconfigureBandwidthEstimation,
(const BandwidthEstimationSettings&),
(override));
MOCK_METHOD(void, SetPacingFactor, (float), (override));
MOCK_METHOD(void, SetQueueTimeLimit, (int), (override));
MOCK_METHOD(StreamFeedbackProvider*,

View file

@ -13,7 +13,7 @@
namespace webrtc {
// The timestamp is always in UTC.
const char* const kSourceTimestamp = "WebRTC source stamp 2024-01-21T04:12:31";
const char* const kSourceTimestamp = "WebRTC source stamp 2024-02-18T04:06:34";
void LoadWebRTCVersionInRegister() {
// Using volatile to instruct the compiler to not optimize `p` away even

View file

@ -212,20 +212,8 @@ class VideoSendStream {
Config(const Config&);
};
// Updates the sending state for all simulcast layers that the video send
// stream owns. This can mean updating the activity one or for multiple
// layers. The ordering of active layers is the order in which the
// rtp modules are stored in the VideoSendStream.
// Note: This starts stream activity if it is inactive and one of the layers
// is active. This stops stream activity if it is active and all layers are
// inactive.
// `active_layers` should have the same size as the number of configured
// simulcast layers or one if only one rtp stream is used.
virtual void StartPerRtpStream(std::vector<bool> active_layers) = 0;
// Starts stream activity.
// When a stream is active, it can receive, process and deliver packets.
// Prefer to use StartPerRtpStream.
virtual void Start() = 0;
// Stops stream activity.
@ -234,11 +222,8 @@ class VideoSendStream {
// Accessor for determining if the stream is active. This is an inexpensive
// call that must be made on the same thread as `Start()` and `Stop()` methods
// are called on and will return `true` iff activity has been started either
// via `Start()` or `StartPerRtpStream()`. If activity is either
// stopped or is in the process of being stopped as a result of a call to
// either `Stop()` or `StartPerRtpStream()` where all layers were
// deactivated, the return value will be `false`.
// are called on and will return `true` iff activity has been started
// via `Start()`.
virtual bool started() = 0;
// If the resource is overusing, the VideoSendStream will try to reduce

View file

@ -35,7 +35,8 @@ static const float kSamples[] = {0.0, 10.0, 4e4, -1e9};
// Write a tiny WAV file with the C++ interface and verify the result.
TEST(WavWriterTest, MAYBE_CPP) {
const std::string outfile = test::OutputPath() + "wavtest1.wav";
const std::string outfile =
test::OutputPathWithRandomDirectory() + "wavtest1.wav";
static const size_t kNumSamples = 3;
{
WavWriter w(outfile, 14099, 1);
@ -112,7 +113,8 @@ TEST(WavWriterTest, LargeFile) {
{WavFile::SampleFormat::kInt16, WavFile::SampleFormat::kFloat}) {
for (WavFile::SampleFormat read_format :
{WavFile::SampleFormat::kInt16, WavFile::SampleFormat::kFloat}) {
std::string outfile = test::OutputPath() + "wavtest3.wav";
std::string outfile =
test::OutputPathWithRandomDirectory() + "wavtest3.wav";
float samples[kNumSamples];
for (size_t i = 0; i < kNumSamples; i += kNumChannels) {
// A nice periodic beeping sound.
@ -177,7 +179,8 @@ TEST(WavWriterTest, LargeFile) {
// Write a tiny WAV file with the C++ interface then read-reset-read.
TEST(WavReaderTest, MAYBE_CPPReset) {
const std::string outfile = test::OutputPath() + "wavtest4.wav";
const std::string outfile =
test::OutputPathWithRandomDirectory() + "wavtest4.wav";
static const size_t kNumSamples = 3;
{
WavWriter w(outfile, 14099, 1);

View file

@ -531,8 +531,7 @@ absl::optional<int> H265BitstreamParser::GetLastSliceQp() const {
if (!last_slice_qp_delta_ || !last_slice_pps_id_) {
return absl::nullopt;
}
uint32_t pps_id = 0;
const H265PpsParser::PpsState* pps = GetPPS(pps_id);
const H265PpsParser::PpsState* pps = GetPPS(last_slice_pps_id_.value());
if (!pps)
return absl::nullopt;
const int parsed_qp = 26 + pps->init_qp_minus26 + *last_slice_qp_delta_;

View file

@ -55,11 +55,15 @@ enum NaluType : uint8_t {
kAud = 35,
kPrefixSei = 39,
kSuffixSei = 40,
// Aggregation packets, refer to section 4.4.2 in RFC 7798.
kAp = 48,
kFu = 49
// Fragmentation units, refer to section 4.4.3 in RFC 7798.
kFu = 49,
// PACI packets, refer to section 4.4.4 in RFC 7798.
kPaci = 50
};
// Slice type definition. See table 7-7 of the H265 spec
// Slice type definition. See table 7-7 of the H.265 spec
enum SliceType : uint8_t { kB = 0, kP = 1, kI = 2 };
struct NaluIndex {
@ -78,7 +82,7 @@ std::vector<NaluIndex> FindNaluIndices(const uint8_t* buffer,
// Get the NAL type from the header byte immediately following start sequence.
NaluType ParseNaluType(uint8_t data);
// Methods for parsing and writing RBSP. See section 7.4.2 of the H265 spec.
// Methods for parsing and writing RBSP. See section 7.4.2 of the H.265 spec.
//
// The following sequences are illegal, and need to be escaped when encoding:
// 00 00 00 -> 00 00 03 00

View file

@ -702,6 +702,8 @@ if (is_linux || is_chromeos || is_win) {
"../api/video_codecs:video_codecs_api",
"../media:media_channel",
"../media:rtc_media_base",
"../p2p:connection",
"../p2p:port_allocator",
"../p2p:rtc_p2p",
"../pc:video_track_source",
"../rtc_base:async_dns_resolver",
@ -808,7 +810,9 @@ if (is_linux || is_chromeos || is_win) {
sources = [ "turnserver/turnserver_main.cc" ]
deps = [
":read_auth_file",
"../p2p:basic_packet_socket_factory",
"../p2p:p2p_server_utils",
"../p2p:port_interface",
"../p2p:rtc_p2p",
"../pc:rtc_pc",
"../rtc_base:async_udp_socket",
@ -949,6 +953,7 @@ if (!build_with_chromium) {
testonly = true
sources = [ "stunprober/main.cc" ]
deps = [
"../p2p:basic_packet_socket_factory",
"../p2p:libstunprober",
"../p2p:rtc_p2p",
"../rtc_base:checks",

View file

@ -47,9 +47,18 @@ ACTIVE_FIELD_TRIALS: FrozenSet[FieldTrial] = frozenset([
FieldTrial('WebRTC-Audio-GainController2',
'webrtc:7494',
date(2024, 4, 1)),
FieldTrial('WebRTC-Audio-NetEqFecDelayAdaptation',
'webrtc:13322',
date(2024, 4, 1)),
FieldTrial('WebRTC-Audio-OpusSetSignalVoiceWithDtx',
'webrtc:4559',
date(2024, 4, 1)),
FieldTrial('WebRTC-Audio-OpusGeneratePlc',
'webrtc:13322',
date(2024, 4, 1)),
FieldTrial('WebRTC-Audio-PriorityBitrate',
'webrtc:15769',
date(2024, 4, 1)),
FieldTrial('WebRTC-AV1-OverridePriorityBitrate',
'webrtc:15763',
date(2024, 4, 1)),
@ -83,6 +92,12 @@ ACTIVE_FIELD_TRIALS: FrozenSet[FieldTrial] = frozenset([
FieldTrial('WebRTC-LibaomAv1Encoder-DisableFrameDropping',
'webrtc:15225',
date(2024, 4, 1)),
FieldTrial('WebRTC-LibaomAv1Encoder-MaxConsecFrameDrop',
'webrtc:15821',
date(2024, 4, 1)),
FieldTrial('WebRTC-LibvpxVp9Encoder-SvcFrameDropConfig',
'webrtc:15827',
date(2024, 9, 1)),
FieldTrial('WebRTC-Pacer-FastRetransmissions',
'chromium:1354491',
date(2024, 4, 1)),

File diff suppressed because it is too large Load diff

View file

@ -7,7 +7,7 @@
"args": [
"--xctest",
"--xcode-build-version",
"15a507",
"15c500b",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
@ -29,12 +29,12 @@
],
"dimensions": {
"device_status": "available",
"os": "iOS-16.6",
"os": "iOS-16.7.1",
"pool": "chrome.tests"
},
"named_caches": [
{
"name": "xcode_ios_15a507",
"name": "xcode_ios_15c500b",
"path": "Xcode.app"
}
],
@ -47,7 +47,7 @@
"args": [
"--xctest",
"--xcode-build-version",
"15a507",
"15c500b",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
@ -69,12 +69,12 @@
],
"dimensions": {
"device_status": "available",
"os": "iOS-16.6",
"os": "iOS-16.7.1",
"pool": "chrome.tests"
},
"named_caches": [
{
"name": "xcode_ios_15a507",
"name": "xcode_ios_15c500b",
"path": "Xcode.app"
}
],
@ -88,7 +88,7 @@
"--readline-timeout=1200",
"--xctest",
"--xcode-build-version",
"15a507",
"15c500b",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
@ -110,14 +110,14 @@
],
"dimensions": {
"device_status": "available",
"os": "iOS-16.6",
"os": "iOS-16.7.1",
"pool": "chrome.tests"
},
"hard_timeout": 7200,
"io_timeout": 7200,
"named_caches": [
{
"name": "xcode_ios_15a507",
"name": "xcode_ios_15c500b",
"path": "Xcode.app"
}
],
@ -131,7 +131,7 @@
"args": [
"--xctest",
"--xcode-build-version",
"15a507",
"15c500b",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
@ -153,12 +153,12 @@
],
"dimensions": {
"device_status": "available",
"os": "iOS-16.6",
"os": "iOS-16.7.1",
"pool": "chrome.tests"
},
"named_caches": [
{
"name": "xcode_ios_15a507",
"name": "xcode_ios_15c500b",
"path": "Xcode.app"
}
],
@ -172,7 +172,7 @@
"args": [
"--xctest",
"--xcode-build-version",
"15a507",
"15c500b",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
@ -194,12 +194,12 @@
],
"dimensions": {
"device_status": "available",
"os": "iOS-16.6",
"os": "iOS-16.7.1",
"pool": "chrome.tests"
},
"named_caches": [
{
"name": "xcode_ios_15a507",
"name": "xcode_ios_15c500b",
"path": "Xcode.app"
}
],
@ -212,7 +212,7 @@
"args": [
"--xctest",
"--xcode-build-version",
"15a507",
"15c500b",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
@ -234,12 +234,12 @@
],
"dimensions": {
"device_status": "available",
"os": "iOS-16.6",
"os": "iOS-16.7.1",
"pool": "chrome.tests"
},
"named_caches": [
{
"name": "xcode_ios_15a507",
"name": "xcode_ios_15c500b",
"path": "Xcode.app"
}
],
@ -252,7 +252,7 @@
"args": [
"--xctest",
"--xcode-build-version",
"15a507",
"15c500b",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
@ -274,12 +274,12 @@
],
"dimensions": {
"device_status": "available",
"os": "iOS-16.6",
"os": "iOS-16.7.1",
"pool": "chrome.tests"
},
"named_caches": [
{
"name": "xcode_ios_15a507",
"name": "xcode_ios_15c500b",
"path": "Xcode.app"
}
],
@ -292,7 +292,7 @@
"args": [
"--xctest",
"--xcode-build-version",
"15a507",
"15c500b",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
@ -314,12 +314,12 @@
],
"dimensions": {
"device_status": "available",
"os": "iOS-16.6",
"os": "iOS-16.7.1",
"pool": "chrome.tests"
},
"named_caches": [
{
"name": "xcode_ios_15a507",
"name": "xcode_ios_15c500b",
"path": "Xcode.app"
}
],
@ -332,7 +332,7 @@
"args": [
"--xctest",
"--xcode-build-version",
"15a507",
"15c500b",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
@ -354,12 +354,12 @@
],
"dimensions": {
"device_status": "available",
"os": "iOS-16.6",
"os": "iOS-16.7.1",
"pool": "chrome.tests"
},
"named_caches": [
{
"name": "xcode_ios_15a507",
"name": "xcode_ios_15c500b",
"path": "Xcode.app"
}
],
@ -372,7 +372,7 @@
"args": [
"--xctest",
"--xcode-build-version",
"15a507",
"15c500b",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
@ -394,12 +394,12 @@
],
"dimensions": {
"device_status": "available",
"os": "iOS-16.6",
"os": "iOS-16.7.1",
"pool": "chrome.tests"
},
"named_caches": [
{
"name": "xcode_ios_15a507",
"name": "xcode_ios_15c500b",
"path": "Xcode.app"
}
],
@ -472,7 +472,7 @@
"args": [
"--xctest",
"--xcode-build-version",
"15a507",
"15c500b",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
@ -494,12 +494,12 @@
],
"dimensions": {
"device_status": "available",
"os": "iOS-16.6",
"os": "iOS-16.7.1",
"pool": "chrome.tests"
},
"named_caches": [
{
"name": "xcode_ios_15a507",
"name": "xcode_ios_15c500b",
"path": "Xcode.app"
}
],
@ -512,7 +512,7 @@
"args": [
"--xctest",
"--xcode-build-version",
"15a507",
"15c500b",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
@ -534,12 +534,12 @@
],
"dimensions": {
"device_status": "available",
"os": "iOS-16.6",
"os": "iOS-16.7.1",
"pool": "chrome.tests"
},
"named_caches": [
{
"name": "xcode_ios_15a507",
"name": "xcode_ios_15c500b",
"path": "Xcode.app"
}
],
@ -553,7 +553,7 @@
"--readline-timeout=1200",
"--xctest",
"--xcode-build-version",
"15a507",
"15c500b",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
@ -575,14 +575,14 @@
],
"dimensions": {
"device_status": "available",
"os": "iOS-16.6",
"os": "iOS-16.7.1",
"pool": "chrome.tests"
},
"hard_timeout": 7200,
"io_timeout": 7200,
"named_caches": [
{
"name": "xcode_ios_15a507",
"name": "xcode_ios_15c500b",
"path": "Xcode.app"
}
],
@ -596,7 +596,7 @@
"args": [
"--xctest",
"--xcode-build-version",
"15a507",
"15c500b",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
@ -618,12 +618,12 @@
],
"dimensions": {
"device_status": "available",
"os": "iOS-16.6",
"os": "iOS-16.7.1",
"pool": "chrome.tests"
},
"named_caches": [
{
"name": "xcode_ios_15a507",
"name": "xcode_ios_15c500b",
"path": "Xcode.app"
}
],
@ -637,7 +637,7 @@
"args": [
"--xctest",
"--xcode-build-version",
"15a507",
"15c500b",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
@ -659,12 +659,12 @@
],
"dimensions": {
"device_status": "available",
"os": "iOS-16.6",
"os": "iOS-16.7.1",
"pool": "chrome.tests"
},
"named_caches": [
{
"name": "xcode_ios_15a507",
"name": "xcode_ios_15c500b",
"path": "Xcode.app"
}
],
@ -677,7 +677,7 @@
"args": [
"--xctest",
"--xcode-build-version",
"15a507",
"15c500b",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
@ -699,12 +699,12 @@
],
"dimensions": {
"device_status": "available",
"os": "iOS-16.6",
"os": "iOS-16.7.1",
"pool": "chrome.tests"
},
"named_caches": [
{
"name": "xcode_ios_15a507",
"name": "xcode_ios_15c500b",
"path": "Xcode.app"
}
],
@ -717,7 +717,7 @@
"args": [
"--xctest",
"--xcode-build-version",
"15a507",
"15c500b",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
@ -739,12 +739,12 @@
],
"dimensions": {
"device_status": "available",
"os": "iOS-16.6",
"os": "iOS-16.7.1",
"pool": "chrome.tests"
},
"named_caches": [
{
"name": "xcode_ios_15a507",
"name": "xcode_ios_15c500b",
"path": "Xcode.app"
}
],
@ -757,7 +757,7 @@
"args": [
"--xctest",
"--xcode-build-version",
"15a507",
"15c500b",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
@ -779,12 +779,12 @@
],
"dimensions": {
"device_status": "available",
"os": "iOS-16.6",
"os": "iOS-16.7.1",
"pool": "chrome.tests"
},
"named_caches": [
{
"name": "xcode_ios_15a507",
"name": "xcode_ios_15c500b",
"path": "Xcode.app"
}
],
@ -797,7 +797,7 @@
"args": [
"--xctest",
"--xcode-build-version",
"15a507",
"15c500b",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
@ -819,12 +819,12 @@
],
"dimensions": {
"device_status": "available",
"os": "iOS-16.6",
"os": "iOS-16.7.1",
"pool": "chrome.tests"
},
"named_caches": [
{
"name": "xcode_ios_15a507",
"name": "xcode_ios_15c500b",
"path": "Xcode.app"
}
],
@ -837,7 +837,7 @@
"args": [
"--xctest",
"--xcode-build-version",
"15a507",
"15c500b",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
@ -859,12 +859,12 @@
],
"dimensions": {
"device_status": "available",
"os": "iOS-16.6",
"os": "iOS-16.7.1",
"pool": "chrome.tests"
},
"named_caches": [
{
"name": "xcode_ios_15a507",
"name": "xcode_ios_15c500b",
"path": "Xcode.app"
}
],

View file

@ -58,10 +58,10 @@
'has_native_resultdb_integration': True
}
},
'ios-device-16.6': {
'ios-device-16.7': {
'swarming': {
'dimensions': {
'os': 'iOS-16.6',
'os': 'iOS-16.7.1',
'pool': 'chrome.tests',
'device_status': 'available'
}
@ -94,11 +94,11 @@
}]
}
},
'ios_runtime_cache_17_0': {
'ios_runtime_cache_17_4': {
'swarming': {
'named_caches': [{
'name': 'runtime_ios_17_0',
'path': 'Runtime-ios-17.0'
'name': 'runtime_ios_17_4',
'path': 'Runtime-ios-17.4'
}]
}
},
@ -124,6 +124,13 @@
}
}
},
'linux-jammy': {
'swarming': {
'dimensions': {
'os': 'Ubuntu-22.04'
}
}
},
'mac-m1-cpu': {
'swarming': {
'dimensions': {
@ -320,10 +327,10 @@
}
},
'xcode_15_main': {
'args': ['--xcode-build-version', '15a507'],
'args': ['--xcode-build-version', '15c500b'],
'swarming': {
'named_caches': [{
'name': 'xcode_ios_15a507',
'name': 'xcode_ios_15c500b',
'path': 'Xcode.app'
}]
}

View file

@ -38,10 +38,10 @@
'--test-arg=--undefok=test_launcher_summary_output'
],
},
'ios-device-16.6': {
'ios-device-16.7': {
'swarming': {
'dimensions': {
'os': 'iOS-16.6',
'os': 'iOS-16.7.1',
'pool': 'chrome.tests',
'device_status': 'available'
}

View file

@ -263,7 +263,7 @@
'variants': [
'SIM_IPHONE_X_15_5',
'SIM_IPHONE_X_16_4',
'SIM_IPHONE_14_17_0',
'SIM_IPHONE_14_17_4',
],
},
},

File diff suppressed because it is too large Load diff

View file

@ -27,14 +27,14 @@
'identifier': 'iPhone X 16.4',
'mixins': ['xcode_15_main', 'ios_runtime_cache_16_4'],
},
'SIM_IPHONE_14_17_0': {
'SIM_IPHONE_14_17_4': {
'args': [
'--platform',
'iPhone 14',
'--version',
'17.0',
'17.4',
],
'identifier': 'iPhone 14 17.0',
'mixins': ['xcode_15_main', 'ios_runtime_cache_17_0'],
'identifier': 'iPhone 14 17.4',
'mixins': ['xcode_15_main', 'ios_runtime_cache_17_4'],
},
}

View file

@ -70,7 +70,7 @@
'os_type':
'linux',
'mixins': [
'linux-focal', 'x86-64', 'fuchsia-gtest-output',
'linux-jammy', 'x86-64', 'fuchsia-gtest-output',
'resultdb-gtest-json-format'
],
'test_suites': {
@ -79,7 +79,7 @@
},
'Linux (more configs)': {
'os_type': 'linux',
'mixins': ['linux-focal', 'x86-64', 'resultdb-json-format'],
'mixins': ['linux-jammy', 'x86-64', 'resultdb-json-format'],
'test_suites': {
'isolated_scripts': 'more_configs_tests',
},
@ -127,7 +127,7 @@
},
'Linux32 Debug': {
'os_type': 'linux',
'mixins': ['linux-focal', 'x86-64', 'resultdb-json-format'],
'mixins': ['linux-jammy', 'x86-64', 'resultdb-json-format'],
'test_suites': {
'isolated_scripts': 'desktop_tests',
},
@ -135,7 +135,7 @@
'Linux32 Debug (ARM)': {},
'Linux32 Release': {
'os_type': 'linux',
'mixins': ['linux-focal', 'x86-64', 'resultdb-json-format'],
'mixins': ['linux-jammy', 'x86-64', 'resultdb-json-format'],
'test_suites': {
'isolated_scripts': 'desktop_tests',
},
@ -144,7 +144,7 @@
'Linux64 Builder': {},
'Linux64 Debug': {
'os_type': 'linux',
'mixins': ['linux-focal', 'x86-64', 'resultdb-json-format'],
'mixins': ['linux-jammy', 'x86-64', 'resultdb-json-format'],
'test_suites': {
'isolated_scripts': 'linux_tests',
},
@ -152,7 +152,7 @@
'Linux64 Debug (ARM)': {},
'Linux64 Release': {
'os_type': 'linux',
'mixins': ['linux-focal', 'x86-64', 'resultdb-json-format'],
'mixins': ['linux-jammy', 'x86-64', 'resultdb-json-format'],
'test_suites': {
'isolated_scripts': 'linux_tests',
},
@ -322,7 +322,7 @@
'machines': {
'iOS64 Debug': {
'mixins': [
'ios-device-16.6', 'webrtc-xctest', 'chrome-tester-service-account',
'ios-device-16.7', 'webrtc-xctest', 'chrome-tester-service-account',
'xcode_15_main', 'mac_toolchain', 'has_native_resultdb_integration',
'out_dir_arg'
],
@ -345,7 +345,7 @@
},
'iOS64 Release': {
'mixins': [
'ios-device-16.6', 'webrtc-xctest', 'chrome-tester-service-account',
'ios-device-16.7', 'webrtc-xctest', 'chrome-tester-service-account',
'xcode_15_main', 'mac_toolchain', 'has_native_resultdb_integration',
'out_dir_arg'
],
@ -420,7 +420,7 @@
'os_type':
'linux',
'mixins': [
'linux-focal', 'x86-64', 'fuchsia-gtest-output',
'linux-jammy', 'x86-64', 'fuchsia-gtest-output',
'resultdb-gtest-json-format'
],
'test_suites': {
@ -455,7 +455,7 @@
'os_type':
'linux',
'mixins': [
'linux-focal', 'x86-64', 'resultdb-json-format',
'linux-jammy', 'x86-64', 'resultdb-json-format',
'isolate_profile_data'
],
'test_suites': {
@ -464,7 +464,7 @@
},
'linux_dbg': {
'os_type': 'linux',
'mixins': ['linux-focal', 'x86-64', 'resultdb-json-format'],
'mixins': ['linux-jammy', 'x86-64', 'resultdb-json-format'],
'test_suites': {
'isolated_scripts': 'linux_tests',
},
@ -472,14 +472,14 @@
'linux_libfuzzer_rel': {},
'linux_memcheck': {
'os_type': 'linux',
'mixins': ['linux-focal', 'x86-64', 'resultdb-json-format'],
'mixins': ['linux-jammy', 'x86-64', 'resultdb-json-format'],
'test_suites': {
'isolated_scripts': 'linux_tests',
},
},
'linux_more_configs': {
'os_type': 'linux',
'mixins': ['linux-focal', 'x86-64', 'resultdb-json-format'],
'mixins': ['linux-jammy', 'x86-64', 'resultdb-json-format'],
'test_suites': {
'isolated_scripts': 'more_configs_tests',
},
@ -496,7 +496,7 @@
},
'linux_rel': {
'os_type': 'linux',
'mixins': ['linux-focal', 'x86-64', 'resultdb-json-format'],
'mixins': ['linux-jammy', 'x86-64', 'resultdb-json-format'],
'test_suites': {
'isolated_scripts': 'linux_desktop_tests_tryserver',
},
@ -527,14 +527,14 @@
},
'linux_x86_dbg': {
'os_type': 'linux',
'mixins': ['linux-focal', 'x86-64', 'resultdb-json-format'],
'mixins': ['linux-jammy', 'x86-64', 'resultdb-json-format'],
'test_suites': {
'isolated_scripts': 'desktop_tests',
},
},
'linux_x86_rel': {
'os_type': 'linux',
'mixins': ['linux-focal', 'x86-64', 'resultdb-json-format'],
'mixins': ['linux-jammy', 'x86-64', 'resultdb-json-format'],
'test_suites': {
'isolated_scripts': 'desktop_tests',
},

View file

@ -353,6 +353,7 @@ rtc_library("rtc_event_log_impl_encoder") {
deps = [
":rtc_event_number_encodings",
"../api:field_trials_view",
"../api:rtp_headers",
"../api:rtp_parameters",
"../api/transport:network_control",
@ -362,7 +363,6 @@ rtc_library("rtc_event_log_impl_encoder") {
"../rtc_base:checks",
"../rtc_base:logging",
"../rtc_base:safe_conversions",
"../system_wrappers:field_trial",
]
absl_deps = [
"//third_party/abseil-cpp/absl/memory",
@ -609,6 +609,7 @@ if (rtc_enable_protobuf) {
":rtc_event_video",
":rtc_stream_config",
"../api:array_view",
"../api:field_trials_view",
"../api:network_state_predictor_api",
"../api:rtc_event_log_output_file",
"../api:rtp_headers",
@ -630,9 +631,7 @@ if (rtc_enable_protobuf) {
"../rtc_base:rtc_base_tests_utils",
"../rtc_base:timeutils",
"../system_wrappers",
"../system_wrappers:field_trial",
"../test:explicit_key_value_config",
"../test:field_trial",
"../test:fileutils",
"../test:test_support",
"../test/logging:log_writer",
@ -689,6 +688,7 @@ rtc_library("ice_log") {
deps = [
":rtc_event_field",
"../api:candidate",
"../api:dtls_transport_interface",
"../api:libjingle_logging_api",
"../api/rtc_event_log",

View file

@ -131,21 +131,15 @@ ConvertIceCandidatePairConfigType(IceCandidatePairConfigType type) {
rtclog::IceCandidatePairConfig::IceCandidateType ConvertIceCandidateType(
IceCandidateType type) {
switch (type) {
case IceCandidateType::kUnknown:
return rtclog::IceCandidatePairConfig::UNKNOWN_CANDIDATE_TYPE;
case IceCandidateType::kLocal:
case IceCandidateType::kHost:
return rtclog::IceCandidatePairConfig::LOCAL;
case IceCandidateType::kStun:
case IceCandidateType::kSrflx:
return rtclog::IceCandidatePairConfig::STUN;
case IceCandidateType::kPrflx:
return rtclog::IceCandidatePairConfig::PRFLX;
case IceCandidateType::kRelay:
return rtclog::IceCandidatePairConfig::RELAY;
case IceCandidateType::kNumValues:
RTC_DCHECK_NOTREACHED();
}
RTC_DCHECK_NOTREACHED();
return rtclog::IceCandidatePairConfig::UNKNOWN_CANDIDATE_TYPE;
}
rtclog::IceCandidatePairConfig::Protocol ConvertIceCandidatePairProtocol(
@ -202,6 +196,7 @@ rtclog::IceCandidatePairConfig::NetworkType ConvertIceCandidateNetworkType(
return rtclog::IceCandidatePairConfig::CELLULAR;
case IceCandidateNetworkType::kNumValues:
RTC_DCHECK_NOTREACHED();
break;
}
RTC_DCHECK_NOTREACHED();
return rtclog::IceCandidatePairConfig::UNKNOWN_NETWORK_TYPE;

View file

@ -10,8 +10,11 @@
#include "logging/rtc_event_log/encoder/rtc_event_log_encoder_new_format.h"
#include <type_traits>
#include "absl/types/optional.h"
#include "api/array_view.h"
#include "api/field_trials_view.h"
#include "api/network_state_predictor.h"
#include "logging/rtc_event_log/dependency_descriptor_encoder_decoder.h"
#include "logging/rtc_event_log/encoder/blob_encoding.h"
@ -62,7 +65,6 @@
#include "modules/rtp_rtcp/source/rtp_packet.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "system_wrappers/include/field_trial.h"
// *.pb.h files are generated at build-time by the protobuf compiler.
#ifdef WEBRTC_ANDROID_PLATFORM_BUILD
@ -198,18 +200,14 @@ ConvertToProtoFormat(IceCandidatePairConfigType type) {
rtclog2::IceCandidatePairConfig::IceCandidateType ConvertToProtoFormat(
IceCandidateType type) {
switch (type) {
case IceCandidateType::kUnknown:
return rtclog2::IceCandidatePairConfig::UNKNOWN_CANDIDATE_TYPE;
case IceCandidateType::kLocal:
case IceCandidateType::kHost:
return rtclog2::IceCandidatePairConfig::LOCAL;
case IceCandidateType::kStun:
case IceCandidateType::kSrflx:
return rtclog2::IceCandidatePairConfig::STUN;
case IceCandidateType::kPrflx:
return rtclog2::IceCandidatePairConfig::PRFLX;
case IceCandidateType::kRelay:
return rtclog2::IceCandidatePairConfig::RELAY;
case IceCandidateType::kNumValues:
RTC_DCHECK_NOTREACHED();
}
RTC_DCHECK_NOTREACHED();
return rtclog2::IceCandidatePairConfig::UNKNOWN_CANDIDATE_TYPE;
@ -385,10 +383,12 @@ void EncodeRtcpPacket(rtc::ArrayView<const EventType*> batch,
}
proto_batch->set_raw_packet_blobs(EncodeBlobs(scrubed_packets));
}
} // namespace
template <typename EventType, typename ProtoType>
void EncodeRtpPacket(const std::vector<const EventType*>& batch,
ProtoType* proto_batch) {
template <typename Batch, typename ProtoType>
void RtcEventLogEncoderNewFormat::EncodeRtpPacket(const Batch& batch,
ProtoType* proto_batch) {
using EventType = std::remove_pointer_t<typename Batch::value_type>;
if (batch.empty()) {
return;
}
@ -463,8 +463,7 @@ void EncodeRtpPacket(const std::vector<const EventType*>& batch,
{
// TODO(webrtc:14975) Remove this kill switch after DD in RTC event log has
// been rolled out.
if (!webrtc::field_trial::IsDisabled(
"WebRTC-RtcEventLogEncodeDependencyDescriptor")) {
if (encode_dependency_descriptor_) {
std::vector<rtc::ArrayView<const uint8_t>> raw_dds(batch.size());
bool has_dd = false;
for (size_t i = 0; i < batch.size(); ++i) {
@ -678,15 +677,13 @@ void EncodeRtpPacket(const std::vector<const EventType*>& batch,
proto_batch->set_voice_activity_deltas(encoded_deltas);
}
}
} // namespace
RtcEventLogEncoderNewFormat::RtcEventLogEncoderNewFormat() {
encode_neteq_set_minimum_delay_kill_switch_ = false;
if (webrtc::field_trial::IsEnabled(
"WebRTC-RtcEventLogEncodeNetEqSetMinimumDelayKillSwitch")) {
encode_neteq_set_minimum_delay_kill_switch_ = true;
}
}
RtcEventLogEncoderNewFormat::RtcEventLogEncoderNewFormat(
const FieldTrialsView& field_trials)
: encode_neteq_set_minimum_delay_kill_switch_(field_trials.IsEnabled(
"WebRTC-RtcEventLogEncodeNetEqSetMinimumDelayKillSwitch")),
encode_dependency_descriptor_(!field_trials.IsDisabled(
"WebRTC-RtcEventLogEncodeDependencyDescriptor")) {}
std::string RtcEventLogEncoderNewFormat::EncodeLogStart(int64_t timestamp_us,
int64_t utc_time_us) {

View file

@ -18,6 +18,7 @@
#include <vector>
#include "api/array_view.h"
#include "api/field_trials_view.h"
#include "logging/rtc_event_log/encoder/rtc_event_log_encoder.h"
namespace webrtc {
@ -59,7 +60,7 @@ class RtcEventGenericPacketSent;
class RtcEventLogEncoderNewFormat final : public RtcEventLogEncoder {
public:
RtcEventLogEncoderNewFormat();
explicit RtcEventLogEncoderNewFormat(const FieldTrialsView& field_trials);
~RtcEventLogEncoderNewFormat() override = default;
std::string EncodeBatch(
@ -71,8 +72,6 @@ class RtcEventLogEncoderNewFormat final : public RtcEventLogEncoder {
std::string EncodeLogEnd(int64_t timestamp_us) override;
private:
bool encode_neteq_set_minimum_delay_kill_switch_ = false;
// Encoding entry-point for the various RtcEvent subclasses.
void EncodeAlrState(rtc::ArrayView<const RtcEventAlrState*> batch,
rtclog2::EventStream* event_stream);
@ -157,6 +156,11 @@ class RtcEventLogEncoderNewFormat final : public RtcEventLogEncoder {
void EncodeVideoSendStreamConfig(
rtc::ArrayView<const RtcEventVideoSendStreamConfig*> batch,
rtclog2::EventStream* event_stream);
template <typename Batch, typename ProtoType>
void EncodeRtpPacket(const Batch& batch, ProtoType* proto_batch);
const bool encode_neteq_set_minimum_delay_kill_switch_;
const bool encode_dependency_descriptor_;
};
} // namespace webrtc

View file

@ -14,6 +14,7 @@
#include <string>
#include <tuple>
#include "api/field_trials_view.h"
#include "logging/rtc_event_log/encoder/rtc_event_log_encoder_legacy.h"
#include "logging/rtc_event_log/encoder/rtc_event_log_encoder_new_format.h"
#include "logging/rtc_event_log/encoder/rtc_event_log_encoder_v3.h"
@ -40,10 +41,13 @@
#include "modules/rtp_rtcp/source/rtp_header_extensions.h"
#include "rtc_base/fake_clock.h"
#include "rtc_base/random.h"
#include "test/field_trial.h"
#include "test/explicit_key_value_config.h"
#include "test/gtest.h"
namespace webrtc {
using test::ExplicitKeyValueConfig;
class RtcEventLogEncoderTest
: public ::testing::TestWithParam<
std::tuple<int, RtcEventLog::EncodingType, size_t, bool>> {
@ -55,22 +59,26 @@ class RtcEventLogEncoderTest
event_count_(std::get<2>(GetParam())),
force_repeated_fields_(std::get<3>(GetParam())),
gen_(seed_ * 880001UL),
verifier_(encoding_type_) {
verifier_(encoding_type_) {}
~RtcEventLogEncoderTest() override = default;
std::unique_ptr<RtcEventLogEncoder> CreateEncoder(
const FieldTrialsView& field_trials = ExplicitKeyValueConfig("")) {
std::unique_ptr<RtcEventLogEncoder> encoder;
switch (encoding_type_) {
case RtcEventLog::EncodingType::Legacy:
encoder_ = std::make_unique<RtcEventLogEncoderLegacy>();
encoder = std::make_unique<RtcEventLogEncoderLegacy>();
break;
case RtcEventLog::EncodingType::NewFormat:
encoder_ = std::make_unique<RtcEventLogEncoderNewFormat>();
encoder = std::make_unique<RtcEventLogEncoderNewFormat>(field_trials);
break;
case RtcEventLog::EncodingType::ProtoFree:
encoder_ = std::make_unique<RtcEventLogEncoderV3>();
encoder = std::make_unique<RtcEventLogEncoderV3>();
break;
}
encoded_ =
encoder_->EncodeLogStart(rtc::TimeMillis(), rtc::TimeUTCMillis());
encoded_ = encoder->EncodeLogStart(rtc::TimeMillis(), rtc::TimeUTCMillis());
return encoder;
}
~RtcEventLogEncoderTest() override = default;
// ANA events have some optional fields, so we want to make sure that we get
// correct behavior both when all of the values are there, as well as when
@ -89,10 +97,9 @@ class RtcEventLogEncoderTest
uint32_t ssrc);
template <typename EventType, typename ParsedType>
void TestRtpPackets();
void TestRtpPackets(RtcEventLogEncoder& encoder);
std::deque<std::unique_ptr<RtcEvent>> history_;
std::unique_ptr<RtcEventLogEncoder> encoder_;
ParsedRtcEventLog parsed_log_;
const uint64_t seed_;
Random prng_;
@ -108,12 +115,13 @@ void RtcEventLogEncoderTest::TestRtcEventAudioNetworkAdaptation(
const std::vector<std::unique_ptr<RtcEventAudioNetworkAdaptation>>&
events) {
ASSERT_TRUE(history_.empty()) << "Function should be called once per test.";
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
for (auto& event : events) {
history_.push_back(event->Copy());
}
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& ana_configs = parsed_log_.audio_network_adaptation_events();
@ -165,7 +173,7 @@ RtcEventLogEncoderTest::GetRtpPacketsBySsrc(const ParsedRtcEventLog* parsed_log,
}
template <typename EventType, typename ParsedType>
void RtcEventLogEncoderTest::TestRtpPackets() {
void RtcEventLogEncoderTest::TestRtpPackets(RtcEventLogEncoder& encoder) {
// SSRCs will be randomly assigned out of this small pool, significant only
// in that it also covers such edge cases as SSRC = 0 and SSRC = 0xffffffff.
// The pool is intentionally small, so as to produce collisions.
@ -193,7 +201,7 @@ void RtcEventLogEncoderTest::TestRtpPackets() {
}
// Encode and parse.
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder.EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
// For each SSRC, make sure the RTP packets associated with it to have been
@ -213,6 +221,7 @@ void RtcEventLogEncoderTest::TestRtpPackets() {
}
TEST_P(RtcEventLogEncoderTest, RtcEventAlrState) {
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
std::vector<std::unique_ptr<RtcEventAlrState>> events(event_count_);
for (size_t i = 0; i < event_count_; ++i) {
events[i] = (i == 0 || !force_repeated_fields_) ? gen_.NewAlrState()
@ -220,7 +229,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventAlrState) {
history_.push_back(events[i]->Copy());
}
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& alr_state_events = parsed_log_.alr_state_events();
@ -234,6 +243,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRouteChange) {
if (encoding_type_ == RtcEventLog::EncodingType::Legacy) {
return;
}
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
std::vector<std::unique_ptr<RtcEventRouteChange>> events(event_count_);
for (size_t i = 0; i < event_count_; ++i) {
events[i] = (i == 0 || !force_repeated_fields_) ? gen_.NewRouteChange()
@ -241,7 +251,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRouteChange) {
history_.push_back(events[i]->Copy());
}
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& route_change_events = parsed_log_.route_change_events();
@ -252,6 +262,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRouteChange) {
}
TEST_P(RtcEventLogEncoderTest, RtcEventRemoteEstimate) {
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
std::vector<std::unique_ptr<RtcEventRemoteEstimate>> events(event_count_);
for (size_t i = 0; i < event_count_; ++i) {
events[i] = (i == 0 || !force_repeated_fields_)
@ -260,7 +271,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRemoteEstimate) {
history_.push_back(std::make_unique<RtcEventRemoteEstimate>(*events[i]));
}
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& parsed_events = parsed_log_.remote_estimate_events();
@ -395,6 +406,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventAudioNetworkAdaptationAll) {
}
TEST_P(RtcEventLogEncoderTest, RtcEventAudioPlayout) {
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
// SSRCs will be randomly assigned out of this small pool, significant only
// in that it also covers such edge cases as SSRC = 0 and SSRC = 0xffffffff.
// The pool is intentionally small, so as to produce collisions.
@ -414,7 +426,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventAudioPlayout) {
original_events_by_ssrc[ssrc].push_back(std::move(event));
}
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& parsed_playout_events_by_ssrc =
@ -443,6 +455,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventAudioPlayout) {
}
TEST_P(RtcEventLogEncoderTest, RtcEventNetEqSetMinimumDelayDecoded) {
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
// SSRCs will be randomly assigned out of this small pool, significant only
// in that it also covers such edge cases as SSRC = 0 and SSRC = 0xffffffff.
// The pool is intentionally small, so as to produce collisions.
@ -461,7 +474,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventNetEqSetMinimumDelayDecoded) {
original_events_by_ssrc[ssrc].push_back(std::move(event));
}
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& parsed_neteq_set_minimum_delay_events_by_ssrc =
@ -502,13 +515,14 @@ TEST_P(RtcEventLogEncoderTest, RtcEventNetEqSetMinimumDelayDecoded) {
// TODO(eladalon/terelius): Test with multiple events in the batch.
TEST_P(RtcEventLogEncoderTest, RtcEventAudioReceiveStreamConfig) {
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
uint32_t ssrc = prng_.Rand<uint32_t>();
RtpHeaderExtensionMap extensions = gen_.NewRtpHeaderExtensionMap();
std::unique_ptr<RtcEventAudioReceiveStreamConfig> event =
gen_.NewAudioReceiveStreamConfig(ssrc, extensions);
history_.push_back(event->Copy());
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& audio_recv_configs = parsed_log_.audio_recv_configs();
@ -518,13 +532,14 @@ TEST_P(RtcEventLogEncoderTest, RtcEventAudioReceiveStreamConfig) {
// TODO(eladalon/terelius): Test with multiple events in the batch.
TEST_P(RtcEventLogEncoderTest, RtcEventAudioSendStreamConfig) {
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
uint32_t ssrc = prng_.Rand<uint32_t>();
RtpHeaderExtensionMap extensions = gen_.NewRtpHeaderExtensionMap();
std::unique_ptr<RtcEventAudioSendStreamConfig> event =
gen_.NewAudioSendStreamConfig(ssrc, extensions);
history_.push_back(event->Copy());
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& audio_send_configs = parsed_log_.audio_send_configs();
@ -533,6 +548,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventAudioSendStreamConfig) {
}
TEST_P(RtcEventLogEncoderTest, RtcEventBweUpdateDelayBased) {
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
std::vector<std::unique_ptr<RtcEventBweUpdateDelayBased>> events(
event_count_);
for (size_t i = 0; i < event_count_; ++i) {
@ -542,7 +558,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventBweUpdateDelayBased) {
history_.push_back(events[i]->Copy());
}
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& bwe_delay_updates = parsed_log_.bwe_delay_updates();
@ -554,6 +570,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventBweUpdateDelayBased) {
}
TEST_P(RtcEventLogEncoderTest, RtcEventBweUpdateLossBased) {
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
std::vector<std::unique_ptr<RtcEventBweUpdateLossBased>> events(event_count_);
for (size_t i = 0; i < event_count_; ++i) {
events[i] = (i == 0 || !force_repeated_fields_)
@ -562,7 +579,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventBweUpdateLossBased) {
history_.push_back(events[i]->Copy());
}
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& bwe_loss_updates = parsed_log_.bwe_loss_updates();
@ -577,6 +594,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventGenericPacketReceived) {
if (encoding_type_ == RtcEventLog::EncodingType::Legacy) {
return;
}
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
std::vector<std::unique_ptr<RtcEventGenericPacketReceived>> events(
event_count_);
for (size_t i = 0; i < event_count_; ++i) {
@ -586,7 +604,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventGenericPacketReceived) {
history_.push_back(events[i]->Copy());
}
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& packets_received = parsed_log_.generic_packets_received();
@ -602,6 +620,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventGenericPacketSent) {
if (encoding_type_ == RtcEventLog::EncodingType::Legacy) {
return;
}
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
std::vector<std::unique_ptr<RtcEventGenericPacketSent>> events(event_count_);
for (size_t i = 0; i < event_count_; ++i) {
events[i] = (i == 0 || !force_repeated_fields_)
@ -610,7 +629,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventGenericPacketSent) {
history_.push_back(events[i]->Copy());
}
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& packets_sent = parsed_log_.generic_packets_sent();
@ -625,6 +644,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventGenericAcksReceived) {
if (encoding_type_ == RtcEventLog::EncodingType::Legacy) {
return;
}
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
std::vector<std::unique_ptr<RtcEventGenericAckReceived>> events(event_count_);
for (size_t i = 0; i < event_count_; ++i) {
events[i] = (i == 0 || !force_repeated_fields_)
@ -633,7 +653,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventGenericAcksReceived) {
history_.push_back(events[i]->Copy());
}
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& decoded_events = parsed_log_.generic_acks_received();
@ -645,6 +665,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventGenericAcksReceived) {
}
TEST_P(RtcEventLogEncoderTest, RtcEventDtlsTransportState) {
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
std::vector<std::unique_ptr<RtcEventDtlsTransportState>> events(event_count_);
for (size_t i = 0; i < event_count_; ++i) {
events[i] = (i == 0 || !force_repeated_fields_)
@ -653,7 +674,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventDtlsTransportState) {
history_.push_back(events[i]->Copy());
}
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& dtls_transport_states = parsed_log_.dtls_transport_states();
@ -670,6 +691,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventDtlsTransportState) {
}
TEST_P(RtcEventLogEncoderTest, RtcEventDtlsWritableState) {
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
std::vector<std::unique_ptr<RtcEventDtlsWritableState>> events(event_count_);
for (size_t i = 0; i < event_count_; ++i) {
events[i] = (i == 0 || !force_repeated_fields_)
@ -678,7 +700,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventDtlsWritableState) {
history_.push_back(events[i]->Copy());
}
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& dtls_writable_states = parsed_log_.dtls_writable_states();
@ -696,6 +718,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventDtlsWritableState) {
}
TEST_P(RtcEventLogEncoderTest, RtcEventFrameDecoded) {
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
// SSRCs will be randomly assigned out of this small pool, significant only
// in that it also covers such edge cases as SSRC = 0 and SSRC = 0xffffffff.
// The pool is intentionally small, so as to produce collisions.
@ -715,7 +738,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventFrameDecoded) {
original_events_by_ssrc[ssrc].push_back(std::move(event));
}
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
auto status = parsed_log_.ParseString(encoded_);
if (!status.ok())
RTC_LOG(LS_ERROR) << status.message();
@ -751,11 +774,12 @@ TEST_P(RtcEventLogEncoderTest, RtcEventFrameDecoded) {
// TODO(eladalon/terelius): Test with multiple events in the batch.
TEST_P(RtcEventLogEncoderTest, RtcEventIceCandidatePairConfig) {
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
std::unique_ptr<RtcEventIceCandidatePairConfig> event =
gen_.NewIceCandidatePairConfig();
history_.push_back(event->Copy());
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& ice_candidate_pair_configs =
parsed_log_.ice_candidate_pair_configs();
@ -767,10 +791,11 @@ TEST_P(RtcEventLogEncoderTest, RtcEventIceCandidatePairConfig) {
// TODO(eladalon/terelius): Test with multiple events in the batch.
TEST_P(RtcEventLogEncoderTest, RtcEventIceCandidatePair) {
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
std::unique_ptr<RtcEventIceCandidatePair> event = gen_.NewIceCandidatePair();
history_.push_back(event->Copy());
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& ice_candidate_pair_events =
parsed_log_.ice_candidate_pair_events();
@ -781,11 +806,12 @@ TEST_P(RtcEventLogEncoderTest, RtcEventIceCandidatePair) {
}
TEST_P(RtcEventLogEncoderTest, RtcEventLoggingStarted) {
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
const int64_t timestamp_ms = prng_.Rand(1'000'000'000);
const int64_t utc_time_ms = prng_.Rand(1'000'000'000);
// Overwrite the previously encoded LogStart event.
encoded_ = encoder_->EncodeLogStart(timestamp_ms * 1000, utc_time_ms * 1000);
encoded_ = encoder->EncodeLogStart(timestamp_ms * 1000, utc_time_ms * 1000);
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& start_log_events = parsed_log_.start_log_events();
@ -795,16 +821,17 @@ TEST_P(RtcEventLogEncoderTest, RtcEventLoggingStarted) {
}
TEST_P(RtcEventLogEncoderTest, RtcEventLoggingStopped) {
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
const int64_t start_timestamp_ms = prng_.Rand(1'000'000'000);
const int64_t start_utc_time_ms = prng_.Rand(1'000'000'000);
// Overwrite the previously encoded LogStart event.
encoded_ = encoder_->EncodeLogStart(start_timestamp_ms * 1000,
start_utc_time_ms * 1000);
encoded_ = encoder->EncodeLogStart(start_timestamp_ms * 1000,
start_utc_time_ms * 1000);
const int64_t stop_timestamp_ms =
prng_.Rand(start_timestamp_ms, 2'000'000'000);
encoded_ += encoder_->EncodeLogEnd(stop_timestamp_ms * 1000);
encoded_ += encoder->EncodeLogEnd(stop_timestamp_ms * 1000);
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& stop_log_events = parsed_log_.stop_log_events();
@ -814,11 +841,12 @@ TEST_P(RtcEventLogEncoderTest, RtcEventLoggingStopped) {
// TODO(eladalon/terelius): Test with multiple events in the batch.
TEST_P(RtcEventLogEncoderTest, RtcEventProbeClusterCreated) {
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
std::unique_ptr<RtcEventProbeClusterCreated> event =
gen_.NewProbeClusterCreated();
history_.push_back(event->Copy());
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& bwe_probe_cluster_created_events =
parsed_log_.bwe_probe_cluster_created_events();
@ -830,11 +858,12 @@ TEST_P(RtcEventLogEncoderTest, RtcEventProbeClusterCreated) {
// TODO(eladalon/terelius): Test with multiple events in the batch.
TEST_P(RtcEventLogEncoderTest, RtcEventProbeResultFailure) {
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
std::unique_ptr<RtcEventProbeResultFailure> event =
gen_.NewProbeResultFailure();
history_.push_back(event->Copy());
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& bwe_probe_failure_events = parsed_log_.bwe_probe_failure_events();
@ -845,11 +874,12 @@ TEST_P(RtcEventLogEncoderTest, RtcEventProbeResultFailure) {
// TODO(eladalon/terelius): Test with multiple events in the batch.
TEST_P(RtcEventLogEncoderTest, RtcEventProbeResultSuccess) {
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
std::unique_ptr<RtcEventProbeResultSuccess> event =
gen_.NewProbeResultSuccess();
history_.push_back(event->Copy());
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& bwe_probe_success_events = parsed_log_.bwe_probe_success_events();
@ -864,6 +894,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpPacketIncoming) {
// As a work around, we're removing duplicates in the parser.
return;
}
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
std::vector<std::unique_ptr<RtcEventRtcpPacketIncoming>> events(event_count_);
for (size_t i = 0; i < event_count_; ++i) {
@ -873,7 +904,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpPacketIncoming) {
history_.push_back(events[i]->Copy());
}
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& incoming_rtcp_packets = parsed_log_.incoming_rtcp_packets();
@ -886,6 +917,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpPacketIncoming) {
}
TEST_P(RtcEventLogEncoderTest, RtcEventRtcpPacketOutgoing) {
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
std::vector<std::unique_ptr<RtcEventRtcpPacketOutgoing>> events(event_count_);
for (size_t i = 0; i < event_count_; ++i) {
events[i] = (i == 0 || !force_repeated_fields_)
@ -894,7 +926,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpPacketOutgoing) {
history_.push_back(events[i]->Copy());
}
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& outgoing_rtcp_packets = parsed_log_.outgoing_rtcp_packets();
@ -914,6 +946,8 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpReceiverReport) {
rtc::ScopedFakeClock fake_clock;
fake_clock.SetTime(Timestamp::Millis(prng_.Rand<uint32_t>()));
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
for (auto direction : {kIncomingPacket, kOutgoingPacket}) {
std::vector<rtcp::ReceiverReport> events(event_count_);
std::vector<int64_t> timestamps_ms(event_count_);
@ -931,7 +965,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpReceiverReport) {
fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000)));
}
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& receiver_reports = parsed_log_.receiver_reports(direction);
@ -952,6 +986,8 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpSenderReport) {
rtc::ScopedFakeClock fake_clock;
fake_clock.SetTime(Timestamp::Millis(prng_.Rand<uint32_t>()));
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
for (auto direction : {kIncomingPacket, kOutgoingPacket}) {
std::vector<rtcp::SenderReport> events(event_count_);
std::vector<int64_t> timestamps_ms(event_count_);
@ -969,7 +1005,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpSenderReport) {
fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000)));
}
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& sender_reports = parsed_log_.sender_reports(direction);
@ -990,6 +1026,8 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpExtendedReports) {
rtc::ScopedFakeClock fake_clock;
fake_clock.SetTime(Timestamp::Millis(prng_.Rand<uint32_t>()));
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
for (auto direction : {kIncomingPacket, kOutgoingPacket}) {
std::vector<rtcp::ExtendedReports> events(event_count_);
std::vector<int64_t> timestamps_ms(event_count_);
@ -1007,7 +1045,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpExtendedReports) {
fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000)));
}
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& extended_reports = parsed_log_.extended_reports(direction);
@ -1028,6 +1066,8 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpFir) {
rtc::ScopedFakeClock fake_clock;
fake_clock.SetTime(Timestamp::Millis(prng_.Rand<uint32_t>()));
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
for (auto direction : {kIncomingPacket, kOutgoingPacket}) {
std::vector<rtcp::Fir> events(event_count_);
std::vector<int64_t> timestamps_ms(event_count_);
@ -1045,7 +1085,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpFir) {
fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000)));
}
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& firs = parsed_log_.firs(direction);
@ -1065,6 +1105,8 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpPli) {
rtc::ScopedFakeClock fake_clock;
fake_clock.SetTime(Timestamp::Millis(prng_.Rand<uint32_t>()));
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
for (auto direction : {kIncomingPacket, kOutgoingPacket}) {
std::vector<rtcp::Pli> events(event_count_);
std::vector<int64_t> timestamps_ms(event_count_);
@ -1082,7 +1124,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpPli) {
fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000)));
}
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& plis = parsed_log_.plis(direction);
@ -1102,6 +1144,8 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpBye) {
rtc::ScopedFakeClock fake_clock;
fake_clock.SetTime(Timestamp::Millis(prng_.Rand<uint32_t>()));
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
for (auto direction : {kIncomingPacket, kOutgoingPacket}) {
std::vector<rtcp::Bye> events(event_count_);
std::vector<int64_t> timestamps_ms(event_count_);
@ -1119,7 +1163,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpBye) {
fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000)));
}
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& byes = parsed_log_.byes(direction);
@ -1139,6 +1183,8 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpNack) {
rtc::ScopedFakeClock fake_clock;
fake_clock.SetTime(Timestamp::Millis(prng_.Rand<uint32_t>()));
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
for (auto direction : {kIncomingPacket, kOutgoingPacket}) {
std::vector<rtcp::Nack> events(event_count_);
std::vector<int64_t> timestamps_ms(event_count_);
@ -1156,7 +1202,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpNack) {
fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000)));
}
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& nacks = parsed_log_.nacks(direction);
@ -1176,6 +1222,8 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpRemb) {
rtc::ScopedFakeClock fake_clock;
fake_clock.SetTime(Timestamp::Millis(prng_.Rand<uint32_t>()));
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
for (auto direction : {kIncomingPacket, kOutgoingPacket}) {
std::vector<rtcp::Remb> events(event_count_);
std::vector<int64_t> timestamps_ms(event_count_);
@ -1193,7 +1241,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpRemb) {
fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000)));
}
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& rembs = parsed_log_.rembs(direction);
@ -1213,6 +1261,8 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpTransportFeedback) {
rtc::ScopedFakeClock fake_clock;
fake_clock.SetTime(Timestamp::Millis(prng_.Rand<uint32_t>()));
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
for (auto direction : {kIncomingPacket, kOutgoingPacket}) {
std::vector<rtcp::TransportFeedback> events;
events.reserve(event_count_);
@ -1231,7 +1281,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpTransportFeedback) {
fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000)));
}
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& transport_feedbacks =
@ -1253,6 +1303,8 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpLossNotification) {
rtc::ScopedFakeClock fake_clock;
fake_clock.SetTime(Timestamp::Millis(prng_.Rand<uint32_t>()));
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
for (auto direction : {kIncomingPacket, kOutgoingPacket}) {
std::vector<rtcp::LossNotification> events;
events.reserve(event_count_);
@ -1271,7 +1323,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpLossNotification) {
fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000)));
}
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& loss_notifications = parsed_log_.loss_notifications(direction);
@ -1285,36 +1337,43 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpLossNotification) {
}
TEST_P(RtcEventLogEncoderTest, RtcEventRtpPacketIncoming) {
TestRtpPackets<RtcEventRtpPacketIncoming, LoggedRtpPacketIncoming>();
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
TestRtpPackets<RtcEventRtpPacketIncoming, LoggedRtpPacketIncoming>(*encoder);
}
TEST_P(RtcEventLogEncoderTest, RtcEventRtpPacketOutgoing) {
TestRtpPackets<RtcEventRtpPacketOutgoing, LoggedRtpPacketOutgoing>();
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
TestRtpPackets<RtcEventRtpPacketOutgoing, LoggedRtpPacketOutgoing>(*encoder);
}
TEST_P(RtcEventLogEncoderTest,
RtcEventRtpPacketIncomingNoDependencyDescriptor) {
test::ScopedFieldTrials no_dd(
ExplicitKeyValueConfig no_dd(
"WebRTC-RtcEventLogEncodeDependencyDescriptor/Disabled/");
TestRtpPackets<RtcEventRtpPacketIncoming, LoggedRtpPacketIncoming>();
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder(no_dd);
verifier_.ExpectDependencyDescriptorExtensionIsSet(false);
TestRtpPackets<RtcEventRtpPacketIncoming, LoggedRtpPacketIncoming>(*encoder);
}
TEST_P(RtcEventLogEncoderTest,
RtcEventRtpPacketOutgoingNoDependencyDescriptor) {
test::ScopedFieldTrials no_dd(
ExplicitKeyValueConfig no_dd(
"WebRTC-RtcEventLogEncodeDependencyDescriptor/Disabled/");
TestRtpPackets<RtcEventRtpPacketOutgoing, LoggedRtpPacketOutgoing>();
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder(no_dd);
verifier_.ExpectDependencyDescriptorExtensionIsSet(false);
TestRtpPackets<RtcEventRtpPacketOutgoing, LoggedRtpPacketOutgoing>(*encoder);
}
// TODO(eladalon/terelius): Test with multiple events in the batch.
TEST_P(RtcEventLogEncoderTest, RtcEventVideoReceiveStreamConfig) {
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
uint32_t ssrc = prng_.Rand<uint32_t>();
RtpHeaderExtensionMap extensions = gen_.NewRtpHeaderExtensionMap();
std::unique_ptr<RtcEventVideoReceiveStreamConfig> event =
gen_.NewVideoReceiveStreamConfig(ssrc, extensions);
history_.push_back(event->Copy());
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& video_recv_configs = parsed_log_.video_recv_configs();
@ -1324,13 +1383,14 @@ TEST_P(RtcEventLogEncoderTest, RtcEventVideoReceiveStreamConfig) {
// TODO(eladalon/terelius): Test with multiple events in the batch.
TEST_P(RtcEventLogEncoderTest, RtcEventVideoSendStreamConfig) {
std::unique_ptr<RtcEventLogEncoder> encoder = CreateEncoder();
uint32_t ssrc = prng_.Rand<uint32_t>();
RtpHeaderExtensionMap extensions = gen_.NewRtpHeaderExtensionMap();
std::unique_ptr<RtcEventVideoSendStreamConfig> event =
gen_.NewVideoSendStreamConfig(ssrc, extensions);
history_.push_back(event->Copy());
encoded_ += encoder_->EncodeBatch(history_.begin(), history_.end());
encoded_ += encoder->EncodeBatch(history_.begin(), history_.end());
ASSERT_TRUE(parsed_log_.ParseString(encoded_).ok());
const auto& video_send_configs = parsed_log_.video_send_configs();
@ -1357,7 +1417,8 @@ class RtcEventLogEncoderSimpleTest
encoder_ = std::make_unique<RtcEventLogEncoderLegacy>();
break;
case RtcEventLog::EncodingType::NewFormat:
encoder_ = std::make_unique<RtcEventLogEncoderNewFormat>();
encoder_ = std::make_unique<RtcEventLogEncoderNewFormat>(
ExplicitKeyValueConfig(""));
break;
case RtcEventLog::EncodingType::ProtoFree:
encoder_ = std::make_unique<RtcEventLogEncoderV3>();

View file

@ -14,12 +14,14 @@
namespace webrtc {
IceCandidatePairDescription::IceCandidatePairDescription() {
local_candidate_type = IceCandidateType::kUnknown;
IceCandidatePairDescription::IceCandidatePairDescription(
IceCandidateType local_candidate_type,
IceCandidateType remote_candidate_type)
: local_candidate_type(local_candidate_type),
remote_candidate_type(remote_candidate_type) {
local_relay_protocol = IceCandidatePairProtocol::kUnknown;
local_network_type = IceCandidateNetworkType::kUnknown;
local_address_family = IceCandidatePairAddressFamily::kUnknown;
remote_candidate_type = IceCandidateType::kUnknown;
remote_address_family = IceCandidatePairAddressFamily::kUnknown;
candidate_pair_protocol = IceCandidatePairProtocol::kUnknown;
}

View file

@ -18,6 +18,7 @@
#include <vector>
#include "absl/strings/string_view.h"
#include "api/candidate.h"
#include "api/rtc_event_log/rtc_event.h"
#include "api/units/timestamp.h"
#include "logging/rtc_event_log/events/rtc_event_field_encoding_parser.h"
@ -32,17 +33,6 @@ enum class IceCandidatePairConfigType {
kNumValues,
};
// TODO(qingsi): Change the names of candidate types to "host", "srflx", "prflx"
// and "relay" after the naming is spec-compliant in the signaling part
enum class IceCandidateType {
kUnknown,
kLocal,
kStun,
kPrflx,
kRelay,
kNumValues,
};
enum class IceCandidatePairProtocol {
kUnknown,
kUdp,
@ -88,7 +78,8 @@ struct LoggedIceCandidatePairConfig {
class IceCandidatePairDescription {
public:
IceCandidatePairDescription();
IceCandidatePairDescription(IceCandidateType local_candidate_type,
IceCandidateType remote_candidate_type);
explicit IceCandidatePairDescription(
const IceCandidatePairDescription& other);

View file

@ -26,7 +26,8 @@ void IceEventLog::LogCandidatePairConfig(
if (event_log_ == nullptr) {
return;
}
candidate_pair_desc_by_id_[candidate_pair_id] = candidate_pair_desc;
candidate_pair_desc_by_id_.emplace(candidate_pair_id, candidate_pair_desc);
event_log_->Log(std::make_unique<RtcEventIceCandidatePairConfig>(
type, candidate_pair_id, candidate_pair_desc));
}

View file

@ -39,7 +39,7 @@ std::unique_ptr<RtcEventLogEncoder> CreateEncoder(const Environment& env) {
return std::make_unique<RtcEventLogEncoderLegacy>();
} else {
RTC_DLOG(LS_INFO) << "Creating new format encoder for RTC event log.";
return std::make_unique<RtcEventLogEncoderNewFormat>();
return std::make_unique<RtcEventLogEncoderNewFormat>(env.field_trials());
}
}

View file

@ -163,22 +163,29 @@ IceCandidatePairConfigType GetRuntimeIceCandidatePairConfigType(
return IceCandidatePairConfigType::kAdded;
}
IceCandidateType GetRuntimeIceCandidateType(
rtclog::IceCandidatePairConfig::IceCandidateType type) {
switch (type) {
// Converts a log type (proto based) to a matching `IceCandidateType` value
// and checks for validity of the log type (since the enums aren't a perfect
// match).
bool GetRuntimeIceCandidateType(
rtclog::IceCandidatePairConfig::IceCandidateType log_type,
IceCandidateType& parsed_type) {
switch (log_type) {
case rtclog::IceCandidatePairConfig::LOCAL:
return IceCandidateType::kLocal;
parsed_type = IceCandidateType::kHost;
break;
case rtclog::IceCandidatePairConfig::STUN:
return IceCandidateType::kStun;
parsed_type = IceCandidateType::kSrflx;
break;
case rtclog::IceCandidatePairConfig::PRFLX:
return IceCandidateType::kPrflx;
parsed_type = IceCandidateType::kPrflx;
break;
case rtclog::IceCandidatePairConfig::RELAY:
return IceCandidateType::kRelay;
case rtclog::IceCandidatePairConfig::UNKNOWN_CANDIDATE_TYPE:
return IceCandidateType::kUnknown;
parsed_type = IceCandidateType::kRelay;
break;
default:
return false;
}
RTC_DCHECK_NOTREACHED();
return IceCandidateType::kUnknown;
return true;
}
IceCandidatePairProtocol GetRuntimeIceCandidatePairProtocol(
@ -806,18 +813,39 @@ IceCandidateType GetRuntimeIceCandidateType(
rtclog2::IceCandidatePairConfig::IceCandidateType type) {
switch (type) {
case rtclog2::IceCandidatePairConfig::LOCAL:
return IceCandidateType::kLocal;
return IceCandidateType::kHost;
case rtclog2::IceCandidatePairConfig::STUN:
return IceCandidateType::kStun;
return IceCandidateType::kSrflx;
case rtclog2::IceCandidatePairConfig::PRFLX:
return IceCandidateType::kPrflx;
case rtclog2::IceCandidatePairConfig::RELAY:
return IceCandidateType::kRelay;
case rtclog2::IceCandidatePairConfig::UNKNOWN_CANDIDATE_TYPE:
return IceCandidateType::kUnknown;
default:
RTC_DCHECK_NOTREACHED();
return IceCandidateType::kHost;
}
RTC_DCHECK_NOTREACHED();
return IceCandidateType::kUnknown;
}
bool GetRuntimeIceCandidateType(
rtclog2::IceCandidatePairConfig::IceCandidateType log_type,
IceCandidateType& parsed_type) {
switch (log_type) {
case rtclog2::IceCandidatePairConfig::LOCAL:
parsed_type = IceCandidateType::kHost;
break;
case rtclog2::IceCandidatePairConfig::STUN:
parsed_type = IceCandidateType::kSrflx;
break;
case rtclog2::IceCandidatePairConfig::PRFLX:
parsed_type = IceCandidateType::kPrflx;
break;
case rtclog2::IceCandidatePairConfig::RELAY:
parsed_type = IceCandidateType::kRelay;
break;
default:
return false;
}
return true;
}
IceCandidatePairProtocol GetRuntimeIceCandidatePairProtocol(
@ -2142,8 +2170,8 @@ ParsedRtcEventLog::GetIceCandidatePairConfig(
RTC_PARSE_CHECK_OR_RETURN(config.has_candidate_pair_id());
res.candidate_pair_id = config.candidate_pair_id();
RTC_PARSE_CHECK_OR_RETURN(config.has_local_candidate_type());
res.local_candidate_type =
GetRuntimeIceCandidateType(config.local_candidate_type());
RTC_PARSE_CHECK_OR_RETURN(GetRuntimeIceCandidateType(
config.local_candidate_type(), res.local_candidate_type));
RTC_PARSE_CHECK_OR_RETURN(config.has_local_relay_protocol());
res.local_relay_protocol =
GetRuntimeIceCandidatePairProtocol(config.local_relay_protocol());
@ -2154,8 +2182,8 @@ ParsedRtcEventLog::GetIceCandidatePairConfig(
res.local_address_family =
GetRuntimeIceCandidatePairAddressFamily(config.local_address_family());
RTC_PARSE_CHECK_OR_RETURN(config.has_remote_candidate_type());
res.remote_candidate_type =
GetRuntimeIceCandidateType(config.remote_candidate_type());
RTC_PARSE_CHECK_OR_RETURN(GetRuntimeIceCandidateType(
config.remote_candidate_type(), res.remote_candidate_type));
RTC_PARSE_CHECK_OR_RETURN(config.has_remote_address_family());
res.remote_address_family =
GetRuntimeIceCandidatePairAddressFamily(config.remote_address_family());
@ -2242,13 +2270,13 @@ std::vector<InferredRouteChangeEvent> ParsedRtcEventLog::GetRouteChanges()
if (candidate.remote_address_family ==
IceCandidatePairAddressFamily::kIpv6)
route.send_overhead += kIpv6Overhead - kIpv4Overhead;
if (candidate.remote_candidate_type != IceCandidateType::kLocal)
if (candidate.remote_candidate_type != IceCandidateType::kHost)
route.send_overhead += kStunOverhead;
route.return_overhead = kUdpOverhead + kSrtpOverhead + kIpv4Overhead;
if (candidate.remote_address_family ==
IceCandidatePairAddressFamily::kIpv6)
route.return_overhead += kIpv6Overhead - kIpv4Overhead;
if (candidate.remote_candidate_type != IceCandidateType::kLocal)
if (candidate.remote_candidate_type != IceCandidateType::kHost)
route.return_overhead += kStunOverhead;
route_changes.push_back(route);
}
@ -3498,8 +3526,8 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreIceCandidatePairConfig(
RTC_PARSE_CHECK_OR_RETURN(proto.has_candidate_pair_id());
ice_config.candidate_pair_id = proto.candidate_pair_id();
RTC_PARSE_CHECK_OR_RETURN(proto.has_local_candidate_type());
ice_config.local_candidate_type =
GetRuntimeIceCandidateType(proto.local_candidate_type());
RTC_PARSE_CHECK_OR_RETURN(GetRuntimeIceCandidateType(
proto.local_candidate_type(), ice_config.local_candidate_type));
RTC_PARSE_CHECK_OR_RETURN(proto.has_local_relay_protocol());
ice_config.local_relay_protocol =
GetRuntimeIceCandidatePairProtocol(proto.local_relay_protocol());
@ -3510,8 +3538,8 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::StoreIceCandidatePairConfig(
ice_config.local_address_family =
GetRuntimeIceCandidatePairAddressFamily(proto.local_address_family());
RTC_PARSE_CHECK_OR_RETURN(proto.has_remote_candidate_type());
ice_config.remote_candidate_type =
GetRuntimeIceCandidateType(proto.remote_candidate_type());
RTC_PARSE_CHECK_OR_RETURN(GetRuntimeIceCandidateType(
proto.remote_candidate_type(), ice_config.remote_candidate_type));
RTC_PARSE_CHECK_OR_RETURN(proto.has_remote_address_family());
ice_config.remote_address_family =
GetRuntimeIceCandidatePairAddressFamily(proto.remote_address_family());

View file

@ -71,12 +71,15 @@ enum PacketDirection { kIncomingPacket = 0, kOutgoingPacket };
enum class LoggedMediaType : uint8_t { kUnknown, kAudio, kVideo };
struct LoggedPacketInfo {
static LoggedPacketInfo CreateEmptyForTesting() { return LoggedPacketInfo(); }
LoggedPacketInfo(const LoggedRtpPacket& rtp,
LoggedMediaType media_type,
bool rtx,
Timestamp capture_time);
LoggedPacketInfo(const LoggedPacketInfo&);
~LoggedPacketInfo();
int64_t log_time_ms() const { return log_packet_time.ms(); }
int64_t log_time_us() const { return log_packet_time.us(); }
uint32_t ssrc;
@ -114,6 +117,12 @@ struct LoggedPacketInfo {
// time, and this is instead calculated as the difference in reported receive
// time between this packet and the last packet in the same feedback message.
TimeDelta feedback_hold_duration = TimeDelta::MinusInfinity();
private:
LoggedPacketInfo()
: capture_time(Timestamp::MinusInfinity()),
log_packet_time(Timestamp::MinusInfinity()),
reported_send_time(Timestamp::MinusInfinity()) {}
};
struct InferredRouteChangeEvent {

View file

@ -42,8 +42,8 @@
#include "rtc_base/buffer.h"
#include "rtc_base/checks.h"
#include "rtc_base/time_utils.h"
#include "system_wrappers/include/field_trial.h"
#include "system_wrappers/include/ntp_time.h"
#include "test/gmock.h"
#include "test/gtest.h"
namespace webrtc {
@ -52,6 +52,9 @@ namespace test {
namespace {
using ::testing::ElementsAreArray;
using ::testing::IsEmpty;
struct ExtensionPair {
RTPExtensionType type;
const char* name;
@ -217,10 +220,27 @@ EventGenerator::NewProbeResultSuccess() {
return std::make_unique<RtcEventProbeResultSuccess>(id, bitrate_bps);
}
constexpr uint32_t CandidateTypeCount() {
// This switch statement only exists to catch changes to the IceCandidateType
// enumeration. If you get an error here, please update the switch statement
// and the return value.
IceCandidateType type = IceCandidateType::kHost;
switch (type) {
case IceCandidateType::kHost:
case IceCandidateType::kSrflx:
case IceCandidateType::kPrflx:
case IceCandidateType::kRelay:
break;
}
return 4u;
}
std::unique_ptr<RtcEventIceCandidatePairConfig>
EventGenerator::NewIceCandidatePairConfig() {
IceCandidateType local_candidate_type = static_cast<IceCandidateType>(
prng_.Rand(static_cast<uint32_t>(IceCandidateType::kNumValues) - 1));
static_assert(static_cast<int>(IceCandidateType::kHost) == 0,
"Expect kLocal to be the first enum value, equal to 0");
IceCandidateType local_candidate_type =
static_cast<IceCandidateType>(prng_.Rand(CandidateTypeCount() - 1));
IceCandidateNetworkType local_network_type =
static_cast<IceCandidateNetworkType>(prng_.Rand(
static_cast<uint32_t>(IceCandidateNetworkType::kNumValues) - 1));
@ -228,8 +248,8 @@ EventGenerator::NewIceCandidatePairConfig() {
static_cast<IceCandidatePairAddressFamily>(prng_.Rand(
static_cast<uint32_t>(IceCandidatePairAddressFamily::kNumValues) -
1));
IceCandidateType remote_candidate_type = static_cast<IceCandidateType>(
prng_.Rand(static_cast<uint32_t>(IceCandidateType::kNumValues) - 1));
IceCandidateType remote_candidate_type =
static_cast<IceCandidateType>(prng_.Rand(CandidateTypeCount() - 1));
IceCandidatePairAddressFamily remote_address_family =
static_cast<IceCandidatePairAddressFamily>(prng_.Rand(
static_cast<uint32_t>(IceCandidatePairAddressFamily::kNumValues) -
@ -238,12 +258,10 @@ EventGenerator::NewIceCandidatePairConfig() {
static_cast<IceCandidatePairProtocol>(prng_.Rand(
static_cast<uint32_t>(IceCandidatePairProtocol::kNumValues) - 1));
IceCandidatePairDescription desc;
desc.local_candidate_type = local_candidate_type;
IceCandidatePairDescription desc(local_candidate_type, remote_candidate_type);
desc.local_relay_protocol = protocol_type;
desc.local_network_type = local_network_type;
desc.local_address_family = local_address_family;
desc.remote_candidate_type = remote_candidate_type;
desc.remote_address_family = remote_address_family;
desc.candidate_pair_protocol = protocol_type;
@ -1032,23 +1050,15 @@ void VerifyLoggedRtpHeader(const Event& original_header,
}
template <typename Event>
void VerifyLoggedDependencyDescriptor(const Event& packet,
const std::vector<uint8_t>& logged_dd) {
if (webrtc::field_trial::IsDisabled(
"WebRTC-RtcEventLogEncodeDependencyDescriptor")) {
EXPECT_TRUE(logged_dd.empty());
} else {
void EventVerifier::VerifyLoggedDependencyDescriptor(
const Event& packet,
const std::vector<uint8_t>& logged_dd) const {
if (expect_dependency_descriptor_rtp_header_extension_is_set_) {
rtc::ArrayView<const uint8_t> original =
packet.template GetRawExtension<RtpDependencyDescriptorExtension>();
EXPECT_EQ(logged_dd.size(), original.size());
bool dd_is_same = true;
for (size_t i = 0; i < logged_dd.size(); ++i) {
dd_is_same = logged_dd[i] == original[i];
if (!dd_is_same) {
break;
}
}
EXPECT_TRUE(dd_is_same);
EXPECT_THAT(logged_dd, ElementsAreArray(original));
} else {
EXPECT_THAT(logged_dd, IsEmpty());
}
}

View file

@ -160,6 +160,10 @@ class EventVerifier {
explicit EventVerifier(RtcEventLog::EncodingType encoding_type)
: encoding_type_(encoding_type) {}
void ExpectDependencyDescriptorExtensionIsSet(bool value) {
expect_dependency_descriptor_rtp_header_extension_is_set_ = value;
}
void VerifyLoggedAlrStateEvent(const RtcEventAlrState& original_event,
const LoggedAlrStateEvent& logged_event) const;
@ -331,7 +335,13 @@ class EventVerifier {
void VerifyReportBlock(const rtcp::ReportBlock& original_report_block,
const rtcp::ReportBlock& logged_report_block);
template <typename Event>
void VerifyLoggedDependencyDescriptor(
const Event& packet,
const std::vector<uint8_t>& logged_dd) const;
RtcEventLog::EncodingType encoding_type_;
bool expect_dependency_descriptor_rtp_header_extension_is_set_ = true;
};
} // namespace test

View file

@ -381,6 +381,7 @@ rtc_library("rtc_internal_video_codecs") {
":media_constants",
":rtc_media_base",
":rtc_simulcast_encoder_adapter",
"../api/environment",
"../api/video:encoded_image",
"../api/video:video_bitrate_allocation",
"../api/video:video_frame",
@ -587,6 +588,7 @@ rtc_source_set("rtc_data_sctp_transport_internal") {
"../api:rtc_error",
"../api/transport:datagram_transport_interface",
"../media:rtc_media_base",
"../p2p:packet_transport_internal",
"../p2p:rtc_p2p",
"../rtc_base:copy_on_write_buffer",
"../rtc_base:threading",
@ -611,6 +613,7 @@ if (rtc_build_dcsctp) {
"../net/dcsctp/public:types",
"../net/dcsctp/public:utils",
"../net/dcsctp/timer:task_queue_timeout",
"../p2p:packet_transport_internal",
"../p2p:rtc_p2p",
"../rtc_base:checks",
"../rtc_base:copy_on_write_buffer",

View file

@ -228,11 +228,11 @@ TEST(CodecTest, TestAV1CodecMatches) {
VideoCodec c_no_profile =
cricket::CreateVideoCodec(95, cricket::kAv1CodecName);
VideoCodec c_profile0 = cricket::CreateVideoCodec(95, cricket::kAv1CodecName);
c_profile0.params[webrtc::kAV1FmtpProfile] = kProfile0;
c_profile0.params[cricket::kAv1FmtpProfile] = kProfile0;
VideoCodec c_profile1 = cricket::CreateVideoCodec(95, cricket::kAv1CodecName);
c_profile1.params[webrtc::kAV1FmtpProfile] = kProfile1;
c_profile1.params[cricket::kAv1FmtpProfile] = kProfile1;
VideoCodec c_profile2 = cricket::CreateVideoCodec(95, cricket::kAv1CodecName);
c_profile2.params[webrtc::kAV1FmtpProfile] = kProfile2;
c_profile2.params[cricket::kAv1FmtpProfile] = kProfile2;
// An AV1 entry with no profile specified should be treated as profile-0.
EXPECT_TRUE(c_profile0.Matches(c_no_profile));
@ -248,7 +248,7 @@ TEST(CodecTest, TestAV1CodecMatches) {
// Two AV1 entries with profile 0 specified are treated as duplicates.
VideoCodec c_profile0_eq =
cricket::CreateVideoCodec(95, cricket::kAv1CodecName);
c_profile0_eq.params[webrtc::kAV1FmtpProfile] = kProfile0;
c_profile0_eq.params[cricket::kAv1FmtpProfile] = kProfile0;
EXPECT_TRUE(c_profile0.Matches(c_profile0_eq));
}
@ -256,7 +256,7 @@ TEST(CodecTest, TestAV1CodecMatches) {
// Two AV1 entries with profile 1 specified are treated as duplicates.
VideoCodec c_profile1_eq =
cricket::CreateVideoCodec(95, cricket::kAv1CodecName);
c_profile1_eq.params[webrtc::kAV1FmtpProfile] = kProfile1;
c_profile1_eq.params[cricket::kAv1FmtpProfile] = kProfile1;
EXPECT_TRUE(c_profile1.Matches(c_profile1_eq));
}

View file

@ -126,8 +126,14 @@ const char kH265FmtpProfileCompatibilityIndicator[] =
const char kH265FmtpInteropConstraints[] = "interop-constraints";
const char kH265FmtpTxMode[] = "tx-mode";
// draft-ietf-payload-vp9
const char kVP9ProfileId[] = "profile-id";
// https://aomediacodec.github.io/av1-rtp-spec/
const char kAv1FmtpProfile[] = "profile";
const char kAv1FmtpLevelIdx[] = "level-idx";
const char kAv1FmtpTier[] = "tier";
const int kDefaultVideoMaxFramerate = 60;
// Max encode quantizer for VP8/9 and AV1 encoders assuming libvpx/libaom API
// range [0, 63]

View file

@ -148,8 +148,14 @@ RTC_EXPORT extern const char kH265FmtpProfileCompatibilityIndicator[];
RTC_EXPORT extern const char kH265FmtpInteropConstraints[];
RTC_EXPORT extern const char kH265FmtpTxMode[];
// draft-ietf-payload-vp9
extern const char kVP9ProfileId[];
// https://aomediacodec.github.io/av1-rtp-spec/
extern const char kAv1FmtpProfile[];
extern const char kAv1FmtpLevelIdx[];
extern const char kAv1FmtpTier[];
extern const int kDefaultVideoMaxFramerate;
extern const int kDefaultVideoMaxQpVpx;
extern const int kDefaultVideoMaxQpH26x;

View file

@ -339,17 +339,6 @@ void FakeVideoSendStream::ReconfigureVideoEncoder(
webrtc::InvokeSetParametersCallback(callback, webrtc::RTCError::OK());
}
void FakeVideoSendStream::StartPerRtpStream(
const std::vector<bool> active_layers) {
sending_ = false;
for (const bool active_layer : active_layers) {
if (active_layer) {
sending_ = true;
break;
}
}
}
void FakeVideoSendStream::Start() {
sending_ = true;
}

View file

@ -202,7 +202,6 @@ class FakeVideoSendStream final
void OnFrame(const webrtc::VideoFrame& frame) override;
// webrtc::VideoSendStream implementation.
void StartPerRtpStream(std::vector<bool> active_layers) override;
void Start() override;
void Stop() override;
bool started() override { return IsSending(); }

View file

@ -51,9 +51,10 @@ std::vector<SdpVideoFormat> InternalDecoderFactory::GetSupportedFormats()
if (kDav1dIsIncluded) {
formats.push_back(SdpVideoFormat(cricket::kAv1CodecName));
formats.push_back(SdpVideoFormat(
cricket::kAv1CodecName,
{{kAV1FmtpProfile, AV1ProfileToString(AV1Profile::kProfile1).data()}}));
formats.push_back(
SdpVideoFormat(cricket::kAv1CodecName,
{{cricket::kAv1FmtpProfile,
AV1ProfileToString(AV1Profile::kProfile1).data()}}));
}
return formats;

View file

@ -121,7 +121,7 @@ TEST(InternalDecoderFactoryTest, Av1Profile1_Dav1dDecoderTrialEnabled) {
InternalDecoderFactory factory;
std::unique_ptr<VideoDecoder> decoder = factory.CreateVideoDecoder(
SdpVideoFormat(cricket::kAv1CodecName,
{{kAV1FmtpProfile,
{{cricket::kAv1FmtpProfile,
AV1ProfileToString(AV1Profile::kProfile1).data()}}));
EXPECT_EQ(static_cast<bool>(decoder), kDav1dIsIncluded);
}

View file

@ -11,10 +11,12 @@
#include "media/engine/multiplex_codec_factory.h"
#include <map>
#include <memory>
#include <string>
#include <utility>
#include "absl/strings/match.h"
#include "api/environment/environment.h"
#include "api/video_codecs/sdp_video_format.h"
#include "media/base/codec.h"
#include "media/base/media_constants.h"
@ -95,20 +97,21 @@ std::vector<SdpVideoFormat> MultiplexDecoderFactory::GetSupportedFormats()
return augmented_formats;
}
std::unique_ptr<VideoDecoder> MultiplexDecoderFactory::CreateVideoDecoder(
std::unique_ptr<VideoDecoder> MultiplexDecoderFactory::Create(
const Environment& env,
const SdpVideoFormat& format) {
if (!IsMultiplexCodec(cricket::CreateVideoCodec(format)))
return factory_->CreateVideoDecoder(format);
const auto& it =
format.parameters.find(cricket::kCodecParamAssociatedCodecName);
if (!IsMultiplexCodec(cricket::CreateVideoCodec(format))) {
return factory_->Create(env, format);
}
auto it = format.parameters.find(cricket::kCodecParamAssociatedCodecName);
if (it == format.parameters.end()) {
RTC_LOG(LS_ERROR) << "No assicated codec for multiplex.";
return nullptr;
}
SdpVideoFormat associated_format = format;
associated_format.name = it->second;
return std::unique_ptr<VideoDecoder>(new MultiplexDecoderAdapter(
factory_.get(), associated_format, supports_augmenting_data_));
return std::make_unique<MultiplexDecoderAdapter>(
env, factory_.get(), associated_format, supports_augmenting_data_);
}
} // namespace webrtc

View file

@ -14,6 +14,7 @@
#include <memory>
#include <vector>
#include "api/environment/environment.h"
#include "api/video_codecs/sdp_video_format.h"
#include "api/video_codecs/video_decoder.h"
#include "api/video_codecs/video_decoder_factory.h"
@ -66,8 +67,8 @@ class RTC_EXPORT MultiplexDecoderFactory : public VideoDecoderFactory {
bool supports_augmenting_data = false);
std::vector<SdpVideoFormat> GetSupportedFormats() const override;
std::unique_ptr<VideoDecoder> CreateVideoDecoder(
const SdpVideoFormat& format) override;
std::unique_ptr<VideoDecoder> Create(const Environment& env,
const SdpVideoFormat& format) override;
private:
std::unique_ptr<VideoDecoderFactory> factory_;

View file

@ -10,8 +10,10 @@
#include "media/engine/multiplex_codec_factory.h"
#include <memory>
#include <utility>
#include "api/environment/environment_factory.h"
#include "api/video_codecs/sdp_video_format.h"
#include "api/video_codecs/video_decoder.h"
#include "api/video_codecs/video_encoder.h"
@ -22,12 +24,13 @@
namespace webrtc {
TEST(MultiplexDecoderFactory, CreateVideoDecoder) {
std::unique_ptr<VideoDecoderFactory> internal_factory(
new InternalDecoderFactory());
TEST(MultiplexDecoderFactoryTest, CreateVideoDecoder) {
std::unique_ptr<VideoDecoderFactory> internal_factory =
std::make_unique<InternalDecoderFactory>();
MultiplexDecoderFactory factory(std::move(internal_factory));
std::unique_ptr<VideoDecoder> decoder =
factory.CreateVideoDecoder(SdpVideoFormat(
std::unique_ptr<VideoDecoder> decoder = factory.Create(
CreateEnvironment(),
SdpVideoFormat(
cricket::kMultiplexCodecName,
{{cricket::kCodecParamAssociatedCodecName, cricket::kVp9CodecName}}));
EXPECT_TRUE(decoder);

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