mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-12 21:30:45 +01:00
Update to 4896 (M100) (#72)
This commit is contained in:
parent
9fa95682c0
commit
4a2e0e5d45
2110 changed files with 77529 additions and 40474 deletions
4
.gn
4
.gn
|
@ -63,4 +63,8 @@ default_args = {
|
|||
enable_libaom = false
|
||||
|
||||
gtest_enable_absl_printers = true
|
||||
|
||||
# RingRTC change to support SDK >= 19.
|
||||
# Differently from Chromium, WebRTC still support SDK 19.
|
||||
default_min_sdk_version = 19
|
||||
}
|
||||
|
|
1
.mailmap
Normal file
1
.mailmap
Normal file
|
@ -0,0 +1 @@
|
|||
Tommi <tommi@webrtc.org> Tomas Gunnarsson <tommi@webrtc.org>
|
4
.style.yapf
Normal file
4
.style.yapf
Normal file
|
@ -0,0 +1,4 @@
|
|||
[style]
|
||||
based_on_style = pep8
|
||||
indent_width = 2
|
||||
column_limit = 80
|
82
.vpython3
Normal file
82
.vpython3
Normal file
|
@ -0,0 +1,82 @@
|
|||
# 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: "3.8"
|
||||
|
||||
# Used by:
|
||||
# third_party/catapult
|
||||
wheel: <
|
||||
name: "infra/python/wheels/psutil/${vpython_platform}"
|
||||
version: "version:5.8.0.chromium.2"
|
||||
>
|
||||
|
||||
# Used by tools_webrtc/perf/webrtc_dashboard_upload.py.
|
||||
wheel: <
|
||||
name: "infra/python/wheels/httplib2-py3"
|
||||
version: "version:0.19.1"
|
||||
>
|
||||
|
||||
wheel: <
|
||||
name: "infra/python/wheels/pyparsing-py2_py3"
|
||||
version: "version:2.4.7"
|
||||
>
|
||||
|
||||
|
||||
# Used by:
|
||||
# build/toolchain/win
|
||||
wheel: <
|
||||
name: "infra/python/wheels/pywin32/${vpython_platform}"
|
||||
version: "version:300"
|
||||
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"
|
||||
>
|
10
AUTHORS
10
AUTHORS
|
@ -58,6 +58,7 @@ Jesús Leganés-Combarro <piranna@gmail.com>
|
|||
Jiawei Ou <jiawei.ou@gmail.com>
|
||||
Jie Mao <maojie0924@gmail.com>
|
||||
Jiwon Kim <jwkim0000@gmail.com>
|
||||
Johnny Wong <hellojinqiang@gmail.com>
|
||||
Jose Antonio Olivera Ortega <josea.olivera@gmail.com>
|
||||
Keiichi Enomoto <enm10k@gmail.com>
|
||||
Kiran Thind <kiran.thind@gmail.com>
|
||||
|
@ -69,6 +70,7 @@ Mallikarjuna Rao V <vm.arjun@samsung.com>
|
|||
Manish Jethani <manish.jethani@gmail.com>
|
||||
Martin Storsjo <martin@martin.st>
|
||||
Matthias Liebig <matthias.gcode@gmail.com>
|
||||
Maksim Sisov <msisov@igalia.com>
|
||||
Maxim Pavlov <pavllovmax@gmail.com>
|
||||
Maxim Potapov <vopatop.skam@gmail.com>
|
||||
Michael Iedema <michael@kapsulate.com>
|
||||
|
@ -77,6 +79,8 @@ Miguel Paris <mparisdiaz@gmail.com>
|
|||
Mike Gilbert <floppymaster@gmail.com>
|
||||
Min Wang <mingewang@gmail.com>
|
||||
Mo Zanaty <mzanaty@cisco.com>
|
||||
Niek van der Maas <mail@niekvandermaas.nl>
|
||||
Olivier Crête <olivier.crete@ocrete.ca>
|
||||
Pali Rohar
|
||||
Paul Kapustin <pkapustin@gmail.com>
|
||||
Peng Yu <yupeng323@gmail.com>
|
||||
|
@ -88,16 +92,19 @@ Raman Budny <budnyjj@gmail.com>
|
|||
Ramprakash Jelari <ennajelari@gmail.com>
|
||||
Riku Voipio <riku.voipio@linaro.org>
|
||||
Robert Bares <robert@bares.me>
|
||||
Robert Mader <robert.mader@posteo.de>
|
||||
Robert Nagy <robert.nagy@gmail.com>
|
||||
Ryan Yoakum <ryoakum@skobalt.com>
|
||||
Sarah Thompson <sarah@telergy.com>
|
||||
Satender Saroha <ssaroha@yahoo.com>
|
||||
Saul Kravitz <Saul.Kravitz@celera.com>
|
||||
Sergio Garcia Murillo <sergio.garcia.murillo@gmail.com>
|
||||
Shuhai Peng <shuhai.peng@intel.com>
|
||||
Silviu Caragea <silviu.cpp@gmail.com>
|
||||
Stefan Gula <steweg@gmail.com>
|
||||
Stephan Hartmann <stha09@googlemail.com>
|
||||
Steve Reid <sreid@sea-to-sky.net>
|
||||
Takaaki Suzuki <takaakisuzuki.14@gmail.com>
|
||||
Tarun Chawla <trnkumarchawla@gmail.com>
|
||||
Todd Wong <todd.wong.ndq@gmail.com>
|
||||
Tomas Popela <tomas.popela@gmail.com>
|
||||
|
@ -108,6 +115,7 @@ Victor Costan <costan@gmail.com>
|
|||
Vladimir Beloborodov <VladimirTechMan@gmail.com>
|
||||
Xiaohong Xu <freemine@yeah.net>
|
||||
Xiaolei Yu <dreifachstein@gmail.com>
|
||||
Yaowen Guo <albertguo88@gmail.com>
|
||||
Yura Yaroshevich <yura.yaroshevich@gmail.com>
|
||||
Yuriy Pavlyshak <yuriy@appear.in>
|
||||
Yusuke Suzuki <utatane.tea@gmail.com>
|
||||
|
@ -115,6 +123,7 @@ Yusuke Suzuki <utatane.tea@gmail.com>
|
|||
|
||||
# BEGIN organizations section.
|
||||
8x8 Inc. <*@8x8.com>
|
||||
8x8 Inc. <*@jitsi.org>
|
||||
8x8 Inc. <*@sip-communicator.org>
|
||||
Agora IO <*@agora.io>
|
||||
ARM Holdings <*@arm.com>
|
||||
|
@ -130,6 +139,7 @@ Microsoft Corporation <*@microsoft.com>
|
|||
MIPS Technologies <*@mips.com>
|
||||
Mozilla Foundation <*@mozilla.com>
|
||||
Netgem S.A. <*@netgem.com>
|
||||
Nutanix Inc. <*@nutanix.com>
|
||||
NVIDIA Corporation <*@nvidia.com>
|
||||
Opera Software ASA <*@opera.com>
|
||||
Optical Tone Ltd <*@opticaltone.com>
|
||||
|
|
82
BUILD.gn
82
BUILD.gn
|
@ -12,6 +12,15 @@
|
|||
# you add a new build file, there must be some path of dependencies from this
|
||||
# file to your new one or GN won't know about it.
|
||||
|
||||
# Use of visibility = clauses:
|
||||
# The default visibility for all rtc_ targets is equivalent to "//*", or
|
||||
# "all targets in webrtc can depend on this, nothing outside can".
|
||||
#
|
||||
# When overriding, the choices are:
|
||||
# - visibility = [ "*" ] - public. Stuff outside webrtc can use this.
|
||||
# - visibility = [ ":*" ] - directory private.
|
||||
# As a general guideline, only targets in api/ should have public visibility.
|
||||
|
||||
import("//build/config/linux/pkg_config.gni")
|
||||
import("//build/config/sanitizers/sanitizers.gni")
|
||||
import("//third_party/google_benchmark/buildconfig.gni")
|
||||
|
@ -39,7 +48,6 @@ if (!build_with_chromium) {
|
|||
if (rtc_include_tests) {
|
||||
deps += [
|
||||
":rtc_unittests",
|
||||
":slow_tests",
|
||||
":video_engine_tests",
|
||||
":voip_unittests",
|
||||
":webrtc_nonparallel_tests",
|
||||
|
@ -73,6 +81,13 @@ if (!build_with_chromium) {
|
|||
# see bugs.webrtc.org/11027#c5.
|
||||
deps += [ ":webrtc_lib_link_test" ]
|
||||
}
|
||||
if (is_ios) {
|
||||
deps += [
|
||||
"examples:apprtcmobile_tests",
|
||||
"sdk:sdk_framework_unittests",
|
||||
"sdk:sdk_unittests",
|
||||
]
|
||||
}
|
||||
if (is_android) {
|
||||
deps += [
|
||||
"examples:android_examples_junit_tests",
|
||||
|
@ -84,7 +99,7 @@ if (!build_with_chromium) {
|
|||
}
|
||||
if (rtc_enable_protobuf) {
|
||||
deps += [
|
||||
"audio:low_bandwidth_audio_test",
|
||||
"audio:low_bandwidth_audio_perf_test",
|
||||
"logging:rtc_event_log_rtp_dump",
|
||||
"tools_webrtc/perf:webrtc_dashboard_upload",
|
||||
]
|
||||
|
@ -118,15 +133,15 @@ config("common_inherited_config") {
|
|||
cflags = []
|
||||
ldflags = []
|
||||
|
||||
if (rtc_enable_symbol_export || is_component_build) {
|
||||
defines = [ "WEBRTC_ENABLE_SYMBOL_EXPORT" ]
|
||||
}
|
||||
if (rtc_enable_objc_symbol_export) {
|
||||
defines = [ "WEBRTC_ENABLE_OBJC_SYMBOL_EXPORT" ]
|
||||
if (rtc_dlog_always_on) {
|
||||
defines += [ "DLOG_ALWAYS_ON" ]
|
||||
}
|
||||
|
||||
if (build_with_mozilla) {
|
||||
defines += [ "WEBRTC_MOZILLA_BUILD" ]
|
||||
if (rtc_enable_symbol_export || is_component_build) {
|
||||
defines += [ "WEBRTC_ENABLE_SYMBOL_EXPORT" ]
|
||||
}
|
||||
if (rtc_enable_objc_symbol_export) {
|
||||
defines += [ "WEBRTC_ENABLE_OBJC_SYMBOL_EXPORT" ]
|
||||
}
|
||||
|
||||
if (!rtc_builtin_ssl_root_certificates) {
|
||||
|
@ -222,14 +237,6 @@ config("common_inherited_config") {
|
|||
}
|
||||
}
|
||||
|
||||
# TODO(bugs.webrtc.org/9693): Remove the possibility to suppress this warning
|
||||
# as soon as WebRTC compiles without it.
|
||||
config("no_exit_time_destructors") {
|
||||
if (is_clang) {
|
||||
cflags = [ "-Wno-exit-time-destructors" ]
|
||||
}
|
||||
}
|
||||
|
||||
# TODO(bugs.webrtc.org/9693): Remove the possibility to suppress this warning
|
||||
# as soon as WebRTC compiles without it.
|
||||
config("no_global_constructors") {
|
||||
|
@ -269,6 +276,10 @@ config("common_config") {
|
|||
defines += [ "RTC_ENABLE_VP9" ]
|
||||
}
|
||||
|
||||
if (rtc_include_dav1d_in_internal_decoder_factory) {
|
||||
defines += [ "RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY" ]
|
||||
}
|
||||
|
||||
if (rtc_enable_sctp) {
|
||||
defines += [ "WEBRTC_HAVE_SCTP" ]
|
||||
}
|
||||
|
@ -305,7 +316,10 @@ config("common_config") {
|
|||
defines += [ "WEBRTC_EXCLUDE_AUDIO_PROCESSING_MODULE" ]
|
||||
}
|
||||
|
||||
cflags = []
|
||||
# TODO(webrtc:13219): Fix -Wshadow instances and enable.
|
||||
if (is_clang) {
|
||||
cflags += [ "-Wno-shadow" ]
|
||||
}
|
||||
|
||||
if (build_with_chromium) {
|
||||
defines += [
|
||||
|
@ -346,21 +360,10 @@ config("common_config") {
|
|||
"-Wundef",
|
||||
]
|
||||
|
||||
# use_xcode_clang only refers to the iOS toolchain, host binaries use
|
||||
# chromium's clang always.
|
||||
if (!is_nacl &&
|
||||
(!use_xcode_clang || current_toolchain == host_toolchain)) {
|
||||
# Flags NaCl (Clang 3.7) and Xcode 7.3 (Clang clang-703.0.31) do not
|
||||
# recognize.
|
||||
if (!is_nacl) {
|
||||
# Flags NaCl (Clang 3.7) do not recognize.
|
||||
cflags += [ "-Wunused-lambda-capture" ]
|
||||
}
|
||||
|
||||
if (use_xcode_clang) {
|
||||
# This may be removed if the clang version in xcode > 12.4 includes the
|
||||
# fix https://reviews.llvm.org/D73007.
|
||||
# https://bugs.llvm.org/show_bug.cgi?id=44556
|
||||
cflags += [ "-Wno-range-loop-analysis" ]
|
||||
}
|
||||
}
|
||||
|
||||
if (is_win && !is_clang) {
|
||||
|
@ -575,7 +578,9 @@ if (rtc_include_tests && !build_with_chromium) {
|
|||
"rtc_base/experiments:experiments_unittests",
|
||||
"rtc_base/system:file_wrapper_unittests",
|
||||
"rtc_base/task_utils:pending_task_safety_flag_unittests",
|
||||
"rtc_base/task_utils:repeating_task_unittests",
|
||||
"rtc_base/task_utils:to_queued_task_unittests",
|
||||
"rtc_base/units:units_unittests",
|
||||
"sdk:sdk_tests",
|
||||
"test:rtp_test_utils",
|
||||
"test:test_main",
|
||||
|
@ -613,17 +618,6 @@ if (rtc_include_tests && !build_with_chromium) {
|
|||
}
|
||||
}
|
||||
|
||||
# This runs tests that must run in real time and therefore can take some
|
||||
# time to execute. They are in a separate executable to avoid making the
|
||||
# regular unittest suite too slow to run frequently.
|
||||
rtc_test("slow_tests") {
|
||||
testonly = true
|
||||
deps = [
|
||||
"rtc_base/task_utils:repeating_task_unittests",
|
||||
"test:test_main",
|
||||
]
|
||||
}
|
||||
|
||||
# TODO(pbos): Rename test suite, this is no longer "just" for video targets.
|
||||
video_engine_tests_resources = [
|
||||
"resources/foreman_cif_short.yuv",
|
||||
|
@ -650,6 +644,7 @@ if (rtc_include_tests && !build_with_chromium) {
|
|||
"test:test_common",
|
||||
"test:test_main",
|
||||
"test:video_test_common",
|
||||
"video:video_legacy_tests",
|
||||
"video:video_tests",
|
||||
"video/adaptation:video_adaptation_tests",
|
||||
]
|
||||
|
@ -746,6 +741,9 @@ group("poison_audio_codecs") {
|
|||
group("poison_default_task_queue") {
|
||||
}
|
||||
|
||||
group("poison_default_echo_detector") {
|
||||
}
|
||||
|
||||
group("poison_rtc_json") {
|
||||
}
|
||||
|
||||
|
|
|
@ -7,4 +7,3 @@
|
|||
|
||||
danilchap@webrtc.org
|
||||
mbonadei@webrtc.org
|
||||
phoglund@webrtc.org
|
||||
|
|
4
OWNERS
4
OWNERS
|
@ -10,9 +10,13 @@ per-file .../BUILD.gn=mbonadei@webrtc.org
|
|||
per-file *.gni=mbonadei@webrtc.org
|
||||
per-file .../*.gni=mbonadei@webrtc.org
|
||||
per-file .vpython=mbonadei@webrtc.org
|
||||
per-file .vpython3=mbonadei@webrtc.org
|
||||
per-file AUTHORS=*
|
||||
per-file DEPS=*
|
||||
per-file pylintrc=mbonadei@webrtc.org
|
||||
per-file WATCHLISTS=*
|
||||
per-file native-api.md=mbonadei@webrtc.org
|
||||
per-file ....lua=titovartem@webrtc.org
|
||||
per-file .style.yapf=jleconte@webrtc.org
|
||||
per-file *.py=jansson@webrtc.org
|
||||
per-file *.py=jleconte@webrtc.org
|
||||
|
|
2105
PRESUBMIT.py
2105
PRESUBMIT.py
File diff suppressed because it is too large
Load diff
55
api/BUILD.gn
55
api/BUILD.gn
|
@ -98,6 +98,12 @@ rtc_library("rtp_packet_info") {
|
|||
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
|
||||
}
|
||||
|
||||
rtc_source_set("video_track_source_constraints") {
|
||||
visibility = [ "*" ]
|
||||
sources = [ "video_track_source_constraints.h" ]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
|
||||
}
|
||||
|
||||
rtc_library("media_stream_interface") {
|
||||
visibility = [ "*" ]
|
||||
sources = [
|
||||
|
@ -110,9 +116,12 @@ rtc_library("media_stream_interface") {
|
|||
":audio_options_api",
|
||||
":rtp_parameters",
|
||||
":scoped_refptr",
|
||||
":sequence_checker",
|
||||
":video_track_source_constraints",
|
||||
"../modules/audio_processing:audio_processing_statistics",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:refcount",
|
||||
"../rtc_base/system:no_unique_address",
|
||||
"../rtc_base/system:rtc_export",
|
||||
"video:recordable_encoded_frame",
|
||||
"video:video_frame",
|
||||
|
@ -185,6 +194,7 @@ rtc_library("libjingle_peerconnection_api") {
|
|||
"crypto:frame_decryptor_interface",
|
||||
"crypto:frame_encryptor_interface",
|
||||
"crypto:options",
|
||||
"metronome",
|
||||
"neteq:neteq_api",
|
||||
"rtc_event_log",
|
||||
"task_queue",
|
||||
|
@ -257,6 +267,7 @@ rtc_source_set("packet_socket_factory") {
|
|||
]
|
||||
deps = [
|
||||
":async_dns_resolver",
|
||||
":wrapping_async_dns_resolver",
|
||||
"../rtc_base:async_resolver_interface",
|
||||
"../rtc_base:rtc_base",
|
||||
"../rtc_base:socket_address",
|
||||
|
@ -273,6 +284,28 @@ rtc_source_set("async_dns_resolver") {
|
|||
]
|
||||
}
|
||||
|
||||
rtc_source_set("wrapping_async_dns_resolver") {
|
||||
visibility = [
|
||||
":*",
|
||||
"../p2p:rtc_p2p",
|
||||
]
|
||||
sources = [
|
||||
"wrapping_async_dns_resolver.cc",
|
||||
"wrapping_async_dns_resolver.h",
|
||||
]
|
||||
deps = [
|
||||
":async_dns_resolver",
|
||||
":sequence_checker",
|
||||
"../rtc_base:async_resolver_interface",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:macromagic",
|
||||
"../rtc_base:socket_address",
|
||||
"../rtc_base:threading",
|
||||
"../rtc_base/third_party/sigslot",
|
||||
]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/memory" ]
|
||||
}
|
||||
|
||||
rtc_source_set("scoped_refptr") {
|
||||
visibility = [ "*" ]
|
||||
sources = [ "scoped_refptr.h" ]
|
||||
|
@ -382,6 +415,16 @@ rtc_source_set("stats_observer_interface") {
|
|||
absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
|
||||
}
|
||||
|
||||
rtc_source_set("peer_network_dependencies") {
|
||||
visibility = [ "*" ]
|
||||
sources = [ "test/peer_network_dependencies.h" ]
|
||||
deps = [
|
||||
":packet_socket_factory",
|
||||
"../rtc_base",
|
||||
"../rtc_base:threading",
|
||||
]
|
||||
}
|
||||
|
||||
rtc_source_set("peer_connection_quality_test_fixture_api") {
|
||||
visibility = [ "*" ]
|
||||
testonly = true
|
||||
|
@ -397,14 +440,17 @@ rtc_source_set("peer_connection_quality_test_fixture_api") {
|
|||
":media_stream_interface",
|
||||
":network_state_predictor_api",
|
||||
":packet_socket_factory",
|
||||
":peer_network_dependencies",
|
||||
":rtp_parameters",
|
||||
":simulated_network_api",
|
||||
":stats_observer_interface",
|
||||
":track_id_stream_info_map",
|
||||
":video_quality_analyzer_api",
|
||||
"../media:rtc_media_base",
|
||||
"../modules/audio_processing:api",
|
||||
"../rtc_base:rtc_base",
|
||||
"../rtc_base:threading",
|
||||
"audio:audio_mixer_api",
|
||||
"rtc_event_log",
|
||||
"task_queue",
|
||||
"transport:network_control",
|
||||
|
@ -625,6 +671,8 @@ rtc_source_set("network_emulation_manager_api") {
|
|||
]
|
||||
deps = [
|
||||
":array_view",
|
||||
":packet_socket_factory",
|
||||
":peer_network_dependencies",
|
||||
":simulated_network_api",
|
||||
":time_controller",
|
||||
"../call:simulated_network",
|
||||
|
@ -1177,3 +1225,10 @@ if (rtc_include_tests) {
|
|||
]
|
||||
}
|
||||
}
|
||||
|
||||
rtc_source_set("webrtc_key_value_config") {
|
||||
visibility = [ "*" ]
|
||||
sources = [ "webrtc_key_value_config.h" ]
|
||||
deps = [ "../rtc_base/system:rtc_export" ]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
|
||||
}
|
||||
|
|
41
api/DEPS
41
api/DEPS
|
@ -112,14 +112,6 @@ specific_include_rules = {
|
|||
"+rtc_base/ref_count.h",
|
||||
],
|
||||
|
||||
"jsep_ice_candidate\.h": [
|
||||
"+rtc_base/constructor_magic.h",
|
||||
],
|
||||
|
||||
"jsep_session_description\.h": [
|
||||
"+rtc_base/constructor_magic.h",
|
||||
],
|
||||
|
||||
"media_stream_interface\.h": [
|
||||
"+modules/audio_processing/include/audio_processing_statistics.h",
|
||||
"+rtc_base/ref_count.h",
|
||||
|
@ -156,7 +148,6 @@ specific_include_rules = {
|
|||
],
|
||||
|
||||
"ref_counted_base\.h": [
|
||||
"+rtc_base/constructor_magic.h",
|
||||
"+rtc_base/ref_count.h",
|
||||
"+rtc_base/ref_counter.h",
|
||||
],
|
||||
|
@ -168,6 +159,9 @@ specific_include_rules = {
|
|||
# For private member and constructor.
|
||||
"+rtc_base/system/file_wrapper.h",
|
||||
],
|
||||
"rtp_packet_infos\.h": [
|
||||
"+rtc_base/ref_counted_object.h",
|
||||
],
|
||||
"rtp_receiver_interface\.h": [
|
||||
"+rtc_base/ref_count.h",
|
||||
],
|
||||
|
@ -192,7 +186,6 @@ specific_include_rules = {
|
|||
],
|
||||
|
||||
"stats_types\.h": [
|
||||
"+rtc_base/constructor_magic.h",
|
||||
"+rtc_base/ref_count.h",
|
||||
"+rtc_base/thread_checker.h",
|
||||
],
|
||||
|
@ -201,17 +194,12 @@ specific_include_rules = {
|
|||
"+rtc_base/ref_count.h",
|
||||
],
|
||||
|
||||
"audio_frame\.h": [
|
||||
"+rtc_base/constructor_magic.h",
|
||||
],
|
||||
|
||||
"audio_mixer\.h": [
|
||||
"+rtc_base/ref_count.h",
|
||||
],
|
||||
|
||||
"audio_decoder\.h": [
|
||||
"+rtc_base/buffer.h",
|
||||
"+rtc_base/constructor_magic.h",
|
||||
],
|
||||
|
||||
"audio_decoder_factory\.h": [
|
||||
|
@ -267,6 +255,13 @@ specific_include_rules = {
|
|||
"+rtc_base/ref_counted_object.h",
|
||||
],
|
||||
|
||||
"fake_metronome\.h": [
|
||||
"+rtc_base/synchronization/mutex.h",
|
||||
"+rtc_base/task_queue.h",
|
||||
"+rtc_base/task_utils/repeating_task.h",
|
||||
"+rtc_base/thread_annotations.h",
|
||||
],
|
||||
|
||||
"mock.*\.h": [
|
||||
"+test/gmock.h",
|
||||
],
|
||||
|
@ -279,6 +274,10 @@ specific_include_rules = {
|
|||
"+rtc_base/ref_counted_object.h",
|
||||
],
|
||||
|
||||
"notifier\.h": [
|
||||
"+rtc_base/system/no_unique_address.h",
|
||||
],
|
||||
|
||||
"simulated_network\.h": [
|
||||
"+rtc_base/random.h",
|
||||
"+rtc_base/thread_annotations.h",
|
||||
|
@ -305,6 +304,18 @@ specific_include_rules = {
|
|||
"+rtc_base/thread_annotations.h",
|
||||
],
|
||||
|
||||
"wrapping_async_dns_resolver\.h": [
|
||||
"+rtc_base/async_resolver.h",
|
||||
"+rtc_base/async_resolver_interface.h",
|
||||
"+rtc_base/socket_address.h",
|
||||
"+rtc_base/third_party/sigslot/sigslot.h",
|
||||
"+rtc_base/thread_annotations.h",
|
||||
],
|
||||
|
||||
"video_encoder_factory_template.*\.h": [
|
||||
"+modules/video_coding",
|
||||
],
|
||||
|
||||
# .cc files in api/ should not be restricted in what they can #include,
|
||||
# so we re-add all the top-level directories here. (That's because .h
|
||||
# files leak their #includes to whoever's #including them, but .cc files
|
||||
|
|
|
@ -51,6 +51,11 @@ class AsyncDnsResolverResult {
|
|||
virtual int GetError() const = 0;
|
||||
};
|
||||
|
||||
// The API for a single name query.
|
||||
// The constructor, destructor and all functions must be called from
|
||||
// the same sequence, and the callback will also be called on that sequence.
|
||||
// The class guarantees that the callback will not be called if the
|
||||
// resolver's destructor has been called.
|
||||
class RTC_EXPORT AsyncDnsResolverInterface {
|
||||
public:
|
||||
virtual ~AsyncDnsResolverInterface() = default;
|
||||
|
@ -70,7 +75,7 @@ class AsyncDnsResolverFactoryInterface {
|
|||
|
||||
// Creates an AsyncDnsResolver and starts resolving the name. The callback
|
||||
// will be called when resolution is finished.
|
||||
// The callback will be called on the thread that the caller runs on.
|
||||
// The callback will be called on the sequence that the caller runs on.
|
||||
virtual std::unique_ptr<webrtc::AsyncDnsResolverInterface> CreateAndResolve(
|
||||
const rtc::SocketAddress& addr,
|
||||
std::function<void()> callback) = 0;
|
||||
|
|
|
@ -95,6 +95,7 @@ rtc_source_set("echo_control") {
|
|||
|
||||
rtc_source_set("echo_detector_creator") {
|
||||
visibility = [ "*" ]
|
||||
allow_poison = [ "default_echo_detector" ]
|
||||
sources = [
|
||||
"echo_detector_creator.cc",
|
||||
"echo_detector_creator.h",
|
||||
|
@ -102,7 +103,7 @@ rtc_source_set("echo_detector_creator") {
|
|||
deps = [
|
||||
"../../api:scoped_refptr",
|
||||
"../../modules/audio_processing:api",
|
||||
"../../modules/audio_processing:audio_processing",
|
||||
"../../modules/audio_processing:residual_echo_detector",
|
||||
"../../rtc_base:refcount",
|
||||
]
|
||||
}
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
#include "api/audio/audio_frame.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/time_utils.h"
|
||||
|
@ -24,28 +22,6 @@ AudioFrame::AudioFrame() {
|
|||
static_assert(sizeof(data_) == kMaxDataSizeBytes, "kMaxDataSizeBytes");
|
||||
}
|
||||
|
||||
void swap(AudioFrame& a, AudioFrame& b) {
|
||||
using std::swap;
|
||||
swap(a.timestamp_, b.timestamp_);
|
||||
swap(a.elapsed_time_ms_, b.elapsed_time_ms_);
|
||||
swap(a.ntp_time_ms_, b.ntp_time_ms_);
|
||||
swap(a.samples_per_channel_, b.samples_per_channel_);
|
||||
swap(a.sample_rate_hz_, b.sample_rate_hz_);
|
||||
swap(a.num_channels_, b.num_channels_);
|
||||
swap(a.channel_layout_, b.channel_layout_);
|
||||
swap(a.speech_type_, b.speech_type_);
|
||||
swap(a.vad_activity_, b.vad_activity_);
|
||||
swap(a.profile_timestamp_ms_, b.profile_timestamp_ms_);
|
||||
swap(a.packet_infos_, b.packet_infos_);
|
||||
const size_t length_a = a.samples_per_channel_ * a.num_channels_;
|
||||
const size_t length_b = b.samples_per_channel_ * b.num_channels_;
|
||||
RTC_DCHECK_LE(length_a, AudioFrame::kMaxDataSizeSamples);
|
||||
RTC_DCHECK_LE(length_b, AudioFrame::kMaxDataSizeSamples);
|
||||
std::swap_ranges(a.data_, a.data_ + std::max(length_a, length_b), b.data_);
|
||||
swap(a.muted_, b.muted_);
|
||||
swap(a.absolute_capture_timestamp_ms_, b.absolute_capture_timestamp_ms_);
|
||||
}
|
||||
|
||||
void AudioFrame::Reset() {
|
||||
ResetWithoutMuting();
|
||||
muted_ = true;
|
||||
|
|
|
@ -14,11 +14,8 @@
|
|||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "api/audio/channel_layout.h"
|
||||
#include "api/rtp_packet_infos.h"
|
||||
#include "rtc_base/constructor_magic.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
|
@ -60,7 +57,8 @@ class AudioFrame {
|
|||
|
||||
AudioFrame();
|
||||
|
||||
friend void swap(AudioFrame& a, AudioFrame& b);
|
||||
AudioFrame(const AudioFrame&) = delete;
|
||||
AudioFrame& operator=(const AudioFrame&) = delete;
|
||||
|
||||
// Resets all members to their default state.
|
||||
void Reset();
|
||||
|
@ -168,8 +166,6 @@ class AudioFrame {
|
|||
// capture timestamp of a received frame is found in `packet_infos_`.
|
||||
// This timestamp MUST be based on the same clock as rtc::TimeMillis().
|
||||
absl::optional<int64_t> absolute_capture_timestamp_ms_;
|
||||
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(AudioFrame);
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -275,7 +275,7 @@ const char* ChannelLayoutToString(ChannelLayout layout) {
|
|||
case CHANNEL_LAYOUT_BITSTREAM:
|
||||
return "BITSTREAM";
|
||||
}
|
||||
RTC_NOTREACHED() << "Invalid channel layout provided: " << layout;
|
||||
RTC_DCHECK_NOTREACHED() << "Invalid channel layout provided: " << layout;
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ struct RTC_EXPORT EchoCanceller3Config {
|
|||
bool echo_can_saturate = true;
|
||||
bool bounded_erl = false;
|
||||
bool erle_onset_compensation_in_dominant_nearend = false;
|
||||
bool use_conservative_tail_frequency_response = false;
|
||||
bool use_conservative_tail_frequency_response = true;
|
||||
} ep_strength;
|
||||
|
||||
struct EchoAudibility {
|
||||
|
@ -209,6 +209,7 @@ struct RTC_EXPORT EchoCanceller3Config {
|
|||
int hold_duration = 50;
|
||||
int trigger_threshold = 12;
|
||||
bool use_during_initial_phase = true;
|
||||
bool use_unbounded_echo_spectrum = true;
|
||||
} dominant_nearend_detection;
|
||||
|
||||
struct SubbandNearendDetection {
|
||||
|
|
|
@ -374,6 +374,9 @@ void Aec3ConfigFromJsonString(absl::string_view json_string,
|
|||
ReadParam(
|
||||
subsection, "use_during_initial_phase",
|
||||
&cfg.suppressor.dominant_nearend_detection.use_during_initial_phase);
|
||||
ReadParam(subsection, "use_unbounded_echo_spectrum",
|
||||
&cfg.suppressor.dominant_nearend_detection
|
||||
.use_unbounded_echo_spectrum);
|
||||
}
|
||||
|
||||
if (rtc::GetValueFromJsonObject(section, "subband_nearend_detection",
|
||||
|
@ -684,20 +687,20 @@ std::string Aec3ConfigToJsonString(const EchoCanceller3Config& config) {
|
|||
<< config.suppressor.last_lf_smoothing_band << ",";
|
||||
ost << "\"last_lf_band\": " << config.suppressor.last_lf_band << ",";
|
||||
ost << "\"first_hf_band\": " << config.suppressor.first_hf_band << ",";
|
||||
ost << "\"dominant_nearend_detection\": {";
|
||||
ost << "\"enr_threshold\": "
|
||||
<< config.suppressor.dominant_nearend_detection.enr_threshold << ",";
|
||||
ost << "\"enr_exit_threshold\": "
|
||||
<< config.suppressor.dominant_nearend_detection.enr_exit_threshold << ",";
|
||||
ost << "\"snr_threshold\": "
|
||||
<< config.suppressor.dominant_nearend_detection.snr_threshold << ",";
|
||||
ost << "\"hold_duration\": "
|
||||
<< config.suppressor.dominant_nearend_detection.hold_duration << ",";
|
||||
ost << "\"trigger_threshold\": "
|
||||
<< config.suppressor.dominant_nearend_detection.trigger_threshold << ",";
|
||||
ost << "\"use_during_initial_phase\": "
|
||||
<< config.suppressor.dominant_nearend_detection.use_during_initial_phase;
|
||||
ost << "},";
|
||||
{
|
||||
const auto& dnd = config.suppressor.dominant_nearend_detection;
|
||||
ost << "\"dominant_nearend_detection\": {";
|
||||
ost << "\"enr_threshold\": " << dnd.enr_threshold << ",";
|
||||
ost << "\"enr_exit_threshold\": " << dnd.enr_exit_threshold << ",";
|
||||
ost << "\"snr_threshold\": " << dnd.snr_threshold << ",";
|
||||
ost << "\"hold_duration\": " << dnd.hold_duration << ",";
|
||||
ost << "\"trigger_threshold\": " << dnd.trigger_threshold << ",";
|
||||
ost << "\"use_during_initial_phase\": " << dnd.use_during_initial_phase
|
||||
<< ",";
|
||||
ost << "\"use_unbounded_echo_spectrum\": "
|
||||
<< dnd.use_unbounded_echo_spectrum;
|
||||
ost << "},";
|
||||
}
|
||||
ost << "\"subband_nearend_detection\": {";
|
||||
ost << "\"nearend_average_blocks\": "
|
||||
<< config.suppressor.subband_nearend_detection.nearend_average_blocks
|
||||
|
|
|
@ -133,54 +133,4 @@ TEST(AudioFrameTest, CopyFrom) {
|
|||
EXPECT_EQ(0, memcmp(frame2.data(), frame1.data(), sizeof(samples)));
|
||||
}
|
||||
|
||||
TEST(AudioFrameTest, SwapFrames) {
|
||||
AudioFrame frame1, frame2;
|
||||
int16_t samples1[kNumChannelsMono * kSamplesPerChannel];
|
||||
for (size_t i = 0; i < kNumChannelsMono * kSamplesPerChannel; ++i) {
|
||||
samples1[i] = i;
|
||||
}
|
||||
frame1.UpdateFrame(kTimestamp, samples1, kSamplesPerChannel, kSampleRateHz,
|
||||
AudioFrame::kPLC, AudioFrame::kVadActive,
|
||||
kNumChannelsMono);
|
||||
frame1.set_absolute_capture_timestamp_ms(12345678);
|
||||
const auto frame1_channel_layout = frame1.channel_layout();
|
||||
|
||||
int16_t samples2[(kNumChannelsMono + 1) * (kSamplesPerChannel + 1)];
|
||||
for (size_t i = 0; i < (kNumChannelsMono + 1) * (kSamplesPerChannel + 1);
|
||||
++i) {
|
||||
samples2[i] = 1000 + i;
|
||||
}
|
||||
frame2.UpdateFrame(kTimestamp + 1, samples2, kSamplesPerChannel + 1,
|
||||
kSampleRateHz + 1, AudioFrame::kNormalSpeech,
|
||||
AudioFrame::kVadPassive, kNumChannelsMono + 1);
|
||||
const auto frame2_channel_layout = frame2.channel_layout();
|
||||
|
||||
swap(frame1, frame2);
|
||||
|
||||
EXPECT_EQ(kTimestamp + 1, frame1.timestamp_);
|
||||
ASSERT_EQ(kSamplesPerChannel + 1, frame1.samples_per_channel_);
|
||||
EXPECT_EQ(kSampleRateHz + 1, frame1.sample_rate_hz_);
|
||||
EXPECT_EQ(AudioFrame::kNormalSpeech, frame1.speech_type_);
|
||||
EXPECT_EQ(AudioFrame::kVadPassive, frame1.vad_activity_);
|
||||
ASSERT_EQ(kNumChannelsMono + 1, frame1.num_channels_);
|
||||
for (size_t i = 0; i < (kNumChannelsMono + 1) * (kSamplesPerChannel + 1);
|
||||
++i) {
|
||||
EXPECT_EQ(samples2[i], frame1.data()[i]);
|
||||
}
|
||||
EXPECT_FALSE(frame1.absolute_capture_timestamp_ms());
|
||||
EXPECT_EQ(frame2_channel_layout, frame1.channel_layout());
|
||||
|
||||
EXPECT_EQ(kTimestamp, frame2.timestamp_);
|
||||
ASSERT_EQ(kSamplesPerChannel, frame2.samples_per_channel_);
|
||||
EXPECT_EQ(kSampleRateHz, frame2.sample_rate_hz_);
|
||||
EXPECT_EQ(AudioFrame::kPLC, frame2.speech_type_);
|
||||
EXPECT_EQ(AudioFrame::kVadActive, frame2.vad_activity_);
|
||||
ASSERT_EQ(kNumChannelsMono, frame2.num_channels_);
|
||||
for (size_t i = 0; i < kNumChannelsMono * kSamplesPerChannel; ++i) {
|
||||
EXPECT_EQ(samples1[i], frame2.data()[i]);
|
||||
}
|
||||
EXPECT_EQ(12345678, frame2.absolute_capture_timestamp_ms());
|
||||
EXPECT_EQ(frame1_channel_layout, frame2.channel_layout());
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -32,6 +32,7 @@ rtc_library("audio_codecs_api") {
|
|||
"..:array_view",
|
||||
"..:bitrate_allocation",
|
||||
"..:scoped_refptr",
|
||||
"../../api:webrtc_key_value_config",
|
||||
"../../rtc_base:checks",
|
||||
"../../rtc_base:rtc_base_approved",
|
||||
"../../rtc_base:sanitizer",
|
||||
|
|
|
@ -21,6 +21,7 @@ rtc_library("audio_encoder_L16") {
|
|||
]
|
||||
deps = [
|
||||
"..:audio_codecs_api",
|
||||
"../../../api:webrtc_key_value_config",
|
||||
"../../../modules/audio_coding:pcm16b",
|
||||
"../../../rtc_base:rtc_base_approved",
|
||||
"../../../rtc_base:safe_minmax",
|
||||
|
@ -41,6 +42,7 @@ rtc_library("audio_decoder_L16") {
|
|||
]
|
||||
deps = [
|
||||
"..:audio_codecs_api",
|
||||
"../../../api:webrtc_key_value_config",
|
||||
"../../../modules/audio_coding:pcm16b",
|
||||
"../../../rtc_base:rtc_base_approved",
|
||||
"../../../rtc_base/system:rtc_export",
|
||||
|
|
|
@ -24,9 +24,10 @@ absl::optional<AudioDecoderL16::Config> AudioDecoderL16::SdpToConfig(
|
|||
Config config;
|
||||
config.sample_rate_hz = format.clockrate_hz;
|
||||
config.num_channels = rtc::checked_cast<int>(format.num_channels);
|
||||
return absl::EqualsIgnoreCase(format.name, "L16") && config.IsOk()
|
||||
? absl::optional<Config>(config)
|
||||
: absl::nullopt;
|
||||
if (absl::EqualsIgnoreCase(format.name, "L16") && config.IsOk()) {
|
||||
return config;
|
||||
}
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
void AudioDecoderL16::AppendSupportedDecoders(
|
||||
|
@ -37,10 +38,13 @@ void AudioDecoderL16::AppendSupportedDecoders(
|
|||
|
||||
std::unique_ptr<AudioDecoder> AudioDecoderL16::MakeAudioDecoder(
|
||||
const Config& config,
|
||||
absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
|
||||
return config.IsOk() ? std::make_unique<AudioDecoderPcm16B>(
|
||||
config.sample_rate_hz, config.num_channels)
|
||||
: nullptr;
|
||||
absl::optional<AudioCodecPairId> /*codec_pair_id*/,
|
||||
const WebRtcKeyValueConfig* field_trials) {
|
||||
if (!config.IsOk()) {
|
||||
return nullptr;
|
||||
}
|
||||
return std::make_unique<AudioDecoderPcm16B>(config.sample_rate_hz,
|
||||
config.num_channels);
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "api/audio_codecs/audio_codec_pair_id.h"
|
||||
#include "api/audio_codecs/audio_decoder.h"
|
||||
#include "api/audio_codecs/audio_format.h"
|
||||
#include "api/webrtc_key_value_config.h"
|
||||
#include "rtc_base/system/rtc_export.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
@ -29,7 +30,8 @@ struct RTC_EXPORT AudioDecoderL16 {
|
|||
bool IsOk() const {
|
||||
return (sample_rate_hz == 8000 || sample_rate_hz == 16000 ||
|
||||
sample_rate_hz == 32000 || sample_rate_hz == 48000) &&
|
||||
num_channels >= 1;
|
||||
(num_channels >= 1 &&
|
||||
num_channels <= AudioDecoder::kMaxNumberOfChannels);
|
||||
}
|
||||
int sample_rate_hz = 8000;
|
||||
int num_channels = 1;
|
||||
|
@ -38,7 +40,8 @@ struct RTC_EXPORT AudioDecoderL16 {
|
|||
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
|
||||
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
||||
const Config& config,
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt);
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
|
||||
const WebRtcKeyValueConfig* field_trials = nullptr);
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -24,6 +24,7 @@ namespace webrtc {
|
|||
absl::optional<AudioEncoderL16::Config> AudioEncoderL16::SdpToConfig(
|
||||
const SdpAudioFormat& format) {
|
||||
if (!rtc::IsValueInRangeForNumericType<int>(format.num_channels)) {
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return absl::nullopt;
|
||||
}
|
||||
Config config;
|
||||
|
@ -36,9 +37,10 @@ absl::optional<AudioEncoderL16::Config> AudioEncoderL16::SdpToConfig(
|
|||
config.frame_size_ms = rtc::SafeClamp(10 * (*ptime / 10), 10, 60);
|
||||
}
|
||||
}
|
||||
return absl::EqualsIgnoreCase(format.name, "L16") && config.IsOk()
|
||||
? absl::optional<Config>(config)
|
||||
: absl::nullopt;
|
||||
if (absl::EqualsIgnoreCase(format.name, "L16") && config.IsOk()) {
|
||||
return config;
|
||||
}
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
void AudioEncoderL16::AppendSupportedEncoders(
|
||||
|
@ -58,13 +60,17 @@ AudioCodecInfo AudioEncoderL16::QueryAudioEncoder(
|
|||
std::unique_ptr<AudioEncoder> AudioEncoderL16::MakeAudioEncoder(
|
||||
const AudioEncoderL16::Config& config,
|
||||
int payload_type,
|
||||
absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
|
||||
RTC_DCHECK(config.IsOk());
|
||||
absl::optional<AudioCodecPairId> /*codec_pair_id*/,
|
||||
const WebRtcKeyValueConfig* field_trials) {
|
||||
AudioEncoderPcm16B::Config c;
|
||||
c.sample_rate_hz = config.sample_rate_hz;
|
||||
c.num_channels = config.num_channels;
|
||||
c.frame_size_ms = config.frame_size_ms;
|
||||
c.payload_type = payload_type;
|
||||
if (!config.IsOk()) {
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
return std::make_unique<AudioEncoderPcm16B>(c);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "api/audio_codecs/audio_codec_pair_id.h"
|
||||
#include "api/audio_codecs/audio_encoder.h"
|
||||
#include "api/audio_codecs/audio_format.h"
|
||||
#include "api/webrtc_key_value_config.h"
|
||||
#include "rtc_base/system/rtc_export.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
@ -29,7 +30,9 @@ struct RTC_EXPORT AudioEncoderL16 {
|
|||
bool IsOk() const {
|
||||
return (sample_rate_hz == 8000 || sample_rate_hz == 16000 ||
|
||||
sample_rate_hz == 32000 || sample_rate_hz == 48000) &&
|
||||
num_channels >= 1 && frame_size_ms > 0 && frame_size_ms <= 120 &&
|
||||
num_channels >= 1 &&
|
||||
num_channels <= AudioEncoder::kMaxNumberOfChannels &&
|
||||
frame_size_ms > 0 && frame_size_ms <= 120 &&
|
||||
frame_size_ms % 10 == 0;
|
||||
}
|
||||
int sample_rate_hz = 8000;
|
||||
|
@ -42,7 +45,8 @@ struct RTC_EXPORT AudioEncoderL16 {
|
|||
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
||||
const Config& config,
|
||||
int payload_type,
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt);
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
|
||||
const WebRtcKeyValueConfig* field_trials = nullptr);
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -161,9 +161,10 @@ AudioDecoder::SpeechType AudioDecoder::ConvertSpeechType(int16_t type) {
|
|||
case 2:
|
||||
return kComfortNoise;
|
||||
default:
|
||||
RTC_NOTREACHED();
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return kSpeech;
|
||||
}
|
||||
}
|
||||
|
||||
constexpr int AudioDecoder::kMaxNumberOfChannels;
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "absl/types/optional.h"
|
||||
#include "api/array_view.h"
|
||||
#include "rtc_base/buffer.h"
|
||||
#include "rtc_base/constructor_magic.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
|
@ -37,6 +36,9 @@ class AudioDecoder {
|
|||
AudioDecoder() = default;
|
||||
virtual ~AudioDecoder() = default;
|
||||
|
||||
AudioDecoder(const AudioDecoder&) = delete;
|
||||
AudioDecoder& operator=(const AudioDecoder&) = delete;
|
||||
|
||||
class EncodedAudioFrame {
|
||||
public:
|
||||
struct DecodeResult {
|
||||
|
@ -170,6 +172,9 @@ class AudioDecoder {
|
|||
// during the lifetime of the decoder.
|
||||
virtual size_t Channels() const = 0;
|
||||
|
||||
// The maximum number of audio channels supported by WebRTC decoders.
|
||||
static constexpr int kMaxNumberOfChannels = 24;
|
||||
|
||||
protected:
|
||||
static SpeechType ConvertSpeechType(int16_t type);
|
||||
|
||||
|
@ -184,9 +189,6 @@ class AudioDecoder {
|
|||
int sample_rate_hz,
|
||||
int16_t* decoded,
|
||||
SpeechType* speech_type);
|
||||
|
||||
private:
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoder);
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "api/audio_codecs/audio_decoder_factory.h"
|
||||
#include "api/scoped_refptr.h"
|
||||
#include "api/webrtc_key_value_config.h"
|
||||
#include "rtc_base/ref_counted_object.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
@ -32,7 +33,8 @@ struct Helper<> {
|
|||
static bool IsSupportedDecoder(const SdpAudioFormat& format) { return false; }
|
||||
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
||||
const SdpAudioFormat& format,
|
||||
absl::optional<AudioCodecPairId> codec_pair_id) {
|
||||
absl::optional<AudioCodecPairId> codec_pair_id,
|
||||
const WebRtcKeyValueConfig* field_trials) {
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
@ -55,16 +57,22 @@ struct Helper<T, Ts...> {
|
|||
}
|
||||
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
||||
const SdpAudioFormat& format,
|
||||
absl::optional<AudioCodecPairId> codec_pair_id) {
|
||||
absl::optional<AudioCodecPairId> codec_pair_id,
|
||||
const WebRtcKeyValueConfig* field_trials) {
|
||||
auto opt_config = T::SdpToConfig(format);
|
||||
return opt_config ? T::MakeAudioDecoder(*opt_config, codec_pair_id)
|
||||
: Helper<Ts...>::MakeAudioDecoder(format, codec_pair_id);
|
||||
: Helper<Ts...>::MakeAudioDecoder(format, codec_pair_id,
|
||||
field_trials);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename... Ts>
|
||||
class AudioDecoderFactoryT : public AudioDecoderFactory {
|
||||
public:
|
||||
explicit AudioDecoderFactoryT(const WebRtcKeyValueConfig* field_trials) {
|
||||
field_trials_ = field_trials;
|
||||
}
|
||||
|
||||
std::vector<AudioCodecSpec> GetSupportedDecoders() override {
|
||||
std::vector<AudioCodecSpec> specs;
|
||||
Helper<Ts...>::AppendSupportedDecoders(&specs);
|
||||
|
@ -78,8 +86,11 @@ class AudioDecoderFactoryT : public AudioDecoderFactory {
|
|||
std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
||||
const SdpAudioFormat& format,
|
||||
absl::optional<AudioCodecPairId> codec_pair_id) override {
|
||||
return Helper<Ts...>::MakeAudioDecoder(format, codec_pair_id);
|
||||
return Helper<Ts...>::MakeAudioDecoder(format, codec_pair_id,
|
||||
field_trials_);
|
||||
}
|
||||
|
||||
const WebRtcKeyValueConfig* field_trials_;
|
||||
};
|
||||
|
||||
} // namespace audio_decoder_factory_template_impl
|
||||
|
@ -115,7 +126,8 @@ class AudioDecoderFactoryT : public AudioDecoderFactory {
|
|||
// TODO(kwiberg): Point at CreateBuiltinAudioDecoderFactory() for an example of
|
||||
// how it is used.
|
||||
template <typename... Ts>
|
||||
rtc::scoped_refptr<AudioDecoderFactory> CreateAudioDecoderFactory() {
|
||||
rtc::scoped_refptr<AudioDecoderFactory> CreateAudioDecoderFactory(
|
||||
const WebRtcKeyValueConfig* field_trials = nullptr) {
|
||||
// There's no technical reason we couldn't allow zero template parameters,
|
||||
// but such a factory couldn't create any decoders, and callers can do this
|
||||
// by mistake by simply forgetting the <> altogether. So we forbid it in
|
||||
|
@ -124,7 +136,8 @@ rtc::scoped_refptr<AudioDecoderFactory> CreateAudioDecoderFactory() {
|
|||
"Caller must give at least one template parameter");
|
||||
|
||||
return rtc::make_ref_counted<
|
||||
audio_decoder_factory_template_impl::AudioDecoderFactoryT<Ts...>>();
|
||||
audio_decoder_factory_template_impl::AudioDecoderFactoryT<Ts...>>(
|
||||
field_trials);
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -83,7 +83,7 @@ void AudioEncoder::OnReceivedUplinkPacketLossFraction(
|
|||
|
||||
void AudioEncoder::OnReceivedUplinkRecoverablePacketLossFraction(
|
||||
float uplink_recoverable_packet_loss_fraction) {
|
||||
RTC_NOTREACHED();
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
}
|
||||
|
||||
void AudioEncoder::OnReceivedTargetAudioBitrate(int target_audio_bitrate_bps) {
|
||||
|
@ -110,4 +110,5 @@ ANAStats AudioEncoder::GetANAStats() const {
|
|||
return ANAStats();
|
||||
}
|
||||
|
||||
constexpr int AudioEncoder::kMaxNumberOfChannels;
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -276,6 +276,9 @@ class AudioEncoder {
|
|||
virtual absl::optional<std::pair<TimeDelta, TimeDelta>> GetFrameLengthRange()
|
||||
const = 0;
|
||||
|
||||
// The maximum number of audio channels supported by WebRTC encoders.
|
||||
static constexpr int kMaxNumberOfChannels = 24;
|
||||
|
||||
// RingRTC Change to configure OPUS
|
||||
virtual bool Configure(const Config& config) {
|
||||
RTC_LOG(LS_WARNING) << "Default AudioEncoder::Configure(...) does nothing!";
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "api/audio_codecs/audio_encoder_factory.h"
|
||||
#include "api/scoped_refptr.h"
|
||||
#include "api/webrtc_key_value_config.h"
|
||||
#include "rtc_base/ref_counted_object.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
@ -36,7 +37,8 @@ struct Helper<> {
|
|||
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
||||
int payload_type,
|
||||
const SdpAudioFormat& format,
|
||||
absl::optional<AudioCodecPairId> codec_pair_id) {
|
||||
absl::optional<AudioCodecPairId> codec_pair_id,
|
||||
const WebRtcKeyValueConfig* field_trials) {
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
@ -63,13 +65,14 @@ struct Helper<T, Ts...> {
|
|||
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
||||
int payload_type,
|
||||
const SdpAudioFormat& format,
|
||||
absl::optional<AudioCodecPairId> codec_pair_id) {
|
||||
absl::optional<AudioCodecPairId> codec_pair_id,
|
||||
const WebRtcKeyValueConfig* field_trials) {
|
||||
auto opt_config = T::SdpToConfig(format);
|
||||
if (opt_config) {
|
||||
return T::MakeAudioEncoder(*opt_config, payload_type, codec_pair_id);
|
||||
} else {
|
||||
return Helper<Ts...>::MakeAudioEncoder(payload_type, format,
|
||||
codec_pair_id);
|
||||
codec_pair_id, field_trials);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -77,6 +80,10 @@ struct Helper<T, Ts...> {
|
|||
template <typename... Ts>
|
||||
class AudioEncoderFactoryT : public AudioEncoderFactory {
|
||||
public:
|
||||
explicit AudioEncoderFactoryT(const WebRtcKeyValueConfig* field_trials) {
|
||||
field_trials_ = field_trials;
|
||||
}
|
||||
|
||||
std::vector<AudioCodecSpec> GetSupportedEncoders() override {
|
||||
std::vector<AudioCodecSpec> specs;
|
||||
Helper<Ts...>::AppendSupportedEncoders(&specs);
|
||||
|
@ -92,8 +99,11 @@ class AudioEncoderFactoryT : public AudioEncoderFactory {
|
|||
int payload_type,
|
||||
const SdpAudioFormat& format,
|
||||
absl::optional<AudioCodecPairId> codec_pair_id) override {
|
||||
return Helper<Ts...>::MakeAudioEncoder(payload_type, format, codec_pair_id);
|
||||
return Helper<Ts...>::MakeAudioEncoder(payload_type, format, codec_pair_id,
|
||||
field_trials_);
|
||||
}
|
||||
|
||||
const WebRtcKeyValueConfig* field_trials_;
|
||||
};
|
||||
|
||||
} // namespace audio_encoder_factory_template_impl
|
||||
|
@ -134,7 +144,8 @@ class AudioEncoderFactoryT : public AudioEncoderFactory {
|
|||
// TODO(kwiberg): Point at CreateBuiltinAudioEncoderFactory() for an example of
|
||||
// how it is used.
|
||||
template <typename... Ts>
|
||||
rtc::scoped_refptr<AudioEncoderFactory> CreateAudioEncoderFactory() {
|
||||
rtc::scoped_refptr<AudioEncoderFactory> CreateAudioEncoderFactory(
|
||||
const WebRtcKeyValueConfig* field_trials = nullptr) {
|
||||
// There's no technical reason we couldn't allow zero template parameters,
|
||||
// but such a factory couldn't create any encoders, and callers can do this
|
||||
// by mistake by simply forgetting the <> altogether. So we forbid it in
|
||||
|
@ -143,7 +154,8 @@ rtc::scoped_refptr<AudioEncoderFactory> CreateAudioEncoderFactory() {
|
|||
"Caller must give at least one template parameter");
|
||||
|
||||
return rtc::make_ref_counted<
|
||||
audio_encoder_factory_template_impl::AudioEncoderFactoryT<Ts...>>();
|
||||
audio_encoder_factory_template_impl::AudioEncoderFactoryT<Ts...>>(
|
||||
field_trials);
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -47,8 +47,10 @@ struct NotAdvertised {
|
|||
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
||||
const Config& config,
|
||||
int payload_type,
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt) {
|
||||
return T::MakeAudioEncoder(config, payload_type, codec_pair_id);
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
|
||||
const WebRtcKeyValueConfig* field_trials = nullptr) {
|
||||
return T::MakeAudioEncoder(config, payload_type, codec_pair_id,
|
||||
field_trials);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ rtc_library("audio_encoder_g711") {
|
|||
]
|
||||
deps = [
|
||||
"..:audio_codecs_api",
|
||||
"../../../api:webrtc_key_value_config",
|
||||
"../../../modules/audio_coding:g711",
|
||||
"../../../rtc_base:rtc_base_approved",
|
||||
"../../../rtc_base:safe_minmax",
|
||||
|
@ -41,6 +42,7 @@ rtc_library("audio_decoder_g711") {
|
|||
]
|
||||
deps = [
|
||||
"..:audio_codecs_api",
|
||||
"../../../api:webrtc_key_value_config",
|
||||
"../../../modules/audio_coding:g711",
|
||||
"../../../rtc_base:rtc_base_approved",
|
||||
"../../../rtc_base/system:rtc_export",
|
||||
|
|
|
@ -28,7 +28,10 @@ absl::optional<AudioDecoderG711::Config> AudioDecoderG711::SdpToConfig(
|
|||
Config config;
|
||||
config.type = is_pcmu ? Config::Type::kPcmU : Config::Type::kPcmA;
|
||||
config.num_channels = rtc::dchecked_cast<int>(format.num_channels);
|
||||
RTC_DCHECK(config.IsOk());
|
||||
if (!config.IsOk()) {
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return absl::nullopt;
|
||||
}
|
||||
return config;
|
||||
} else {
|
||||
return absl::nullopt;
|
||||
|
@ -45,14 +48,19 @@ void AudioDecoderG711::AppendSupportedDecoders(
|
|||
|
||||
std::unique_ptr<AudioDecoder> AudioDecoderG711::MakeAudioDecoder(
|
||||
const Config& config,
|
||||
absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
|
||||
RTC_DCHECK(config.IsOk());
|
||||
absl::optional<AudioCodecPairId> /*codec_pair_id*/,
|
||||
const WebRtcKeyValueConfig* field_trials) {
|
||||
if (!config.IsOk()) {
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
switch (config.type) {
|
||||
case Config::Type::kPcmU:
|
||||
return std::make_unique<AudioDecoderPcmU>(config.num_channels);
|
||||
case Config::Type::kPcmA:
|
||||
return std::make_unique<AudioDecoderPcmA>(config.num_channels);
|
||||
default:
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "api/audio_codecs/audio_codec_pair_id.h"
|
||||
#include "api/audio_codecs/audio_decoder.h"
|
||||
#include "api/audio_codecs/audio_format.h"
|
||||
#include "api/webrtc_key_value_config.h"
|
||||
#include "rtc_base/system/rtc_export.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
@ -28,7 +29,9 @@ struct RTC_EXPORT AudioDecoderG711 {
|
|||
struct Config {
|
||||
enum class Type { kPcmU, kPcmA };
|
||||
bool IsOk() const {
|
||||
return (type == Type::kPcmU || type == Type::kPcmA) && num_channels >= 1;
|
||||
return (type == Type::kPcmU || type == Type::kPcmA) &&
|
||||
num_channels >= 1 &&
|
||||
num_channels <= AudioDecoder::kMaxNumberOfChannels;
|
||||
}
|
||||
Type type;
|
||||
int num_channels;
|
||||
|
@ -37,7 +40,8 @@ struct RTC_EXPORT AudioDecoderG711 {
|
|||
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
|
||||
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
||||
const Config& config,
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt);
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
|
||||
const WebRtcKeyValueConfig* field_trials = nullptr);
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -38,7 +38,10 @@ absl::optional<AudioEncoderG711::Config> AudioEncoderG711::SdpToConfig(
|
|||
config.frame_size_ms = rtc::SafeClamp(10 * (*ptime / 10), 10, 60);
|
||||
}
|
||||
}
|
||||
RTC_DCHECK(config.IsOk());
|
||||
if (!config.IsOk()) {
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return absl::nullopt;
|
||||
}
|
||||
return config;
|
||||
} else {
|
||||
return absl::nullopt;
|
||||
|
@ -62,8 +65,12 @@ AudioCodecInfo AudioEncoderG711::QueryAudioEncoder(const Config& config) {
|
|||
std::unique_ptr<AudioEncoder> AudioEncoderG711::MakeAudioEncoder(
|
||||
const Config& config,
|
||||
int payload_type,
|
||||
absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
|
||||
RTC_DCHECK(config.IsOk());
|
||||
absl::optional<AudioCodecPairId> /*codec_pair_id*/,
|
||||
const WebRtcKeyValueConfig* field_trials) {
|
||||
if (!config.IsOk()) {
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
switch (config.type) {
|
||||
case Config::Type::kPcmU: {
|
||||
AudioEncoderPcmU::Config impl_config;
|
||||
|
@ -80,6 +87,7 @@ std::unique_ptr<AudioEncoder> AudioEncoderG711::MakeAudioEncoder(
|
|||
return std::make_unique<AudioEncoderPcmA>(impl_config);
|
||||
}
|
||||
default: {
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "api/audio_codecs/audio_codec_pair_id.h"
|
||||
#include "api/audio_codecs/audio_encoder.h"
|
||||
#include "api/audio_codecs/audio_format.h"
|
||||
#include "api/webrtc_key_value_config.h"
|
||||
#include "rtc_base/system/rtc_export.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
@ -29,7 +30,9 @@ struct RTC_EXPORT AudioEncoderG711 {
|
|||
enum class Type { kPcmU, kPcmA };
|
||||
bool IsOk() const {
|
||||
return (type == Type::kPcmU || type == Type::kPcmA) &&
|
||||
frame_size_ms > 0 && frame_size_ms % 10 == 0 && num_channels >= 1;
|
||||
frame_size_ms > 0 && frame_size_ms % 10 == 0 &&
|
||||
num_channels >= 1 &&
|
||||
num_channels <= AudioEncoder::kMaxNumberOfChannels;
|
||||
}
|
||||
Type type = Type::kPcmU;
|
||||
int num_channels = 1;
|
||||
|
@ -42,7 +45,8 @@ struct RTC_EXPORT AudioEncoderG711 {
|
|||
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
||||
const Config& config,
|
||||
int payload_type,
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt);
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
|
||||
const WebRtcKeyValueConfig* field_trials = nullptr);
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -27,6 +27,7 @@ rtc_library("audio_encoder_g722") {
|
|||
deps = [
|
||||
":audio_encoder_g722_config",
|
||||
"..:audio_codecs_api",
|
||||
"../../../api:webrtc_key_value_config",
|
||||
"../../../modules/audio_coding:g722",
|
||||
"../../../rtc_base:rtc_base_approved",
|
||||
"../../../rtc_base:safe_minmax",
|
||||
|
@ -47,6 +48,7 @@ rtc_library("audio_decoder_g722") {
|
|||
]
|
||||
deps = [
|
||||
"..:audio_codecs_api",
|
||||
"../../../api:webrtc_key_value_config",
|
||||
"../../../modules/audio_coding:g722",
|
||||
"../../../rtc_base:rtc_base_approved",
|
||||
"../../../rtc_base/system:rtc_export",
|
||||
|
|
|
@ -21,12 +21,12 @@ namespace webrtc {
|
|||
|
||||
absl::optional<AudioDecoderG722::Config> AudioDecoderG722::SdpToConfig(
|
||||
const SdpAudioFormat& format) {
|
||||
return absl::EqualsIgnoreCase(format.name, "G722") &&
|
||||
format.clockrate_hz == 8000 &&
|
||||
(format.num_channels == 1 || format.num_channels == 2)
|
||||
? absl::optional<Config>(
|
||||
Config{rtc::dchecked_cast<int>(format.num_channels)})
|
||||
: absl::nullopt;
|
||||
if (absl::EqualsIgnoreCase(format.name, "G722") &&
|
||||
format.clockrate_hz == 8000 &&
|
||||
(format.num_channels == 1 || format.num_channels == 2)) {
|
||||
return Config{rtc::dchecked_cast<int>(format.num_channels)};
|
||||
}
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
void AudioDecoderG722::AppendSupportedDecoders(
|
||||
|
@ -37,13 +37,19 @@ void AudioDecoderG722::AppendSupportedDecoders(
|
|||
|
||||
std::unique_ptr<AudioDecoder> AudioDecoderG722::MakeAudioDecoder(
|
||||
Config config,
|
||||
absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
|
||||
absl::optional<AudioCodecPairId> /*codec_pair_id*/,
|
||||
const WebRtcKeyValueConfig* field_trials) {
|
||||
if (!config.IsOk()) {
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
switch (config.num_channels) {
|
||||
case 1:
|
||||
return std::make_unique<AudioDecoderG722Impl>();
|
||||
case 2:
|
||||
return std::make_unique<AudioDecoderG722StereoImpl>();
|
||||
default:
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "api/audio_codecs/audio_codec_pair_id.h"
|
||||
#include "api/audio_codecs/audio_decoder.h"
|
||||
#include "api/audio_codecs/audio_format.h"
|
||||
#include "api/webrtc_key_value_config.h"
|
||||
#include "rtc_base/system/rtc_export.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
@ -33,7 +34,8 @@ struct RTC_EXPORT AudioDecoderG722 {
|
|||
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
|
||||
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
||||
Config config,
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt);
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
|
||||
const WebRtcKeyValueConfig* field_trials = nullptr);
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -38,8 +38,11 @@ absl::optional<AudioEncoderG722Config> AudioEncoderG722::SdpToConfig(
|
|||
config.frame_size_ms = rtc::SafeClamp<int>(whole_packets * 10, 10, 60);
|
||||
}
|
||||
}
|
||||
return config.IsOk() ? absl::optional<AudioEncoderG722Config>(config)
|
||||
: absl::nullopt;
|
||||
if (!config.IsOk()) {
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return absl::nullopt;
|
||||
}
|
||||
return config;
|
||||
}
|
||||
|
||||
void AudioEncoderG722::AppendSupportedEncoders(
|
||||
|
@ -60,8 +63,12 @@ AudioCodecInfo AudioEncoderG722::QueryAudioEncoder(
|
|||
std::unique_ptr<AudioEncoder> AudioEncoderG722::MakeAudioEncoder(
|
||||
const AudioEncoderG722Config& config,
|
||||
int payload_type,
|
||||
absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
|
||||
RTC_DCHECK(config.IsOk());
|
||||
absl::optional<AudioCodecPairId> /*codec_pair_id*/,
|
||||
const WebRtcKeyValueConfig* field_trials) {
|
||||
if (!config.IsOk()) {
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
return std::make_unique<AudioEncoderG722Impl>(config, payload_type);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "api/audio_codecs/audio_encoder.h"
|
||||
#include "api/audio_codecs/audio_format.h"
|
||||
#include "api/audio_codecs/g722/audio_encoder_g722_config.h"
|
||||
#include "api/webrtc_key_value_config.h"
|
||||
#include "rtc_base/system/rtc_export.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
@ -34,7 +35,8 @@ struct RTC_EXPORT AudioEncoderG722 {
|
|||
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
||||
const AudioEncoderG722Config& config,
|
||||
int payload_type,
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt);
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
|
||||
const WebRtcKeyValueConfig* field_trials = nullptr);
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -15,7 +15,8 @@ namespace webrtc {
|
|||
|
||||
struct AudioEncoderG722Config {
|
||||
bool IsOk() const {
|
||||
return frame_size_ms > 0 && frame_size_ms % 10 == 0 && num_channels >= 1;
|
||||
return frame_size_ms > 0 && frame_size_ms % 10 == 0 && num_channels >= 1 &&
|
||||
num_channels <= AudioEncoder::kMaxNumberOfChannels;
|
||||
}
|
||||
int frame_size_ms = 20;
|
||||
int num_channels = 1;
|
||||
|
|
|
@ -27,6 +27,7 @@ rtc_library("audio_encoder_ilbc") {
|
|||
deps = [
|
||||
":audio_encoder_ilbc_config",
|
||||
"..:audio_codecs_api",
|
||||
"../../../api:webrtc_key_value_config",
|
||||
"../../../modules/audio_coding:ilbc",
|
||||
"../../../rtc_base:rtc_base_approved",
|
||||
"../../../rtc_base:safe_minmax",
|
||||
|
@ -46,6 +47,7 @@ rtc_library("audio_decoder_ilbc") {
|
|||
]
|
||||
deps = [
|
||||
"..:audio_codecs_api",
|
||||
"../../../api:webrtc_key_value_config",
|
||||
"../../../modules/audio_coding:ilbc",
|
||||
"../../../rtc_base:rtc_base_approved",
|
||||
]
|
||||
|
|
|
@ -20,10 +20,11 @@ namespace webrtc {
|
|||
|
||||
absl::optional<AudioDecoderIlbc::Config> AudioDecoderIlbc::SdpToConfig(
|
||||
const SdpAudioFormat& format) {
|
||||
return absl::EqualsIgnoreCase(format.name, "ILBC") &&
|
||||
format.clockrate_hz == 8000 && format.num_channels == 1
|
||||
? absl::optional<Config>(Config())
|
||||
: absl::nullopt;
|
||||
if (absl::EqualsIgnoreCase(format.name, "ILBC") &&
|
||||
format.clockrate_hz == 8000 && format.num_channels == 1) {
|
||||
return Config();
|
||||
}
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
void AudioDecoderIlbc::AppendSupportedDecoders(
|
||||
|
@ -34,7 +35,8 @@ void AudioDecoderIlbc::AppendSupportedDecoders(
|
|||
|
||||
std::unique_ptr<AudioDecoder> AudioDecoderIlbc::MakeAudioDecoder(
|
||||
Config config,
|
||||
absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
|
||||
absl::optional<AudioCodecPairId> /*codec_pair_id*/,
|
||||
const WebRtcKeyValueConfig* field_trials) {
|
||||
return std::make_unique<AudioDecoderIlbcImpl>();
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "api/audio_codecs/audio_codec_pair_id.h"
|
||||
#include "api/audio_codecs/audio_decoder.h"
|
||||
#include "api/audio_codecs/audio_format.h"
|
||||
#include "api/webrtc_key_value_config.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
|
@ -29,7 +30,8 @@ struct AudioDecoderIlbc {
|
|||
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
|
||||
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
||||
Config config,
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt);
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
|
||||
const WebRtcKeyValueConfig* field_trials = nullptr);
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -53,8 +53,11 @@ absl::optional<AudioEncoderIlbcConfig> AudioEncoderIlbc::SdpToConfig(
|
|||
config.frame_size_ms = rtc::SafeClamp<int>(whole_packets * 10, 20, 60);
|
||||
}
|
||||
}
|
||||
return config.IsOk() ? absl::optional<AudioEncoderIlbcConfig>(config)
|
||||
: absl::nullopt;
|
||||
if (!config.IsOk()) {
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return absl::nullopt;
|
||||
}
|
||||
return config;
|
||||
}
|
||||
|
||||
void AudioEncoderIlbc::AppendSupportedEncoders(
|
||||
|
@ -74,8 +77,12 @@ AudioCodecInfo AudioEncoderIlbc::QueryAudioEncoder(
|
|||
std::unique_ptr<AudioEncoder> AudioEncoderIlbc::MakeAudioEncoder(
|
||||
const AudioEncoderIlbcConfig& config,
|
||||
int payload_type,
|
||||
absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
|
||||
RTC_DCHECK(config.IsOk());
|
||||
absl::optional<AudioCodecPairId> /*codec_pair_id*/,
|
||||
const WebRtcKeyValueConfig* field_trials) {
|
||||
if (!config.IsOk()) {
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
return std::make_unique<AudioEncoderIlbcImpl>(config, payload_type);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "api/audio_codecs/audio_encoder.h"
|
||||
#include "api/audio_codecs/audio_format.h"
|
||||
#include "api/audio_codecs/ilbc/audio_encoder_ilbc_config.h"
|
||||
#include "api/webrtc_key_value_config.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
|
@ -33,7 +34,8 @@ struct AudioEncoderIlbc {
|
|||
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
||||
const AudioEncoderIlbcConfig& config,
|
||||
int payload_type,
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt);
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
|
||||
const WebRtcKeyValueConfig* field_trials = nullptr);
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -65,6 +65,7 @@ rtc_library("audio_encoder_isac_fix") {
|
|||
]
|
||||
deps = [
|
||||
"..:audio_codecs_api",
|
||||
"../../../api:webrtc_key_value_config",
|
||||
"../../../modules/audio_coding:isac_fix",
|
||||
"../../../rtc_base:rtc_base_approved",
|
||||
"../../../rtc_base/system:rtc_export",
|
||||
|
@ -84,6 +85,7 @@ rtc_library("audio_decoder_isac_fix") {
|
|||
]
|
||||
deps = [
|
||||
"..:audio_codecs_api",
|
||||
"../../../api:webrtc_key_value_config",
|
||||
"../../../modules/audio_coding:isac_fix",
|
||||
"../../../rtc_base:rtc_base_approved",
|
||||
"../../../rtc_base/system:rtc_export",
|
||||
|
@ -103,6 +105,7 @@ rtc_library("audio_encoder_isac_float") {
|
|||
]
|
||||
deps = [
|
||||
"..:audio_codecs_api",
|
||||
"../../../api:webrtc_key_value_config",
|
||||
"../../../modules/audio_coding:isac",
|
||||
"../../../rtc_base:rtc_base_approved",
|
||||
"../../../rtc_base/system:rtc_export",
|
||||
|
@ -122,6 +125,7 @@ rtc_library("audio_decoder_isac_float") {
|
|||
]
|
||||
deps = [
|
||||
"..:audio_codecs_api",
|
||||
"../../../api:webrtc_key_value_config",
|
||||
"../../../modules/audio_coding:isac",
|
||||
"../../../rtc_base:rtc_base_approved",
|
||||
"../../../rtc_base/system:rtc_export",
|
||||
|
|
|
@ -19,10 +19,11 @@ namespace webrtc {
|
|||
|
||||
absl::optional<AudioDecoderIsacFix::Config> AudioDecoderIsacFix::SdpToConfig(
|
||||
const SdpAudioFormat& format) {
|
||||
return absl::EqualsIgnoreCase(format.name, "ISAC") &&
|
||||
format.clockrate_hz == 16000 && format.num_channels == 1
|
||||
? absl::optional<Config>(Config())
|
||||
: absl::nullopt;
|
||||
if (absl::EqualsIgnoreCase(format.name, "ISAC") &&
|
||||
format.clockrate_hz == 16000 && format.num_channels == 1) {
|
||||
return Config();
|
||||
}
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
void AudioDecoderIsacFix::AppendSupportedDecoders(
|
||||
|
@ -33,7 +34,8 @@ void AudioDecoderIsacFix::AppendSupportedDecoders(
|
|||
|
||||
std::unique_ptr<AudioDecoder> AudioDecoderIsacFix::MakeAudioDecoder(
|
||||
Config config,
|
||||
absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
|
||||
absl::optional<AudioCodecPairId> /*codec_pair_id*/,
|
||||
const WebRtcKeyValueConfig* field_trials) {
|
||||
AudioDecoderIsacFixImpl::Config c;
|
||||
c.sample_rate_hz = 16000;
|
||||
return std::make_unique<AudioDecoderIsacFixImpl>(c);
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "api/audio_codecs/audio_codec_pair_id.h"
|
||||
#include "api/audio_codecs/audio_decoder.h"
|
||||
#include "api/audio_codecs/audio_format.h"
|
||||
#include "api/webrtc_key_value_config.h"
|
||||
#include "rtc_base/system/rtc_export.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
@ -30,7 +31,8 @@ struct RTC_EXPORT AudioDecoderIsacFix {
|
|||
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
|
||||
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
||||
Config config,
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt);
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
|
||||
const WebRtcKeyValueConfig* field_trials = nullptr);
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -24,6 +24,10 @@ AudioDecoderIsacFloat::SdpToConfig(const SdpAudioFormat& format) {
|
|||
format.num_channels == 1) {
|
||||
Config config;
|
||||
config.sample_rate_hz = format.clockrate_hz;
|
||||
if (!config.IsOk()) {
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return absl::nullopt;
|
||||
}
|
||||
return config;
|
||||
} else {
|
||||
return absl::nullopt;
|
||||
|
@ -39,10 +43,14 @@ void AudioDecoderIsacFloat::AppendSupportedDecoders(
|
|||
|
||||
std::unique_ptr<AudioDecoder> AudioDecoderIsacFloat::MakeAudioDecoder(
|
||||
Config config,
|
||||
absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
|
||||
RTC_DCHECK(config.IsOk());
|
||||
absl::optional<AudioCodecPairId> /*codec_pair_id*/,
|
||||
const WebRtcKeyValueConfig* field_trials) {
|
||||
AudioDecoderIsacFloatImpl::Config c;
|
||||
c.sample_rate_hz = config.sample_rate_hz;
|
||||
if (!config.IsOk()) {
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
return std::make_unique<AudioDecoderIsacFloatImpl>(c);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "api/audio_codecs/audio_codec_pair_id.h"
|
||||
#include "api/audio_codecs/audio_decoder.h"
|
||||
#include "api/audio_codecs/audio_format.h"
|
||||
#include "api/webrtc_key_value_config.h"
|
||||
#include "rtc_base/system/rtc_export.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
@ -35,7 +36,8 @@ struct RTC_EXPORT AudioDecoderIsacFloat {
|
|||
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
|
||||
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
||||
Config config,
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt);
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
|
||||
const WebRtcKeyValueConfig* field_trials = nullptr);
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -30,6 +30,10 @@ absl::optional<AudioEncoderIsacFix::Config> AudioEncoderIsacFix::SdpToConfig(
|
|||
config.frame_size_ms = 60;
|
||||
}
|
||||
}
|
||||
if (!config.IsOk()) {
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return absl::nullopt;
|
||||
}
|
||||
return config;
|
||||
} else {
|
||||
return absl::nullopt;
|
||||
|
@ -53,12 +57,16 @@ AudioCodecInfo AudioEncoderIsacFix::QueryAudioEncoder(
|
|||
std::unique_ptr<AudioEncoder> AudioEncoderIsacFix::MakeAudioEncoder(
|
||||
AudioEncoderIsacFix::Config config,
|
||||
int payload_type,
|
||||
absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
|
||||
RTC_DCHECK(config.IsOk());
|
||||
absl::optional<AudioCodecPairId> /*codec_pair_id*/,
|
||||
const WebRtcKeyValueConfig* field_trials) {
|
||||
AudioEncoderIsacFixImpl::Config c;
|
||||
c.frame_size_ms = config.frame_size_ms;
|
||||
c.bit_rate = config.bit_rate;
|
||||
c.payload_type = payload_type;
|
||||
if (!config.IsOk()) {
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
return std::make_unique<AudioEncoderIsacFixImpl>(c);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "api/audio_codecs/audio_codec_pair_id.h"
|
||||
#include "api/audio_codecs/audio_encoder.h"
|
||||
#include "api/audio_codecs/audio_format.h"
|
||||
#include "api/webrtc_key_value_config.h"
|
||||
#include "rtc_base/system/rtc_export.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
@ -44,7 +45,8 @@ struct RTC_EXPORT AudioEncoderIsacFix {
|
|||
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
||||
Config config,
|
||||
int payload_type,
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt);
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
|
||||
const WebRtcKeyValueConfig* field_trials = nullptr);
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -37,6 +37,10 @@ AudioEncoderIsacFloat::SdpToConfig(const SdpAudioFormat& format) {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!config.IsOk()) {
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return absl::nullopt;
|
||||
}
|
||||
return config;
|
||||
} else {
|
||||
return absl::nullopt;
|
||||
|
@ -65,13 +69,17 @@ AudioCodecInfo AudioEncoderIsacFloat::QueryAudioEncoder(
|
|||
std::unique_ptr<AudioEncoder> AudioEncoderIsacFloat::MakeAudioEncoder(
|
||||
const AudioEncoderIsacFloat::Config& config,
|
||||
int payload_type,
|
||||
absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
|
||||
RTC_DCHECK(config.IsOk());
|
||||
absl::optional<AudioCodecPairId> /*codec_pair_id*/,
|
||||
const WebRtcKeyValueConfig* field_trials) {
|
||||
AudioEncoderIsacFloatImpl::Config c;
|
||||
c.payload_type = payload_type;
|
||||
c.sample_rate_hz = config.sample_rate_hz;
|
||||
c.frame_size_ms = config.frame_size_ms;
|
||||
c.bit_rate = config.bit_rate;
|
||||
if (!config.IsOk()) {
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
return std::make_unique<AudioEncoderIsacFloatImpl>(c);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "api/audio_codecs/audio_codec_pair_id.h"
|
||||
#include "api/audio_codecs/audio_encoder.h"
|
||||
#include "api/audio_codecs/audio_format.h"
|
||||
#include "api/webrtc_key_value_config.h"
|
||||
#include "rtc_base/system/rtc_export.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
@ -58,7 +59,8 @@ struct RTC_EXPORT AudioEncoderIsacFloat {
|
|||
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
||||
const Config& config,
|
||||
int payload_type,
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt);
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
|
||||
const WebRtcKeyValueConfig* field_trials = nullptr);
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -46,6 +46,7 @@ rtc_library("audio_encoder_opus") {
|
|||
deps = [
|
||||
":audio_encoder_opus_config",
|
||||
"..:audio_codecs_api",
|
||||
"../../../api:webrtc_key_value_config",
|
||||
"../../../modules/audio_coding:webrtc_opus",
|
||||
"../../../rtc_base:rtc_base_approved",
|
||||
"../../../rtc_base/system:rtc_export",
|
||||
|
@ -65,6 +66,7 @@ rtc_library("audio_decoder_opus") {
|
|||
]
|
||||
deps = [
|
||||
"..:audio_codecs_api",
|
||||
"../../../api:webrtc_key_value_config",
|
||||
"../../../modules/audio_coding:webrtc_opus",
|
||||
"../../../rtc_base:rtc_base_approved",
|
||||
"../../../rtc_base/system:rtc_export",
|
||||
|
@ -82,6 +84,7 @@ rtc_library("audio_encoder_multiopus") {
|
|||
sources = [ "audio_encoder_multi_channel_opus.cc" ]
|
||||
deps = [
|
||||
"..:audio_codecs_api",
|
||||
"../../../api:webrtc_key_value_config",
|
||||
"../../../modules/audio_coding:webrtc_multiopus",
|
||||
"../../../rtc_base:rtc_base_approved",
|
||||
"../../../rtc_base/system:rtc_export",
|
||||
|
@ -100,6 +103,7 @@ rtc_library("audio_decoder_multiopus") {
|
|||
deps = [
|
||||
":audio_decoder_opus_config",
|
||||
"..:audio_codecs_api",
|
||||
"../../../api:webrtc_key_value_config",
|
||||
"../../../modules/audio_coding:webrtc_multiopus",
|
||||
"../../../rtc_base:rtc_base_approved",
|
||||
"../../../rtc_base/system:rtc_export",
|
||||
|
|
|
@ -64,7 +64,8 @@ void AudioDecoderMultiChannelOpus::AppendSupportedDecoders(
|
|||
|
||||
std::unique_ptr<AudioDecoder> AudioDecoderMultiChannelOpus::MakeAudioDecoder(
|
||||
AudioDecoderMultiChannelOpusConfig config,
|
||||
absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
|
||||
absl::optional<AudioCodecPairId> /*codec_pair_id*/,
|
||||
const WebRtcKeyValueConfig* field_trials) {
|
||||
return AudioDecoderMultiChannelOpusImpl::MakeAudioDecoder(config);
|
||||
}
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "api/audio_codecs/audio_decoder.h"
|
||||
#include "api/audio_codecs/audio_format.h"
|
||||
#include "api/audio_codecs/opus/audio_decoder_multi_channel_opus_config.h"
|
||||
#include "api/webrtc_key_value_config.h"
|
||||
#include "rtc_base/system/rtc_export.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
@ -32,7 +33,8 @@ struct RTC_EXPORT AudioDecoderMultiChannelOpus {
|
|||
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
|
||||
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
||||
AudioDecoderMultiChannelOpusConfig config,
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt);
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
|
||||
const WebRtcKeyValueConfig* field_trials = nullptr);
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -30,7 +30,8 @@ struct AudioDecoderMultiChannelOpusConfig {
|
|||
std::vector<unsigned char> channel_mapping;
|
||||
|
||||
bool IsOk() const {
|
||||
if (num_channels < 0 || num_streams < 0 || coupled_streams < 0) {
|
||||
if (num_channels < 1 || num_channels > AudioDecoder::kMaxNumberOfChannels ||
|
||||
num_streams < 0 || coupled_streams < 0) {
|
||||
return false;
|
||||
}
|
||||
if (num_streams < coupled_streams) {
|
||||
|
|
|
@ -51,7 +51,10 @@ absl::optional<AudioDecoderOpus::Config> AudioDecoderOpus::SdpToConfig(
|
|||
num_channels) {
|
||||
Config config;
|
||||
config.num_channels = *num_channels;
|
||||
RTC_DCHECK(config.IsOk());
|
||||
if (!config.IsOk()) {
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return absl::nullopt;
|
||||
}
|
||||
return config;
|
||||
} else {
|
||||
return absl::nullopt;
|
||||
|
@ -70,8 +73,12 @@ void AudioDecoderOpus::AppendSupportedDecoders(
|
|||
|
||||
std::unique_ptr<AudioDecoder> AudioDecoderOpus::MakeAudioDecoder(
|
||||
Config config,
|
||||
absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
|
||||
RTC_DCHECK(config.IsOk());
|
||||
absl::optional<AudioCodecPairId> /*codec_pair_id*/,
|
||||
const WebRtcKeyValueConfig* field_trials) {
|
||||
if (!config.IsOk()) {
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
return std::make_unique<AudioDecoderOpusImpl>(config.num_channels,
|
||||
config.sample_rate_hz);
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "api/audio_codecs/audio_codec_pair_id.h"
|
||||
#include "api/audio_codecs/audio_decoder.h"
|
||||
#include "api/audio_codecs/audio_format.h"
|
||||
#include "api/webrtc_key_value_config.h"
|
||||
#include "rtc_base/system/rtc_export.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
@ -34,7 +35,8 @@ struct RTC_EXPORT AudioDecoderOpus {
|
|||
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
|
||||
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
||||
Config config,
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt);
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
|
||||
const WebRtcKeyValueConfig* field_trials = nullptr);
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -66,7 +66,8 @@ AudioCodecInfo AudioEncoderMultiChannelOpus::QueryAudioEncoder(
|
|||
std::unique_ptr<AudioEncoder> AudioEncoderMultiChannelOpus::MakeAudioEncoder(
|
||||
const AudioEncoderMultiChannelOpusConfig& config,
|
||||
int payload_type,
|
||||
absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
|
||||
absl::optional<AudioCodecPairId> /*codec_pair_id*/,
|
||||
const WebRtcKeyValueConfig* field_trials) {
|
||||
return AudioEncoderMultiChannelOpusImpl::MakeAudioEncoder(config,
|
||||
payload_type);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "api/audio_codecs/audio_encoder.h"
|
||||
#include "api/audio_codecs/audio_format.h"
|
||||
#include "api/audio_codecs/opus/audio_encoder_multi_channel_opus_config.h"
|
||||
#include "api/webrtc_key_value_config.h"
|
||||
#include "rtc_base/system/rtc_export.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
@ -33,7 +34,8 @@ struct RTC_EXPORT AudioEncoderMultiChannelOpus {
|
|||
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
||||
const Config& config,
|
||||
int payload_type,
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt);
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
|
||||
const WebRtcKeyValueConfig* field_trials = nullptr);
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -32,7 +32,12 @@ AudioCodecInfo AudioEncoderOpus::QueryAudioEncoder(
|
|||
std::unique_ptr<AudioEncoder> AudioEncoderOpus::MakeAudioEncoder(
|
||||
const AudioEncoderOpusConfig& config,
|
||||
int payload_type,
|
||||
absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
|
||||
absl::optional<AudioCodecPairId> /*codec_pair_id*/,
|
||||
const WebRtcKeyValueConfig* field_trials) {
|
||||
if (!config.IsOk()) {
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
return AudioEncoderOpusImpl::MakeAudioEncoder(config, payload_type);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "api/audio_codecs/audio_encoder.h"
|
||||
#include "api/audio_codecs/audio_format.h"
|
||||
#include "api/audio_codecs/opus/audio_encoder_opus_config.h"
|
||||
#include "api/webrtc_key_value_config.h"
|
||||
#include "rtc_base/system/rtc_export.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
@ -34,7 +35,8 @@ struct RTC_EXPORT AudioEncoderOpus {
|
|||
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
||||
const AudioEncoderOpusConfig& config,
|
||||
int payload_type,
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt);
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
|
||||
const WebRtcKeyValueConfig* field_trials = nullptr);
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -37,8 +37,10 @@ struct NotAdvertised {
|
|||
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
||||
const Config& config,
|
||||
int payload_type,
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt) {
|
||||
return T::MakeAudioEncoder(config, payload_type, codec_pair_id);
|
||||
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
|
||||
const WebRtcKeyValueConfig* field_trials = nullptr) {
|
||||
return T::MakeAudioEncoder(config, payload_type, codec_pair_id,
|
||||
field_trials);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ if (rtc_include_tests) {
|
|||
"..:audio_codecs_api",
|
||||
"../../../rtc_base:rtc_base_approved",
|
||||
"../../../test:audio_codec_mocks",
|
||||
"../../../test:scoped_key_value_config",
|
||||
"../../../test:test_support",
|
||||
"../L16:audio_decoder_L16",
|
||||
"../L16:audio_encoder_L16",
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "test/gmock.h"
|
||||
#include "test/gtest.h"
|
||||
#include "test/mock_audio_decoder.h"
|
||||
#include "test/scoped_key_value_config.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
|
@ -77,9 +78,11 @@ struct AudioDecoderFakeApi {
|
|||
} // namespace
|
||||
|
||||
TEST(AudioDecoderFactoryTemplateTest, NoDecoderTypes) {
|
||||
test::ScopedKeyValueConfig field_trials;
|
||||
rtc::scoped_refptr<AudioDecoderFactory> factory(
|
||||
rtc::make_ref_counted<
|
||||
audio_decoder_factory_template_impl::AudioDecoderFactoryT<>>());
|
||||
audio_decoder_factory_template_impl::AudioDecoderFactoryT<>>(
|
||||
&field_trials));
|
||||
EXPECT_THAT(factory->GetSupportedDecoders(), ::testing::IsEmpty());
|
||||
EXPECT_FALSE(factory->IsSupportedDecoder({"foo", 8000, 1}));
|
||||
EXPECT_EQ(nullptr,
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "test/gmock.h"
|
||||
#include "test/gtest.h"
|
||||
#include "test/mock_audio_encoder.h"
|
||||
#include "test/scoped_key_value_config.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
|
@ -77,9 +78,11 @@ struct AudioEncoderFakeApi {
|
|||
} // namespace
|
||||
|
||||
TEST(AudioEncoderFactoryTemplateTest, NoEncoderTypes) {
|
||||
test::ScopedKeyValueConfig field_trials;
|
||||
rtc::scoped_refptr<AudioEncoderFactory> factory(
|
||||
rtc::make_ref_counted<
|
||||
audio_encoder_factory_template_impl::AudioEncoderFactoryT<>>());
|
||||
audio_encoder_factory_template_impl::AudioEncoderFactoryT<>>(
|
||||
&field_trials));
|
||||
EXPECT_THAT(factory->GetSupportedEncoders(), ::testing::IsEmpty());
|
||||
EXPECT_EQ(absl::nullopt, factory->QueryAudioEncoder({"foo", 8000, 1}));
|
||||
EXPECT_EQ(nullptr,
|
||||
|
|
|
@ -55,16 +55,11 @@ void AudioOptions::SetAll(const AudioOptions& change) {
|
|||
SetFrom(&audio_jitter_buffer_enable_rtx_handling,
|
||||
change.audio_jitter_buffer_enable_rtx_handling);
|
||||
SetFrom(&typing_detection, change.typing_detection);
|
||||
SetFrom(&experimental_agc, change.experimental_agc);
|
||||
SetFrom(&experimental_ns, change.experimental_ns);
|
||||
SetFrom(&residual_echo_detector, change.residual_echo_detector);
|
||||
SetFrom(&tx_agc_target_dbov, change.tx_agc_target_dbov);
|
||||
SetFrom(&tx_agc_digital_compression_gain,
|
||||
change.tx_agc_digital_compression_gain);
|
||||
SetFrom(&tx_agc_limiter, change.tx_agc_limiter);
|
||||
SetFrom(&combined_audio_video_bwe, change.combined_audio_video_bwe);
|
||||
SetFrom(&audio_network_adaptor, change.audio_network_adaptor);
|
||||
SetFrom(&audio_network_adaptor_config, change.audio_network_adaptor_config);
|
||||
SetFrom(&init_recording_on_send, change.init_recording_on_send);
|
||||
}
|
||||
|
||||
bool AudioOptions::operator==(const AudioOptions& o) const {
|
||||
|
@ -84,15 +79,11 @@ bool AudioOptions::operator==(const AudioOptions& o) const {
|
|||
audio_jitter_buffer_enable_rtx_handling ==
|
||||
o.audio_jitter_buffer_enable_rtx_handling &&
|
||||
typing_detection == o.typing_detection &&
|
||||
experimental_agc == o.experimental_agc &&
|
||||
experimental_ns == o.experimental_ns &&
|
||||
residual_echo_detector == o.residual_echo_detector &&
|
||||
tx_agc_target_dbov == o.tx_agc_target_dbov &&
|
||||
tx_agc_digital_compression_gain == o.tx_agc_digital_compression_gain &&
|
||||
tx_agc_limiter == o.tx_agc_limiter &&
|
||||
combined_audio_video_bwe == o.combined_audio_video_bwe &&
|
||||
audio_network_adaptor == o.audio_network_adaptor &&
|
||||
audio_network_adaptor_config == o.audio_network_adaptor_config;
|
||||
audio_network_adaptor_config == o.audio_network_adaptor_config &&
|
||||
init_recording_on_send == o.init_recording_on_send;
|
||||
}
|
||||
|
||||
std::string AudioOptions::ToString() const {
|
||||
|
@ -117,15 +108,10 @@ std::string AudioOptions::ToString() const {
|
|||
ToStringIfSet(&result, "audio_jitter_buffer_enable_rtx_handling",
|
||||
audio_jitter_buffer_enable_rtx_handling);
|
||||
ToStringIfSet(&result, "typing", typing_detection);
|
||||
ToStringIfSet(&result, "experimental_agc", experimental_agc);
|
||||
ToStringIfSet(&result, "experimental_ns", experimental_ns);
|
||||
ToStringIfSet(&result, "residual_echo_detector", residual_echo_detector);
|
||||
ToStringIfSet(&result, "tx_agc_target_dbov", tx_agc_target_dbov);
|
||||
ToStringIfSet(&result, "tx_agc_digital_compression_gain",
|
||||
tx_agc_digital_compression_gain);
|
||||
ToStringIfSet(&result, "tx_agc_limiter", tx_agc_limiter);
|
||||
ToStringIfSet(&result, "combined_audio_video_bwe", combined_audio_video_bwe);
|
||||
ToStringIfSet(&result, "audio_network_adaptor", audio_network_adaptor);
|
||||
ToStringIfSet(&result, "init_recording_on_send", init_recording_on_send);
|
||||
result << "}";
|
||||
return result.str();
|
||||
}
|
||||
|
|
|
@ -60,15 +60,14 @@ struct RTC_EXPORT AudioOptions {
|
|||
absl::optional<int> audio_jitter_buffer_min_delay_ms;
|
||||
// Audio receiver jitter buffer (NetEq) should handle retransmitted packets.
|
||||
absl::optional<bool> audio_jitter_buffer_enable_rtx_handling;
|
||||
// Deprecated.
|
||||
// TODO(bugs.webrtc.org/11226): Remove.
|
||||
// Audio processing to detect typing.
|
||||
absl::optional<bool> typing_detection;
|
||||
absl::optional<bool> experimental_agc;
|
||||
absl::optional<bool> experimental_ns;
|
||||
// Note that tx_agc_* only applies to non-experimental AGC.
|
||||
// TODO(bugs.webrtc.org/11539): Deprecated, replaced by
|
||||
// webrtc::CreateEchoDetector() and injection when creating the audio
|
||||
// processing module.
|
||||
absl::optional<bool> residual_echo_detector;
|
||||
absl::optional<uint16_t> tx_agc_target_dbov;
|
||||
absl::optional<uint16_t> tx_agc_digital_compression_gain;
|
||||
absl::optional<bool> tx_agc_limiter;
|
||||
// Enable combined audio+bandwidth BWE.
|
||||
// TODO(pthatcher): This flag is set from the
|
||||
// "googCombinedAudioVideoBwe", but not used anywhere. So delete it,
|
||||
|
@ -80,6 +79,10 @@ struct RTC_EXPORT AudioOptions {
|
|||
absl::optional<bool> audio_network_adaptor;
|
||||
// Config string for audio network adaptor.
|
||||
absl::optional<std::string> audio_network_adaptor_config;
|
||||
// Pre-initialize the ADM for recording when starting to send. Default to
|
||||
// true.
|
||||
// TODO(webrtc:13566): Remove this option. See issue for details.
|
||||
absl::optional<bool> init_recording_on_send;
|
||||
};
|
||||
|
||||
} // namespace cricket
|
||||
|
|
|
@ -27,14 +27,14 @@ Candidate::Candidate()
|
|||
network_cost_(0) {}
|
||||
|
||||
Candidate::Candidate(int component,
|
||||
const std::string& protocol,
|
||||
absl::string_view protocol,
|
||||
const rtc::SocketAddress& address,
|
||||
uint32_t priority,
|
||||
const std::string& username,
|
||||
const std::string& password,
|
||||
const std::string& type,
|
||||
absl::string_view username,
|
||||
absl::string_view password,
|
||||
absl::string_view type,
|
||||
uint32_t generation,
|
||||
const std::string& foundation,
|
||||
absl::string_view foundation,
|
||||
uint16_t network_id,
|
||||
uint16_t network_cost)
|
||||
: id_(rtc::CreateRandomString(8)),
|
||||
|
@ -101,7 +101,9 @@ uint32_t Candidate::GetPriority(uint32_t type_preference,
|
|||
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
// NIC Type - Type of the network adapter e.g. 3G/Wifi/Wired.
|
||||
// Addr Pref - Address preference value as per RFC 3484.
|
||||
// local preference = (NIC Type << 8 | Addr_Pref) - relay preference.
|
||||
// local preference = (NIC Type << 8 | Addr_Pref) + relay preference.
|
||||
// The relay preference is based on the number of TURN servers, the
|
||||
// first TURN server gets the highest preference.
|
||||
|
||||
int addr_pref = IPAddressPrecedence(address_.ipaddr());
|
||||
int local_preference =
|
||||
|
@ -153,4 +155,11 @@ Candidate Candidate::ToSanitizedCopy(bool use_hostname_address,
|
|||
return copy;
|
||||
}
|
||||
|
||||
void Candidate::Assign(std::string& s, absl::string_view view) {
|
||||
// Assigning via a temporary object, like s = std::string(view), results in
|
||||
// binary size bloat. To avoid that, extract pointer and size from the
|
||||
// string view, and use std::string::assign method.
|
||||
s.assign(view.data(), view.size());
|
||||
}
|
||||
|
||||
} // namespace cricket
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include <algorithm>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/network_constants.h"
|
||||
#include "rtc_base/socket_address.h"
|
||||
|
@ -33,32 +34,32 @@ class RTC_EXPORT Candidate {
|
|||
// TODO(pthatcher): Match the ordering and param list as per RFC 5245
|
||||
// candidate-attribute syntax. http://tools.ietf.org/html/rfc5245#section-15.1
|
||||
Candidate(int component,
|
||||
const std::string& protocol,
|
||||
absl::string_view protocol,
|
||||
const rtc::SocketAddress& address,
|
||||
uint32_t priority,
|
||||
const std::string& username,
|
||||
const std::string& password,
|
||||
const std::string& type,
|
||||
absl::string_view username,
|
||||
absl::string_view password,
|
||||
absl::string_view type,
|
||||
uint32_t generation,
|
||||
const std::string& foundation,
|
||||
absl::string_view foundation,
|
||||
uint16_t network_id = 0,
|
||||
uint16_t network_cost = 0);
|
||||
Candidate(const Candidate&);
|
||||
~Candidate();
|
||||
|
||||
const std::string& id() const { return id_; }
|
||||
void set_id(const std::string& id) { id_ = id; }
|
||||
void set_id(absl::string_view id) { Assign(id_, id); }
|
||||
|
||||
int component() const { return component_; }
|
||||
void set_component(int component) { component_ = component; }
|
||||
|
||||
const std::string& protocol() const { return protocol_; }
|
||||
void set_protocol(const std::string& protocol) { protocol_ = protocol; }
|
||||
void set_protocol(absl::string_view protocol) { Assign(protocol_, protocol); }
|
||||
|
||||
// The protocol used to talk to relay.
|
||||
const std::string& relay_protocol() const { return relay_protocol_; }
|
||||
void set_relay_protocol(const std::string& protocol) {
|
||||
relay_protocol_ = protocol;
|
||||
void set_relay_protocol(absl::string_view protocol) {
|
||||
Assign(relay_protocol_, protocol);
|
||||
}
|
||||
|
||||
const rtc::SocketAddress& address() const { return address_; }
|
||||
|
@ -90,17 +91,17 @@ class RTC_EXPORT Candidate {
|
|||
|
||||
// TODO(honghaiz): Change to usernameFragment or ufrag.
|
||||
const std::string& username() const { return username_; }
|
||||
void set_username(const std::string& username) { username_ = username; }
|
||||
void set_username(absl::string_view username) { Assign(username_, username); }
|
||||
|
||||
const std::string& password() const { return password_; }
|
||||
void set_password(const std::string& password) { password_ = password; }
|
||||
void set_password(absl::string_view password) { Assign(password_, password); }
|
||||
|
||||
const std::string& type() const { return type_; }
|
||||
void set_type(const std::string& type) { type_ = type; }
|
||||
void set_type(absl::string_view type) { Assign(type_, type); }
|
||||
|
||||
const std::string& network_name() const { return network_name_; }
|
||||
void set_network_name(const std::string& network_name) {
|
||||
network_name_ = network_name;
|
||||
void set_network_name(absl::string_view network_name) {
|
||||
Assign(network_name_, network_name);
|
||||
}
|
||||
|
||||
rtc::AdapterType network_type() const { return network_type_; }
|
||||
|
@ -108,6 +109,13 @@ class RTC_EXPORT Candidate {
|
|||
network_type_ = network_type;
|
||||
}
|
||||
|
||||
rtc::AdapterType underlying_type_for_vpn() const {
|
||||
return underlying_type_for_vpn_;
|
||||
}
|
||||
void set_underlying_type_for_vpn(rtc::AdapterType network_type) {
|
||||
underlying_type_for_vpn_ = network_type;
|
||||
}
|
||||
|
||||
// Candidates in a new generation replace those in the old generation.
|
||||
uint32_t generation() const { return generation_; }
|
||||
void set_generation(uint32_t generation) { generation_ = generation; }
|
||||
|
@ -126,8 +134,8 @@ class RTC_EXPORT Candidate {
|
|||
void set_network_id(uint16_t network_id) { network_id_ = network_id; }
|
||||
|
||||
const std::string& foundation() const { return foundation_; }
|
||||
void set_foundation(const std::string& foundation) {
|
||||
foundation_ = foundation;
|
||||
void set_foundation(absl::string_view foundation) {
|
||||
Assign(foundation_, foundation);
|
||||
}
|
||||
|
||||
const rtc::SocketAddress& related_address() const { return related_address_; }
|
||||
|
@ -135,18 +143,18 @@ class RTC_EXPORT Candidate {
|
|||
related_address_ = related_address;
|
||||
}
|
||||
const std::string& tcptype() const { return tcptype_; }
|
||||
void set_tcptype(const std::string& tcptype) { tcptype_ = tcptype; }
|
||||
void set_tcptype(absl::string_view tcptype) { Assign(tcptype_, tcptype); }
|
||||
|
||||
// The name of the transport channel of this candidate.
|
||||
// TODO(phoglund): remove.
|
||||
const std::string& transport_name() const { return transport_name_; }
|
||||
void set_transport_name(const std::string& transport_name) {
|
||||
transport_name_ = transport_name;
|
||||
void set_transport_name(absl::string_view transport_name) {
|
||||
Assign(transport_name_, transport_name);
|
||||
}
|
||||
|
||||
// The URL of the ICE server which this candidate is gathered from.
|
||||
const std::string& url() const { return url_; }
|
||||
void set_url(const std::string& url) { url_ = url; }
|
||||
void set_url(absl::string_view url) { Assign(url_, url); }
|
||||
|
||||
// Determines whether this candidate is equivalent to the given one.
|
||||
bool IsEquivalent(const Candidate& c) const;
|
||||
|
@ -177,6 +185,10 @@ class RTC_EXPORT Candidate {
|
|||
bool filter_related_address) const;
|
||||
|
||||
private:
|
||||
// TODO(bugs.webrtc.org/13220): With C++17, we get a std::string assignment
|
||||
// operator accepting any object implicitly convertible to std::string_view,
|
||||
// and then we don't need this workaround.
|
||||
static void Assign(std::string& s, absl::string_view view);
|
||||
std::string ToStringInternal(bool sensitive) const;
|
||||
|
||||
std::string id_;
|
||||
|
@ -190,6 +202,7 @@ class RTC_EXPORT Candidate {
|
|||
std::string type_;
|
||||
std::string network_name_;
|
||||
rtc::AdapterType network_type_;
|
||||
rtc::AdapterType underlying_type_for_vpn_;
|
||||
uint32_t generation_;
|
||||
std::string foundation_;
|
||||
rtc::SocketAddress related_address_;
|
||||
|
|
|
@ -49,6 +49,10 @@ rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
|
|||
dependencies.task_queue_factory.get());
|
||||
dependencies.trials = std::make_unique<webrtc::FieldTrialBasedConfig>();
|
||||
|
||||
if (network_thread) {
|
||||
// TODO(bugs.webrtc.org/13145): Add an rtc::SocketFactory* argument.
|
||||
dependencies.socket_factory = network_thread->socketserver();
|
||||
}
|
||||
cricket::MediaEngineDependencies media_dependencies;
|
||||
media_dependencies.task_queue_factory = dependencies.task_queue_factory.get();
|
||||
media_dependencies.adm = std::move(default_adm);
|
||||
|
|
|
@ -40,4 +40,8 @@ bool DataChannelInterface::negotiated() const {
|
|||
return false;
|
||||
}
|
||||
|
||||
uint64_t DataChannelInterface::MaxSendQueueSize() {
|
||||
return 16 * 1024 * 1024; // 16 MiB
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -174,6 +174,7 @@ class RTC_EXPORT DataChannelInterface : public rtc::RefCountInterface {
|
|||
// Returns the number of bytes of application data (UTF-8 text and binary
|
||||
// data) that have been queued using Send but have not yet been processed at
|
||||
// the SCTP level. See comment above Send below.
|
||||
// Values are less or equal to MaxSendQueueSize().
|
||||
virtual uint64_t buffered_amount() const = 0;
|
||||
|
||||
// Begins the graceful data channel closing procedure. See:
|
||||
|
@ -182,14 +183,16 @@ class RTC_EXPORT DataChannelInterface : public rtc::RefCountInterface {
|
|||
|
||||
// Sends `data` to the remote peer. If the data can't be sent at the SCTP
|
||||
// level (due to congestion control), it's buffered at the data channel level,
|
||||
// up to a maximum of 16MB. If Send is called while this buffer is full, the
|
||||
// data channel will be closed abruptly.
|
||||
//
|
||||
// So, it's important to use buffered_amount() and OnBufferedAmountChange to
|
||||
// ensure the data channel is used efficiently but without filling this
|
||||
// buffer.
|
||||
// up to a maximum of MaxSendQueueSize().
|
||||
// Returns false if the data channel is not in open state or if the send
|
||||
// buffer is full.
|
||||
// TODO(webrtc:13289): Return an RTCError with information about the failure.
|
||||
virtual bool Send(const DataBuffer& buffer) = 0;
|
||||
|
||||
// Amount of bytes that can be queued for sending on the data channel.
|
||||
// Those are bytes that have not yet been processed at the SCTP level.
|
||||
static uint64_t MaxSendQueueSize();
|
||||
|
||||
protected:
|
||||
~DataChannelInterface() override = default;
|
||||
};
|
||||
|
|
|
@ -20,11 +20,27 @@ DtlsTransportInformation::DtlsTransportInformation(DtlsTransportState state)
|
|||
|
||||
DtlsTransportInformation::DtlsTransportInformation(
|
||||
DtlsTransportState state,
|
||||
absl::optional<DtlsTransportTlsRole> role,
|
||||
absl::optional<int> tls_version,
|
||||
absl::optional<int> ssl_cipher_suite,
|
||||
absl::optional<int> srtp_cipher_suite,
|
||||
std::unique_ptr<rtc::SSLCertChain> remote_ssl_certificates)
|
||||
: state_(state),
|
||||
role_(role),
|
||||
tls_version_(tls_version),
|
||||
ssl_cipher_suite_(ssl_cipher_suite),
|
||||
srtp_cipher_suite_(srtp_cipher_suite),
|
||||
remote_ssl_certificates_(std::move(remote_ssl_certificates)) {}
|
||||
|
||||
// Deprecated version
|
||||
DtlsTransportInformation::DtlsTransportInformation(
|
||||
DtlsTransportState state,
|
||||
absl::optional<int> tls_version,
|
||||
absl::optional<int> ssl_cipher_suite,
|
||||
absl::optional<int> srtp_cipher_suite,
|
||||
std::unique_ptr<rtc::SSLCertChain> remote_ssl_certificates)
|
||||
: state_(state),
|
||||
role_(absl::nullopt),
|
||||
tls_version_(tls_version),
|
||||
ssl_cipher_suite_(ssl_cipher_suite),
|
||||
srtp_cipher_suite_(srtp_cipher_suite),
|
||||
|
@ -33,6 +49,7 @@ DtlsTransportInformation::DtlsTransportInformation(
|
|||
DtlsTransportInformation::DtlsTransportInformation(
|
||||
const DtlsTransportInformation& c)
|
||||
: state_(c.state()),
|
||||
role_(c.role_),
|
||||
tls_version_(c.tls_version_),
|
||||
ssl_cipher_suite_(c.ssl_cipher_suite_),
|
||||
srtp_cipher_suite_(c.srtp_cipher_suite_),
|
||||
|
@ -43,6 +60,7 @@ DtlsTransportInformation::DtlsTransportInformation(
|
|||
DtlsTransportInformation& DtlsTransportInformation::operator=(
|
||||
const DtlsTransportInformation& c) {
|
||||
state_ = c.state();
|
||||
role_ = c.role_;
|
||||
tls_version_ = c.tls_version_;
|
||||
ssl_cipher_suite_ = c.ssl_cipher_suite_;
|
||||
srtp_cipher_suite_ = c.srtp_cipher_suite_;
|
||||
|
|
|
@ -36,6 +36,11 @@ enum class DtlsTransportState {
|
|||
kNumValues
|
||||
};
|
||||
|
||||
enum class DtlsTransportTlsRole {
|
||||
kServer, // Other end sends CLIENT_HELLO
|
||||
kClient // This end sends CLIENT_HELLO
|
||||
};
|
||||
|
||||
// This object gives snapshot information about the changeable state of a
|
||||
// DTLSTransport.
|
||||
class RTC_EXPORT DtlsTransportInformation {
|
||||
|
@ -44,10 +49,19 @@ class RTC_EXPORT DtlsTransportInformation {
|
|||
explicit DtlsTransportInformation(DtlsTransportState state);
|
||||
DtlsTransportInformation(
|
||||
DtlsTransportState state,
|
||||
absl::optional<DtlsTransportTlsRole> role,
|
||||
absl::optional<int> tls_version,
|
||||
absl::optional<int> ssl_cipher_suite,
|
||||
absl::optional<int> srtp_cipher_suite,
|
||||
std::unique_ptr<rtc::SSLCertChain> remote_ssl_certificates);
|
||||
ABSL_DEPRECATED("Use version with role parameter")
|
||||
DtlsTransportInformation(
|
||||
DtlsTransportState state,
|
||||
absl::optional<int> tls_version,
|
||||
absl::optional<int> ssl_cipher_suite,
|
||||
absl::optional<int> srtp_cipher_suite,
|
||||
std::unique_ptr<rtc::SSLCertChain> remote_ssl_certificates);
|
||||
|
||||
// Copy and assign
|
||||
DtlsTransportInformation(const DtlsTransportInformation& c);
|
||||
DtlsTransportInformation& operator=(const DtlsTransportInformation& c);
|
||||
|
@ -57,6 +71,7 @@ class RTC_EXPORT DtlsTransportInformation {
|
|||
default;
|
||||
|
||||
DtlsTransportState state() const { return state_; }
|
||||
absl::optional<DtlsTransportTlsRole> role() const { return role_; }
|
||||
absl::optional<int> tls_version() const { return tls_version_; }
|
||||
absl::optional<int> ssl_cipher_suite() const { return ssl_cipher_suite_; }
|
||||
absl::optional<int> srtp_cipher_suite() const { return srtp_cipher_suite_; }
|
||||
|
@ -67,6 +82,7 @@ class RTC_EXPORT DtlsTransportInformation {
|
|||
|
||||
private:
|
||||
DtlsTransportState state_;
|
||||
absl::optional<DtlsTransportTlsRole> role_;
|
||||
absl::optional<int> tls_version_;
|
||||
absl::optional<int> ssl_cipher_suite_;
|
||||
absl::optional<int> srtp_cipher_suite_;
|
||||
|
|
|
@ -58,18 +58,9 @@ rtc::scoped_refptr<IceTransportInterface> CreateIceTransport(
|
|||
|
||||
rtc::scoped_refptr<IceTransportInterface> CreateIceTransport(
|
||||
IceTransportInit init) {
|
||||
if (init.async_resolver_factory()) {
|
||||
// Backwards compatibility mode
|
||||
return rtc::make_ref_counted<IceTransportWithTransportChannel>(
|
||||
std::make_unique<cricket::P2PTransportChannel>(
|
||||
"", cricket::ICE_CANDIDATE_COMPONENT_RTP, init.port_allocator(),
|
||||
init.async_resolver_factory(), init.event_log()));
|
||||
} else {
|
||||
return rtc::make_ref_counted<IceTransportWithTransportChannel>(
|
||||
cricket::P2PTransportChannel::Create(
|
||||
"", cricket::ICE_CANDIDATE_COMPONENT_RTP, init.port_allocator(),
|
||||
init.async_dns_resolver_factory(), init.event_log()));
|
||||
}
|
||||
return rtc::make_ref_counted<IceTransportWithTransportChannel>(
|
||||
cricket::P2PTransportChannel::Create(
|
||||
"", cricket::ICE_CANDIDATE_COMPONENT_RTP, std::move(init)));
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -23,9 +23,11 @@
|
|||
namespace cricket {
|
||||
class IceTransportInternal;
|
||||
class PortAllocator;
|
||||
class IceControllerFactoryInterface;
|
||||
} // namespace cricket
|
||||
|
||||
namespace webrtc {
|
||||
class WebRtcKeyValueConfig;
|
||||
|
||||
// An ICE transport, as represented to the outside world.
|
||||
// This object is refcounted, and is therefore alive until the
|
||||
|
@ -74,12 +76,27 @@ struct IceTransportInit final {
|
|||
RtcEventLog* event_log() { return event_log_; }
|
||||
void set_event_log(RtcEventLog* event_log) { event_log_ = event_log; }
|
||||
|
||||
void set_ice_controller_factory(
|
||||
cricket::IceControllerFactoryInterface* ice_controller_factory) {
|
||||
ice_controller_factory_ = ice_controller_factory;
|
||||
}
|
||||
cricket::IceControllerFactoryInterface* ice_controller_factory() {
|
||||
return ice_controller_factory_;
|
||||
}
|
||||
|
||||
const WebRtcKeyValueConfig* field_trials() { return field_trials_; }
|
||||
void set_field_trials(const WebRtcKeyValueConfig* field_trials) {
|
||||
field_trials_ = field_trials;
|
||||
}
|
||||
|
||||
private:
|
||||
cricket::PortAllocator* port_allocator_ = nullptr;
|
||||
AsyncDnsResolverFactoryInterface* async_dns_resolver_factory_ = nullptr;
|
||||
// For backwards compatibility. Only one resolver factory can be set.
|
||||
AsyncResolverFactory* async_resolver_factory_ = nullptr;
|
||||
RtcEventLog* event_log_ = nullptr;
|
||||
cricket::IceControllerFactoryInterface* ice_controller_factory_ = nullptr;
|
||||
const WebRtcKeyValueConfig* field_trials_ = nullptr;
|
||||
// TODO(https://crbug.com/webrtc/12657): Redesign to have const members.
|
||||
};
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
#include "api/candidate.h"
|
||||
#include "api/jsep.h"
|
||||
#include "rtc_base/constructor_magic.h"
|
||||
#include "rtc_base/system/rtc_export.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
@ -64,6 +63,10 @@ class JsepCandidateCollection : public IceCandidateCollection {
|
|||
// Move constructor is defined so that a vector of JsepCandidateCollections
|
||||
// can be resized.
|
||||
JsepCandidateCollection(JsepCandidateCollection&& o);
|
||||
|
||||
JsepCandidateCollection(const JsepCandidateCollection&) = delete;
|
||||
JsepCandidateCollection& operator=(const JsepCandidateCollection&) = delete;
|
||||
|
||||
// Returns a copy of the candidate collection.
|
||||
JsepCandidateCollection Clone() const;
|
||||
size_t count() const override;
|
||||
|
@ -80,8 +83,6 @@ class JsepCandidateCollection : public IceCandidateCollection {
|
|||
|
||||
private:
|
||||
std::vector<std::unique_ptr<JsepIceCandidate>> candidates_;
|
||||
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(JsepCandidateCollection);
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "api/candidate.h"
|
||||
#include "api/jsep.h"
|
||||
#include "api/jsep_ice_candidate.h"
|
||||
#include "rtc_base/constructor_magic.h"
|
||||
|
||||
namespace cricket {
|
||||
class SessionDescription;
|
||||
|
@ -43,6 +42,9 @@ class JsepSessionDescription : public SessionDescriptionInterface {
|
|||
absl::string_view session_version);
|
||||
virtual ~JsepSessionDescription();
|
||||
|
||||
JsepSessionDescription(const JsepSessionDescription&) = delete;
|
||||
JsepSessionDescription& operator=(const JsepSessionDescription&) = delete;
|
||||
|
||||
// Takes ownership of `description`.
|
||||
bool Initialize(std::unique_ptr<cricket::SessionDescription> description,
|
||||
const std::string& session_id,
|
||||
|
@ -82,8 +84,6 @@ class JsepSessionDescription : public SessionDescriptionInterface {
|
|||
bool GetMediasectionIndex(const IceCandidateInterface* candidate,
|
||||
size_t* index);
|
||||
int GetMediasectionIndex(const cricket::Candidate& candidate);
|
||||
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(JsepSessionDescription);
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "api/video/video_frame.h"
|
||||
#include "api/video/video_sink_interface.h"
|
||||
#include "api/video/video_source_interface.h"
|
||||
#include "api/video_track_source_constraints.h"
|
||||
#include "modules/audio_processing/include/audio_processing_statistics.h"
|
||||
#include "rtc_base/ref_count.h"
|
||||
#include "rtc_base/system/rtc_export.h"
|
||||
|
@ -146,8 +147,6 @@ class VideoTrackSourceInterface : public MediaSourceInterface,
|
|||
// Add an encoded video sink to the source and additionally cause
|
||||
// a key frame to be generated from the source. The sink will be
|
||||
// invoked from a decoder queue.
|
||||
// TODO(bugs.webrtc.org/11114): make pure virtual once downstream project
|
||||
// adapts.
|
||||
virtual void AddEncodedSink(
|
||||
rtc::VideoSinkInterface<RecordableEncodedFrame>* sink) = 0;
|
||||
|
||||
|
@ -155,6 +154,13 @@ class VideoTrackSourceInterface : public MediaSourceInterface,
|
|||
virtual void RemoveEncodedSink(
|
||||
rtc::VideoSinkInterface<RecordableEncodedFrame>* sink) = 0;
|
||||
|
||||
// Notify about constraints set on the source. The information eventually gets
|
||||
// routed to attached sinks via VideoSinkInterface<>::OnConstraintsChanged.
|
||||
// The call is expected to happen on the network thread.
|
||||
// TODO(crbug/1255737): make pure virtual once downstream project adapts.
|
||||
virtual void ProcessConstraints(
|
||||
const webrtc::VideoTrackSourceConstraints& constraints) {}
|
||||
|
||||
protected:
|
||||
~VideoTrackSourceInterface() override = default;
|
||||
};
|
||||
|
@ -197,7 +203,7 @@ class AudioTrackSinkInterface {
|
|||
int sample_rate,
|
||||
size_t number_of_channels,
|
||||
size_t number_of_frames) {
|
||||
RTC_NOTREACHED() << "This method must be overridden, or not used.";
|
||||
RTC_DCHECK_NOTREACHED() << "This method must be overridden, or not used.";
|
||||
}
|
||||
|
||||
// In this method, `absolute_capture_timestamp_ms`, when available, is
|
||||
|
@ -327,6 +333,8 @@ class MediaStreamInterface : public rtc::RefCountInterface,
|
|||
virtual rtc::scoped_refptr<VideoTrackInterface> FindVideoTrack(
|
||||
const std::string& track_id) = 0;
|
||||
|
||||
// Takes ownership of added tracks.
|
||||
// TODO(hta): Should take scoped_refptr rather than raw pointer.
|
||||
virtual bool AddTrack(AudioTrackInterface* track) = 0;
|
||||
virtual bool AddTrack(VideoTrackInterface* track) = 0;
|
||||
virtual bool RemoveTrack(AudioTrackInterface* track) = 0;
|
||||
|
|
|
@ -28,7 +28,7 @@ std::string MediaTypeToString(MediaType type) {
|
|||
return kMediaTypeData;
|
||||
case MEDIA_TYPE_UNSUPPORTED:
|
||||
// Unsupported media stores the m=<mediatype> differently.
|
||||
RTC_NOTREACHED();
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return "";
|
||||
}
|
||||
RTC_CHECK_NOTREACHED();
|
||||
|
|
22
rtc_tools/loopback_test/run-server.sh → api/metronome/BUILD.gn
Executable file → Normal file
22
rtc_tools/loopback_test/run-server.sh → api/metronome/BUILD.gn
Executable file → Normal file
|
@ -1,15 +1,19 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
|
||||
# Copyright (c) 2022 The WebRTC project authors. All Rights Reserved.
|
||||
#
|
||||
# Use of this source code is governed by a BSD-style license
|
||||
# that can be found in the LICENSE file in the root of the source
|
||||
# tree. An additional intellectual property rights grant can be found
|
||||
# in the file PATENTS. All contributing project authors may
|
||||
# be found in the AUTHORS file in the root of the source tree.
|
||||
#
|
||||
# This script is used to launch a simple http server for files in the same
|
||||
# location as the script itself.
|
||||
cd "`dirname \"$0\"`"
|
||||
echo "Starting http server in port 8080."
|
||||
exec python -m SimpleHTTPServer 8080
|
||||
|
||||
import("../../webrtc.gni")
|
||||
|
||||
rtc_source_set("metronome") {
|
||||
visibility = [ "*" ]
|
||||
sources = [ "metronome.h" ]
|
||||
deps = [
|
||||
"../../rtc_base/system:rtc_export",
|
||||
"../task_queue",
|
||||
"../units:time_delta",
|
||||
]
|
||||
}
|
65
api/metronome/metronome.h
Normal file
65
api/metronome/metronome.h
Normal file
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* Copyright (c) 2022 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef API_METRONOME_METRONOME_H_
|
||||
#define API_METRONOME_METRONOME_H_
|
||||
|
||||
#include "api/task_queue/task_queue_base.h"
|
||||
#include "api/units/time_delta.h"
|
||||
#include "rtc_base/system/rtc_export.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
// The Metronome posts OnTick() on task queues provided by its listeners' task
|
||||
// queue periodically. The metronome can be used as an alternative to using
|
||||
// PostDelayedTask on a thread or task queue for coalescing work and reducing
|
||||
// the number of idle-wakeups.
|
||||
//
|
||||
// Listeners can be added and removed from any sequence, but it is illegal to
|
||||
// remove a listener from an OnTick invocation.
|
||||
//
|
||||
// The metronome concept is still under experimentation, and may not be availble
|
||||
// in all platforms or applications. See https://crbug.com/1253787 for more
|
||||
// details.
|
||||
//
|
||||
// Metronome implementations must be thread-safe.
|
||||
class RTC_EXPORT Metronome {
|
||||
public:
|
||||
class RTC_EXPORT TickListener {
|
||||
public:
|
||||
virtual ~TickListener() = default;
|
||||
|
||||
// OnTick is run on the task queue provided by OnTickTaskQueue each time the
|
||||
// metronome ticks.
|
||||
virtual void OnTick() = 0;
|
||||
|
||||
// The task queue that OnTick will run on. Must not be null.
|
||||
virtual TaskQueueBase* OnTickTaskQueue() = 0;
|
||||
};
|
||||
|
||||
virtual ~Metronome() = default;
|
||||
|
||||
// Adds a tick listener to the metronome. Once this method has returned
|
||||
// OnTick will be invoked on each metronome tick. A listener may
|
||||
// only be added to the metronome once.
|
||||
virtual void AddListener(TickListener* listener) = 0;
|
||||
|
||||
// Removes the tick listener from the metronome. Once this method has returned
|
||||
// OnTick will never be called again. This method must not be called from
|
||||
// within OnTick.
|
||||
virtual void RemoveListener(TickListener* listener) = 0;
|
||||
|
||||
// Returns the current tick period of the metronome.
|
||||
virtual TimeDelta TickPeriod() const = 0;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // API_METRONOME_METRONOME_H_
|
30
api/metronome/test/BUILD.gn
Normal file
30
api/metronome/test/BUILD.gn
Normal file
|
@ -0,0 +1,30 @@
|
|||
# Copyright (c) 2022 The WebRTC project authors. All Rights Reserved.
|
||||
#
|
||||
# Use of this source code is governed by a BSD-style license
|
||||
# that can be found in the LICENSE file in the root of the source
|
||||
# tree. An additional intellectual property rights grant can be found
|
||||
# in the file PATENTS. All contributing project authors may
|
||||
# be found in the AUTHORS file in the root of the source tree.
|
||||
|
||||
import("../../../webrtc.gni")
|
||||
|
||||
rtc_library("fake_metronome") {
|
||||
testonly = true
|
||||
sources = [
|
||||
"fake_metronome.cc",
|
||||
"fake_metronome.h",
|
||||
]
|
||||
deps = [
|
||||
"..:metronome",
|
||||
"../..:priority",
|
||||
"../..:sequence_checker",
|
||||
"../../../rtc_base:macromagic",
|
||||
"../../../rtc_base:rtc_event",
|
||||
"../../../rtc_base:rtc_task_queue",
|
||||
"../../../rtc_base/synchronization:mutex",
|
||||
"../../../rtc_base/task_utils:repeating_task",
|
||||
"../../../rtc_base/task_utils:to_queued_task",
|
||||
"../../task_queue",
|
||||
"../../units:time_delta",
|
||||
]
|
||||
}
|
93
api/metronome/test/fake_metronome.cc
Normal file
93
api/metronome/test/fake_metronome.cc
Normal file
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* Copyright (c) 2022 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "api/metronome/test/fake_metronome.h"
|
||||
|
||||
#include "api/priority.h"
|
||||
#include "api/sequence_checker.h"
|
||||
#include "api/task_queue/task_queue_factory.h"
|
||||
#include "api/units/time_delta.h"
|
||||
#include "rtc_base/event.h"
|
||||
#include "rtc_base/task_utils/repeating_task.h"
|
||||
#include "rtc_base/task_utils/to_queued_task.h"
|
||||
|
||||
namespace webrtc::test {
|
||||
|
||||
ForcedTickMetronome::ForcedTickMetronome(TimeDelta tick_period)
|
||||
: tick_period_(tick_period) {}
|
||||
|
||||
void ForcedTickMetronome::AddListener(TickListener* listener) {
|
||||
listeners_.insert(listener);
|
||||
}
|
||||
|
||||
void ForcedTickMetronome::RemoveListener(TickListener* listener) {
|
||||
listeners_.erase(listener);
|
||||
}
|
||||
|
||||
TimeDelta ForcedTickMetronome::TickPeriod() const {
|
||||
return tick_period_;
|
||||
}
|
||||
|
||||
size_t ForcedTickMetronome::NumListeners() {
|
||||
return listeners_.size();
|
||||
}
|
||||
|
||||
void ForcedTickMetronome::Tick() {
|
||||
for (auto* listener : listeners_) {
|
||||
listener->OnTickTaskQueue()->PostTask(
|
||||
ToQueuedTask([listener] { listener->OnTick(); }));
|
||||
}
|
||||
}
|
||||
|
||||
FakeMetronome::FakeMetronome(TaskQueueFactory* factory, TimeDelta tick_period)
|
||||
: tick_period_(tick_period),
|
||||
queue_(factory->CreateTaskQueue("MetronomeQueue",
|
||||
TaskQueueFactory::Priority::HIGH)) {}
|
||||
|
||||
FakeMetronome::~FakeMetronome() {
|
||||
RTC_DCHECK(listeners_.empty());
|
||||
}
|
||||
|
||||
void FakeMetronome::AddListener(TickListener* listener) {
|
||||
MutexLock lock(&mutex_);
|
||||
listeners_.insert(listener);
|
||||
if (!started_) {
|
||||
tick_task_ = RepeatingTaskHandle::Start(queue_.Get(), [this] {
|
||||
MutexLock lock(&mutex_);
|
||||
// Stop if empty.
|
||||
if (listeners_.empty())
|
||||
return TimeDelta::PlusInfinity();
|
||||
for (auto* listener : listeners_) {
|
||||
listener->OnTickTaskQueue()->PostTask(
|
||||
ToQueuedTask([listener] { listener->OnTick(); }));
|
||||
}
|
||||
return tick_period_;
|
||||
});
|
||||
started_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
void FakeMetronome::RemoveListener(TickListener* listener) {
|
||||
MutexLock lock(&mutex_);
|
||||
listeners_.erase(listener);
|
||||
}
|
||||
|
||||
void FakeMetronome::Stop() {
|
||||
MutexLock lock(&mutex_);
|
||||
RTC_DCHECK(listeners_.empty());
|
||||
if (started_)
|
||||
queue_.PostTask([this] { tick_task_.Stop(); });
|
||||
}
|
||||
|
||||
TimeDelta FakeMetronome::TickPeriod() const {
|
||||
return tick_period_;
|
||||
}
|
||||
|
||||
} // namespace webrtc::test
|
77
api/metronome/test/fake_metronome.h
Normal file
77
api/metronome/test/fake_metronome.h
Normal file
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* Copyright (c) 2022 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef API_METRONOME_TEST_FAKE_METRONOME_H_
|
||||
#define API_METRONOME_TEST_FAKE_METRONOME_H_
|
||||
|
||||
#include <memory>
|
||||
#include <set>
|
||||
|
||||
#include "api/metronome/metronome.h"
|
||||
#include "api/task_queue/task_queue_base.h"
|
||||
#include "api/task_queue/task_queue_factory.h"
|
||||
#include "api/units/time_delta.h"
|
||||
#include "rtc_base/synchronization/mutex.h"
|
||||
#include "rtc_base/task_queue.h"
|
||||
#include "rtc_base/task_utils/repeating_task.h"
|
||||
#include "rtc_base/thread_annotations.h"
|
||||
|
||||
namespace webrtc::test {
|
||||
|
||||
// ForcedTickMetronome is a Metronome that ticks when `Tick()` is invoked.
|
||||
// The constructor argument `tick_period` returned in `TickPeriod()`.
|
||||
class ForcedTickMetronome : public Metronome {
|
||||
public:
|
||||
explicit ForcedTickMetronome(TimeDelta tick_period);
|
||||
|
||||
// Forces all TickListeners to run `OnTick`.
|
||||
void Tick();
|
||||
size_t NumListeners();
|
||||
|
||||
// Metronome implementation.
|
||||
void AddListener(TickListener* listener) override;
|
||||
void RemoveListener(TickListener* listener) override;
|
||||
TimeDelta TickPeriod() const override;
|
||||
|
||||
private:
|
||||
const TimeDelta tick_period_;
|
||||
std::set<TickListener*> listeners_;
|
||||
};
|
||||
|
||||
// FakeMetronome is a metronome that ticks based on a repeating task at the
|
||||
// `tick_period` provided in the constructor. It is designed for use with
|
||||
// simulated task queues for unit tests.
|
||||
//
|
||||
// `Stop()` must be called before destruction, as it cancels the metronome tick
|
||||
// on the proper task queue.
|
||||
class FakeMetronome : public Metronome {
|
||||
public:
|
||||
FakeMetronome(TaskQueueFactory* factory, TimeDelta tick_period);
|
||||
~FakeMetronome() override;
|
||||
|
||||
// Metronome implementation.
|
||||
void AddListener(TickListener* listener) override;
|
||||
void RemoveListener(TickListener* listener) override;
|
||||
TimeDelta TickPeriod() const override;
|
||||
|
||||
void Stop();
|
||||
|
||||
private:
|
||||
const TimeDelta tick_period_;
|
||||
RepeatingTaskHandle tick_task_;
|
||||
bool started_ RTC_GUARDED_BY(mutex_) = false;
|
||||
std::set<TickListener*> listeners_ RTC_GUARDED_BY(mutex_);
|
||||
Mutex mutex_;
|
||||
rtc::TaskQueue queue_;
|
||||
};
|
||||
|
||||
} // namespace webrtc::test
|
||||
|
||||
#endif // API_METRONOME_TEST_FAKE_METRONOME_H_
|
|
@ -30,8 +30,7 @@ std::string NetEq::Config::ToString() const {
|
|||
<< ", min_delay_ms=" << min_delay_ms << ", enable_fast_accelerate="
|
||||
<< (enable_fast_accelerate ? "true" : "false")
|
||||
<< ", enable_muted_state=" << (enable_muted_state ? "true" : "false")
|
||||
<< ", enable_rtx_handling=" << (enable_rtx_handling ? "true" : "false")
|
||||
<< ", extra_output_delay_ms=" << extra_output_delay_ms;
|
||||
<< ", enable_rtx_handling=" << (enable_rtx_handling ? "true" : "false");
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
|
|
|
@ -136,10 +136,6 @@ class NetEq {
|
|||
bool enable_rtx_handling = false;
|
||||
absl::optional<AudioCodecPairId> codec_pair_id;
|
||||
bool for_test_no_time_stretching = false; // Use only for testing.
|
||||
// Adds extra delay to the output of NetEq, without affecting jitter or
|
||||
// loss behavior. This is mainly for testing. Value must be a non-negative
|
||||
// multiple of 10 ms.
|
||||
int extra_output_delay_ms = 0;
|
||||
};
|
||||
|
||||
enum ReturnCodes { kOK = 0, kFail = -1 };
|
||||
|
@ -183,14 +179,6 @@ class NetEq {
|
|||
SdpAudioFormat sdp_format;
|
||||
};
|
||||
|
||||
// Creates a new NetEq object, with parameters set in `config`. The `config`
|
||||
// object will only have to be valid for the duration of the call to this
|
||||
// method.
|
||||
static NetEq* Create(
|
||||
const NetEq::Config& config,
|
||||
Clock* clock,
|
||||
const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory);
|
||||
|
||||
virtual ~NetEq() {}
|
||||
|
||||
// Inserts a new packet into NetEq.
|
||||
|
|
|
@ -14,7 +14,9 @@
|
|||
#include <list>
|
||||
|
||||
#include "api/media_stream_interface.h"
|
||||
#include "api/sequence_checker.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/system/no_unique_address.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
|
@ -23,14 +25,16 @@ namespace webrtc {
|
|||
template <class T>
|
||||
class Notifier : public T {
|
||||
public:
|
||||
Notifier() {}
|
||||
Notifier() { sequence_checker_.Detach(); }
|
||||
|
||||
virtual void RegisterObserver(ObserverInterface* observer) {
|
||||
RTC_DCHECK_RUN_ON(&sequence_checker_);
|
||||
RTC_DCHECK(observer != nullptr);
|
||||
observers_.push_back(observer);
|
||||
}
|
||||
|
||||
virtual void UnregisterObserver(ObserverInterface* observer) {
|
||||
RTC_DCHECK_RUN_ON(&sequence_checker_);
|
||||
for (std::list<ObserverInterface*>::iterator it = observers_.begin();
|
||||
it != observers_.end(); it++) {
|
||||
if (*it == observer) {
|
||||
|
@ -41,6 +45,7 @@ class Notifier : public T {
|
|||
}
|
||||
|
||||
void FireOnChanged() {
|
||||
RTC_DCHECK_RUN_ON(&sequence_checker_);
|
||||
// Copy the list of observers to avoid a crash if the observer object
|
||||
// unregisters as a result of the OnChanged() call. If the same list is used
|
||||
// UnregisterObserver will affect the list make the iterator invalid.
|
||||
|
@ -52,7 +57,10 @@ class Notifier : public T {
|
|||
}
|
||||
|
||||
protected:
|
||||
std::list<ObserverInterface*> observers_;
|
||||
std::list<ObserverInterface*> observers_ RTC_GUARDED_BY(sequence_checker_);
|
||||
|
||||
private:
|
||||
RTC_NO_UNIQUE_ADDRESS SequenceChecker sequence_checker_;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -11,9 +11,12 @@
|
|||
#ifndef API_PACKET_SOCKET_FACTORY_H_
|
||||
#define API_PACKET_SOCKET_FACTORY_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "api/async_dns_resolver.h"
|
||||
#include "api/wrapping_async_dns_resolver.h"
|
||||
#include "rtc_base/async_packet_socket.h"
|
||||
#include "rtc_base/proxy_info.h"
|
||||
#include "rtc_base/system/rtc_export.h"
|
||||
|
@ -56,7 +59,7 @@ class RTC_EXPORT PacketSocketFactory {
|
|||
virtual AsyncPacketSocket* CreateUdpSocket(const SocketAddress& address,
|
||||
uint16_t min_port,
|
||||
uint16_t max_port) = 0;
|
||||
virtual AsyncPacketSocket* CreateServerTcpSocket(
|
||||
virtual AsyncListenSocket* CreateServerTcpSocket(
|
||||
const SocketAddress& local_address,
|
||||
uint16_t min_port,
|
||||
uint16_t max_port,
|
||||
|
@ -69,7 +72,23 @@ class RTC_EXPORT PacketSocketFactory {
|
|||
const std::string& user_agent,
|
||||
const PacketSocketTcpOptions& tcp_options) = 0;
|
||||
|
||||
virtual AsyncResolverInterface* CreateAsyncResolver() = 0;
|
||||
// The AsyncResolverInterface is deprecated; users are encouraged
|
||||
// to switch to the AsyncDnsResolverInterface.
|
||||
// TODO(bugs.webrtc.org/12598): Remove once all downstream users
|
||||
// are converted.
|
||||
virtual AsyncResolverInterface* CreateAsyncResolver() {
|
||||
// Default implementation, so that downstream users can remove this
|
||||
// immediately after changing to CreateAsyncDnsResolver
|
||||
RTC_DCHECK_NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
virtual std::unique_ptr<webrtc::AsyncDnsResolverInterface>
|
||||
CreateAsyncDnsResolver() {
|
||||
// Default implementation, to aid in transition to AsyncDnsResolverInterface
|
||||
return std::make_unique<webrtc::WrappingAsyncDnsResolver>(
|
||||
CreateAsyncResolver());
|
||||
}
|
||||
|
||||
private:
|
||||
PacketSocketFactory(const PacketSocketFactory&) = delete;
|
||||
|
|
|
@ -41,12 +41,6 @@ PeerConnectionInterface::RTCConfiguration::RTCConfiguration(
|
|||
|
||||
PeerConnectionInterface::RTCConfiguration::~RTCConfiguration() = default;
|
||||
|
||||
RTCError PeerConnectionInterface::RemoveTrackNew(
|
||||
rtc::scoped_refptr<RtpSenderInterface> sender) {
|
||||
return RTCError(RemoveTrack(sender) ? RTCErrorType::NONE
|
||||
: RTCErrorType::INTERNAL_ERROR);
|
||||
}
|
||||
|
||||
RTCError PeerConnectionInterface::SetConfiguration(
|
||||
const PeerConnectionInterface::RTCConfiguration& config) {
|
||||
return RTCError();
|
||||
|
|
|
@ -76,6 +76,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include "absl/base/attributes.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/adaptation/resource.h"
|
||||
#include "api/async_dns_resolver.h"
|
||||
|
@ -95,6 +96,7 @@
|
|||
#include "api/jsep.h"
|
||||
#include "api/media_stream_interface.h"
|
||||
#include "api/media_types.h"
|
||||
#include "api/metronome/metronome.h"
|
||||
#include "api/neteq/neteq_factory.h"
|
||||
#include "api/network_state_predictor.h"
|
||||
#include "api/packet_socket_factory.h"
|
||||
|
@ -171,7 +173,12 @@ class StatsObserver : public rtc::RefCountInterface {
|
|||
~StatsObserver() override = default;
|
||||
};
|
||||
|
||||
enum class SdpSemantics { kPlanB, kUnifiedPlan };
|
||||
enum class SdpSemantics {
|
||||
// TODO(https://crbug.com/webrtc/13528): Remove support for kPlanB.
|
||||
kPlanB_DEPRECATED,
|
||||
kPlanB [[deprecated]] = kPlanB_DEPRECATED,
|
||||
kUnifiedPlan,
|
||||
};
|
||||
|
||||
class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
|
||||
public:
|
||||
|
@ -184,6 +191,7 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
|
|||
kHaveRemotePrAnswer,
|
||||
kClosed,
|
||||
};
|
||||
static constexpr absl::string_view AsString(SignalingState);
|
||||
|
||||
// See https://w3c.github.io/webrtc-pc/#dom-rtcicegatheringstate
|
||||
enum IceGatheringState {
|
||||
|
@ -191,6 +199,7 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
|
|||
kIceGatheringGathering,
|
||||
kIceGatheringComplete
|
||||
};
|
||||
static constexpr absl::string_view AsString(IceGatheringState state);
|
||||
|
||||
// See https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnectionstate
|
||||
enum class PeerConnectionState {
|
||||
|
@ -201,6 +210,7 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
|
|||
kFailed,
|
||||
kClosed,
|
||||
};
|
||||
static constexpr absl::string_view AsString(PeerConnectionState state);
|
||||
|
||||
// See https://w3c.github.io/webrtc-pc/#dom-rtciceconnectionstate
|
||||
enum IceConnectionState {
|
||||
|
@ -213,6 +223,7 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
|
|||
kIceConnectionClosed,
|
||||
kIceConnectionMax,
|
||||
};
|
||||
static constexpr absl::string_view AsString(IceConnectionState state);
|
||||
|
||||
// TLS certificate policy.
|
||||
enum TlsCertPolicy {
|
||||
|
@ -294,6 +305,13 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
|
|||
|
||||
enum ContinualGatheringPolicy { GATHER_ONCE, GATHER_CONTINUALLY };
|
||||
|
||||
struct PortAllocatorConfig {
|
||||
// For min_port and max_port, 0 means not specified.
|
||||
int min_port = 0;
|
||||
int max_port = 0;
|
||||
uint32_t flags = 0; // Same as kDefaultPortAllocatorFlags.
|
||||
};
|
||||
|
||||
enum class RTCConfigurationType {
|
||||
// A configuration that is safer to use, despite not having the best
|
||||
// performance. Currently this is the default configuration.
|
||||
|
@ -371,6 +389,18 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
|
|||
video_rtcp_report_interval_ms;
|
||||
}
|
||||
|
||||
// Settings for the port allcoator. Applied only if the port allocator is
|
||||
// created by PeerConnectionFactory, not if it is injected with
|
||||
// PeerConnectionDependencies
|
||||
int min_port() const { return port_allocator_config.min_port; }
|
||||
void set_min_port(int port) { port_allocator_config.min_port = port; }
|
||||
int max_port() const { return port_allocator_config.max_port; }
|
||||
void set_max_port(int port) { port_allocator_config.max_port = port; }
|
||||
uint32_t port_allocator_flags() { return port_allocator_config.flags; }
|
||||
void set_port_allocator_flags(uint32_t flags) {
|
||||
port_allocator_config.flags = flags;
|
||||
}
|
||||
|
||||
static const int kUndefined = -1;
|
||||
// Default maximum number of packets in the audio jitter buffer.
|
||||
static const int kAudioJitterBufferMaxPackets = 200;
|
||||
|
@ -598,28 +628,27 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
|
|||
// cost.
|
||||
absl::optional<rtc::AdapterType> network_preference;
|
||||
|
||||
// Configure the SDP semantics used by this PeerConnection. Note that the
|
||||
// WebRTC 1.0 specification requires kUnifiedPlan semantics. The
|
||||
// RtpTransceiver API is only available with kUnifiedPlan semantics.
|
||||
// Configure the SDP semantics used by this PeerConnection. By default, this
|
||||
// is Unified Plan which is compliant to the WebRTC 1.0 specification. It is
|
||||
// possible to overrwite this to the deprecated Plan B SDP format, but note
|
||||
// that kPlanB will be deleted at some future date, see
|
||||
// https://crbug.com/webrtc/13528.
|
||||
//
|
||||
// kPlanB will cause PeerConnection to create offers and answers with at
|
||||
// kUnifiedPlan will cause the PeerConnection to create offers and answers
|
||||
// with multiple m= sections where each m= section maps to one RtpSender and
|
||||
// one RtpReceiver (an RtpTransceiver), either both audio or both video.
|
||||
// This will also cause the PeerConnection to ignore all but the first
|
||||
// a=ssrc lines that form a Plan B streams (if the PeerConnection is given
|
||||
// Plan B SDP to process).
|
||||
//
|
||||
// kPlanB will cause the PeerConnection to create offers and answers with at
|
||||
// most one audio and one video m= section with multiple RtpSenders and
|
||||
// RtpReceivers specified as multiple a=ssrc lines within the section. This
|
||||
// will also cause PeerConnection to ignore all but the first m= section of
|
||||
// the same media type.
|
||||
//
|
||||
// kUnifiedPlan will cause PeerConnection to create offers and answers with
|
||||
// multiple m= sections where each m= section maps to one RtpSender and one
|
||||
// RtpReceiver (an RtpTransceiver), either both audio or both video. This
|
||||
// will also cause PeerConnection to ignore all but the first a=ssrc lines
|
||||
// that form a Plan B stream.
|
||||
//
|
||||
// For users who wish to send multiple audio/video streams and need to stay
|
||||
// interoperable with legacy WebRTC implementations or use legacy APIs,
|
||||
// specify kPlanB.
|
||||
//
|
||||
// For all other users, specify kUnifiedPlan.
|
||||
SdpSemantics sdp_semantics = SdpSemantics::kPlanB;
|
||||
// the same media type (if the PeerConnection is given Unified Plan SDP to
|
||||
// process).
|
||||
// RingRTC Change to use "Plan B"
|
||||
SdpSemantics sdp_semantics = SdpSemantics::kPlanB_DEPRECATED;
|
||||
|
||||
// TODO(bugs.webrtc.org/9891) - Move to crypto_options or remove.
|
||||
// Actively reset the SRTP parameters whenever the DTLS transports
|
||||
|
@ -669,6 +698,8 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
|
|||
// VPN (in case webrtc fails to auto detect them).
|
||||
std::vector<rtc::NetworkMask> vpn_list;
|
||||
|
||||
PortAllocatorConfig port_allocator_config;
|
||||
|
||||
//
|
||||
// Don't forget to update operator== if adding something.
|
||||
//
|
||||
|
@ -780,23 +811,25 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
|
|||
rtc::scoped_refptr<MediaStreamTrackInterface> track,
|
||||
const std::vector<std::string>& stream_ids) = 0;
|
||||
|
||||
// Remove an RtpSender from this PeerConnection.
|
||||
// Returns true on success.
|
||||
// TODO(steveanton): Replace with signature that returns RTCError.
|
||||
virtual bool RemoveTrack(RtpSenderInterface* sender) = 0;
|
||||
|
||||
// Plan B semantics: Removes the RtpSender from this PeerConnection.
|
||||
// Unified Plan semantics: Stop sending on the RtpSender and mark the
|
||||
// Removes the connection between a MediaStreamTrack and the PeerConnection.
|
||||
// Stops sending on the RtpSender and marks the
|
||||
// corresponding RtpTransceiver direction as no longer sending.
|
||||
// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-removetrack
|
||||
//
|
||||
// Errors:
|
||||
// - INVALID_PARAMETER: `sender` is null or (Plan B only) the sender is not
|
||||
// associated with this PeerConnection.
|
||||
// - INVALID_STATE: PeerConnection is closed.
|
||||
//
|
||||
// Plan B semantics: Removes the RtpSender from this PeerConnection.
|
||||
//
|
||||
// TODO(bugs.webrtc.org/9534): Rename to RemoveTrack once the other signature
|
||||
// is removed.
|
||||
virtual RTCError RemoveTrackNew(
|
||||
rtc::scoped_refptr<RtpSenderInterface> sender);
|
||||
// is removed; remove default implementation once upstream is updated.
|
||||
virtual RTCError RemoveTrackOrError(
|
||||
rtc::scoped_refptr<RtpSenderInterface> sender) {
|
||||
RTC_CHECK_NOTREACHED();
|
||||
return RTCError();
|
||||
}
|
||||
|
||||
// AddTransceiver creates a new RtpTransceiver and adds it to the set of
|
||||
// transceivers. Adding a transceiver will cause future calls to CreateOffer
|
||||
|
@ -1311,14 +1344,6 @@ class PeerConnectionObserver : public RtpPacketSinkInterface {
|
|||
// A new ICE candidate has been gathered.
|
||||
virtual void OnIceCandidate(const IceCandidateInterface* candidate) = 0;
|
||||
|
||||
// Gathering of an ICE candidate failed.
|
||||
// See https://w3c.github.io/webrtc-pc/#event-icecandidateerror
|
||||
// `host_candidate` is a stringified socket address.
|
||||
virtual void OnIceCandidateError(const std::string& host_candidate,
|
||||
const std::string& url,
|
||||
int error_code,
|
||||
const std::string& error_text) {}
|
||||
|
||||
// Gathering of an ICE candidate failed.
|
||||
// See https://w3c.github.io/webrtc-pc/#event-icecandidateerror
|
||||
virtual void OnIceCandidateError(const std::string& address,
|
||||
|
@ -1443,6 +1468,7 @@ struct RTC_EXPORT PeerConnectionFactoryDependencies final {
|
|||
rtc::Thread* network_thread = nullptr;
|
||||
rtc::Thread* worker_thread = nullptr;
|
||||
rtc::Thread* signaling_thread = nullptr;
|
||||
rtc::SocketFactory* socket_factory = nullptr;
|
||||
std::unique_ptr<TaskQueueFactory> task_queue_factory;
|
||||
std::unique_ptr<cricket::MediaEngineInterface> media_engine;
|
||||
std::unique_ptr<CallFactoryInterface> call_factory;
|
||||
|
@ -1460,6 +1486,7 @@ struct RTC_EXPORT PeerConnectionFactoryDependencies final {
|
|||
std::unique_ptr<WebRtcKeyValueConfig> trials;
|
||||
std::unique_ptr<RtpTransportControllerSendFactoryInterface>
|
||||
transport_controller_send_factory;
|
||||
std::unique_ptr<Metronome> metronome;
|
||||
};
|
||||
|
||||
// PeerConnectionFactoryInterface is the factory interface used for creating
|
||||
|
@ -1616,6 +1643,93 @@ RTC_EXPORT rtc::scoped_refptr<PeerConnectionFactoryInterface>
|
|||
CreateModularPeerConnectionFactory(
|
||||
PeerConnectionFactoryDependencies dependencies);
|
||||
|
||||
// https://w3c.github.io/webrtc-pc/#dom-rtcsignalingstate
|
||||
inline constexpr absl::string_view PeerConnectionInterface::AsString(
|
||||
SignalingState state) {
|
||||
switch (state) {
|
||||
case SignalingState::kStable:
|
||||
return "stable";
|
||||
case SignalingState::kHaveLocalOffer:
|
||||
return "have-local-offer";
|
||||
case SignalingState::kHaveLocalPrAnswer:
|
||||
return "have-local-pranswer";
|
||||
case SignalingState::kHaveRemoteOffer:
|
||||
return "have-remote-offer";
|
||||
case SignalingState::kHaveRemotePrAnswer:
|
||||
return "have-remote-pranswer";
|
||||
case SignalingState::kClosed:
|
||||
return "closed";
|
||||
}
|
||||
// This cannot happen.
|
||||
// Not using "RTC_CHECK_NOTREACHED()" because AsString() is constexpr.
|
||||
return "";
|
||||
}
|
||||
|
||||
// https://w3c.github.io/webrtc-pc/#dom-rtcicegatheringstate
|
||||
inline constexpr absl::string_view PeerConnectionInterface::AsString(
|
||||
IceGatheringState state) {
|
||||
switch (state) {
|
||||
case IceGatheringState::kIceGatheringNew:
|
||||
return "new";
|
||||
case IceGatheringState::kIceGatheringGathering:
|
||||
return "gathering";
|
||||
case IceGatheringState::kIceGatheringComplete:
|
||||
return "complete";
|
||||
}
|
||||
// This cannot happen.
|
||||
// Not using "RTC_CHECK_NOTREACHED()" because AsString() is constexpr.
|
||||
return "";
|
||||
}
|
||||
|
||||
// https://w3c.github.io/webrtc-pc/#dom-rtciceconnectionstate
|
||||
inline constexpr absl::string_view PeerConnectionInterface::AsString(
|
||||
PeerConnectionState state) {
|
||||
switch (state) {
|
||||
case PeerConnectionState::kNew:
|
||||
return "new";
|
||||
case PeerConnectionState::kConnecting:
|
||||
return "connecting";
|
||||
case PeerConnectionState::kConnected:
|
||||
return "connected";
|
||||
case PeerConnectionState::kDisconnected:
|
||||
return "disconnected";
|
||||
case PeerConnectionState::kFailed:
|
||||
return "failed";
|
||||
case PeerConnectionState::kClosed:
|
||||
return "closed";
|
||||
}
|
||||
// This cannot happen.
|
||||
// Not using "RTC_CHECK_NOTREACHED()" because AsString() is constexpr.
|
||||
return "";
|
||||
}
|
||||
|
||||
inline constexpr absl::string_view PeerConnectionInterface::AsString(
|
||||
IceConnectionState state) {
|
||||
switch (state) {
|
||||
case kIceConnectionNew:
|
||||
return "new";
|
||||
case kIceConnectionChecking:
|
||||
return "checking";
|
||||
case kIceConnectionConnected:
|
||||
return "connected";
|
||||
case kIceConnectionCompleted:
|
||||
return "completed";
|
||||
case kIceConnectionFailed:
|
||||
return "failed";
|
||||
case kIceConnectionDisconnected:
|
||||
return "disconnected";
|
||||
case kIceConnectionClosed:
|
||||
return "closed";
|
||||
case kIceConnectionMax:
|
||||
// This cannot happen.
|
||||
// Not using "RTC_CHECK_NOTREACHED()" because AsString() is constexpr.
|
||||
return "";
|
||||
}
|
||||
// This cannot happen.
|
||||
// Not using "RTC_CHECK_NOTREACHED()" because AsString() is constexpr.
|
||||
return "";
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // API_PEER_CONNECTION_INTERFACE_H_
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
#include <type_traits>
|
||||
|
||||
#include "rtc_base/constructor_magic.h"
|
||||
#include "rtc_base/ref_counter.h"
|
||||
|
||||
namespace rtc {
|
||||
|
@ -21,6 +20,9 @@ class RefCountedBase {
|
|||
public:
|
||||
RefCountedBase() = default;
|
||||
|
||||
RefCountedBase(const RefCountedBase&) = delete;
|
||||
RefCountedBase& operator=(const RefCountedBase&) = delete;
|
||||
|
||||
void AddRef() const { ref_count_.IncRef(); }
|
||||
RefCountReleaseStatus Release() const {
|
||||
const auto status = ref_count_.DecRef();
|
||||
|
@ -39,8 +41,6 @@ class RefCountedBase {
|
|||
|
||||
private:
|
||||
mutable webrtc::webrtc_impl::RefCounter ref_count_{0};
|
||||
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(RefCountedBase);
|
||||
};
|
||||
|
||||
// Template based version of `RefCountedBase` for simple implementations that do
|
||||
|
@ -61,6 +61,9 @@ class RefCountedNonVirtual {
|
|||
public:
|
||||
RefCountedNonVirtual() = default;
|
||||
|
||||
RefCountedNonVirtual(const RefCountedNonVirtual&) = delete;
|
||||
RefCountedNonVirtual& operator=(const RefCountedNonVirtual&) = delete;
|
||||
|
||||
void AddRef() const { ref_count_.IncRef(); }
|
||||
RefCountReleaseStatus Release() const {
|
||||
// If you run into this assert, T has virtual methods. There are two
|
||||
|
@ -88,8 +91,6 @@ class RefCountedNonVirtual {
|
|||
|
||||
private:
|
||||
mutable webrtc::webrtc_impl::RefCounter ref_count_{0};
|
||||
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(RefCountedNonVirtual);
|
||||
};
|
||||
|
||||
} // namespace rtc
|
||||
|
|
|
@ -178,11 +178,11 @@ inline std::ostream& operator<<( // no-presubmit-check TODO(webrtc:8982)
|
|||
// Helper macro that can be used by implementations to create an error with a
|
||||
// message and log it. `message` should be a string literal or movable
|
||||
// std::string.
|
||||
#define LOG_AND_RETURN_ERROR_EX(type, message, severity) \
|
||||
{ \
|
||||
RTC_DCHECK(type != RTCErrorType::NONE); \
|
||||
RTC_LOG(severity) << message << " (" << ToString(type) << ")"; \
|
||||
return webrtc::RTCError(type, message); \
|
||||
#define LOG_AND_RETURN_ERROR_EX(type, message, severity) \
|
||||
{ \
|
||||
RTC_DCHECK(type != RTCErrorType::NONE); \
|
||||
RTC_LOG(severity) << message << " (" << ::webrtc::ToString(type) << ")"; \
|
||||
return ::webrtc::RTCError(type, message); \
|
||||
}
|
||||
|
||||
#define LOG_AND_RETURN_ERROR(type, message) \
|
||||
|
@ -244,7 +244,7 @@ class RTCErrorOr {
|
|||
//
|
||||
// REQUIRES: !error.ok(). This requirement is DCHECKed.
|
||||
RTCErrorOr(RTCError&& error) : error_(std::move(error)) { // NOLINT
|
||||
RTC_DCHECK(!error.ok());
|
||||
RTC_DCHECK(!error_.ok());
|
||||
}
|
||||
|
||||
// Constructs a new RTCErrorOr with the given value. After calling this
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue