Update to WebRTC 4389 (e7d9f74)

Contains changes for M86 (4240), M87 (4280), M88 (4324), and M89 (4389).
This commit is contained in:
Peter Thatcher 2021-04-16 13:26:31 -07:00 committed by GitHub
parent dafb3321b5
commit 13cb722ac9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2327 changed files with 81446 additions and 50715 deletions

3
.gn
View file

@ -21,7 +21,6 @@ secondary_source = "//build/secondary/"
# their includes checked for proper dependencies when you run either # their includes checked for proper dependencies when you run either
# "gn check" or "gn gen --check". # "gn check" or "gn gen --check".
check_targets = [ check_targets = [
":webrtc_common",
"//api/*", "//api/*",
"//audio/*", "//audio/*",
"//backup/*", "//backup/*",
@ -60,6 +59,7 @@ default_args = {
# component builds. # component builds.
is_component_build = false is_component_build = false
# RingRTC change to control MacOS/iOS targets
mac_sdk_min = "10.12.1" mac_sdk_min = "10.12.1"
ios_deployment_target = "11.0" ios_deployment_target = "11.0"
@ -76,6 +76,7 @@ default_args = {
# for unittests, it can be disabled (see third_party/libyuv/BUILD.gn) # for unittests, it can be disabled (see third_party/libyuv/BUILD.gn)
libyuv_use_gflags = false libyuv_use_gflags = false
# RingRTC change to disable AV1
enable_libaom = false enable_libaom = false
gtest_enable_absl_printers = true gtest_enable_absl_printers = true

View file

@ -66,3 +66,11 @@ wheel: <
name: "infra/python/wheels/mock-py2_py3" name: "infra/python/wheels/mock-py2_py3"
version: "version:2.0.0" 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"
>

87
AUTHORS
View file

@ -1,110 +1,128 @@
# Names should be added to this file like so: # Names should be added to this file with this pattern:
# Name or Organization <email address> #
# For individuals:
# Name <email address>
#
# For organizations:
# Organization <fnmatch pattern>
#
# See python fnmatch module documentation for more information.
#
# Please keep the list sorted.
# BEGIN individuals section.
Adam Fedor <adam.fedor@gmail.com> Adam Fedor <adam.fedor@gmail.com>
Akshay Shah <meetakshay99@gmail.com> Akshay Shah <meetakshay99@gmail.com>
Alex Henrie <alexhenrie24@gmail.com>
Alexander Brauckmann <a.brauckmann@gmail.com> Alexander Brauckmann <a.brauckmann@gmail.com>
Alexandre Gouaillard <agouaillard@gmail.com> Alexandre Gouaillard <agouaillard@gmail.com>
Alex Henrie <alexhenrie24@gmail.com>
Andrew MacDonald <andrew@webrtc.org> Andrew MacDonald <andrew@webrtc.org>
Andrey Efremov <yoklmnprst@ya.ru> Andrey Efremov <yoklmnprst@ya.ru>
Andrew Johnson <ajohnson@draster.com>
Anil Kumar <an1kumar@gmail.com> Anil Kumar <an1kumar@gmail.com>
Ben Strong <bstrong@gmail.com> Ben Strong <bstrong@gmail.com>
Bob Withers <bwit@pobox.com> Bob Withers <bwit@pobox.com>
Bridger Maxwell <bridgeyman@gmail.com> Bridger Maxwell <bridgeyman@gmail.com>
Chris Tserng <tserng@amazon.com>
Christophe Dumez <ch.dumez@samsung.com> Christophe Dumez <ch.dumez@samsung.com>
Chris Tserng <tserng@amazon.com>
Cody Barnes <conceptgenesis@gmail.com> Cody Barnes <conceptgenesis@gmail.com>
Colin Plumb Colin Plumb
Cyril Lashkevich <notorca@gmail.com> Cyril Lashkevich <notorca@gmail.com>
CZ Theng <cz.theng@gmail.com>
Danail Kirov <dkirovbroadsoft@gmail.com>
David Porter <david@porter.me> David Porter <david@porter.me>
Dax Booysen <dax@younow.com> Dax Booysen <dax@younow.com>
Danail Kirov <dkirovbroadsoft@gmail.com> Dennis Angelo <dennis.angelo@gmail.com>
Dharmesh Chauhan <dharmesh.r.chauhan@gmail.com>
Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
Dmitry Lizin <sdkdimon@gmail.com> Dmitry Lizin <sdkdimon@gmail.com>
Eike Rathke <erathke@redhat.com>
Eric Rescorla, RTFM Inc. <ekr@rtfm.com> Eric Rescorla, RTFM Inc. <ekr@rtfm.com>
Frederik Riedel, Frogg GmbH <frederik.riedel@frogg.io> Frederik Riedel, Frogg GmbH <frederik.riedel@frogg.io>
Giji Gangadharan <giji.g@samsung.com> Giji Gangadharan <giji.g@samsung.com>
Graham Yoakum <gyoakum@skobalt.com> Graham Yoakum <gyoakum@skobalt.com>
Gustavo Garcia <gustavogb@gmail.com> Gustavo Garcia <gustavogb@gmail.com>
Hans Knoechel <hans@hans-knoechel.de>
Hugues Ekra <hekra01@gmail.com> Hugues Ekra <hekra01@gmail.com>
Jake Hilton <jakehilton@gmail.com> Jake Hilton <jakehilton@gmail.com>
James H. Brown <jbrown@burgoyne.com> James H. Brown <jbrown@burgoyne.com>
Jan Grulich <grulja@gmail.com>
Jan Kalab <pitlicek@gmail.com> Jan Kalab <pitlicek@gmail.com>
Jens Nielsen <jens.nielsen@berotec.se> Jens Nielsen <jens.nielsen@berotec.se>
Jiawei Ou <jiawei.ou@gmail.com> Jiawei Ou <jiawei.ou@gmail.com>
Jie Mao <maojie0924@gmail.com> Jie Mao <maojie0924@gmail.com>
Jiwon Kim <jwkim0000@gmail.com>
Jose Antonio Olivera Ortega <josea.olivera@gmail.com> Jose Antonio Olivera Ortega <josea.olivera@gmail.com>
Kiran Thind <kiran.thind@gmail.com> Kiran Thind <kiran.thind@gmail.com>
Korniltsev Anatoly <korniltsev.anatoly@gmail.com>
Lennart Grahl <lennart.grahl@gmail.com>
Luke Weber <luke.weber@gmail.com> Luke Weber <luke.weber@gmail.com>
Maksim Khobat <maksimkhobat@gmail.com> Maksim Khobat <maksimkhobat@gmail.com>
Mallikarjuna Rao V <vm.arjun@samsung.com> Mallikarjuna Rao V <vm.arjun@samsung.com>
Manish Jethani <manish.jethani@gmail.com> Manish Jethani <manish.jethani@gmail.com>
Martin Storsjo <martin@martin.st> Martin Storsjo <martin@martin.st>
Matthias Liebig <matthias.gcode@gmail.com> Matthias Liebig <matthias.gcode@gmail.com>
Maxim Pavlov <pavllovmax@gmail.com>
Maxim Potapov <vopatop.skam@gmail.com> Maxim Potapov <vopatop.skam@gmail.com>
Michael Iedema <michael@kapsulate.com> Michael Iedema <michael@kapsulate.com>
Michel Promonet <michel.promonet.1@gmail.com>
Miguel Paris <mparisdiaz@gmail.com>
Mike Gilbert <floppymaster@gmail.com> Mike Gilbert <floppymaster@gmail.com>
Min Wang <mingewang@gmail.com>
Mo Zanaty <mzanaty@cisco.com> Mo Zanaty <mzanaty@cisco.com>
Pali Rohar Pali Rohar
Paul Kapustin <pkapustin@gmail.com> Paul Kapustin <pkapustin@gmail.com>
Philipp Hancke <philipp.hancke@googlemail.com>
Peng Yu <yupeng323@gmail.com> Peng Yu <yupeng323@gmail.com>
Philipp Hancke <philipp.hancke@googlemail.com>
Piasy Xu <xz4215@gmail.com>
Rafael Lopez Diez <rafalopezdiez@gmail.com> Rafael Lopez Diez <rafalopezdiez@gmail.com>
Ralph Giles <giles@ghostscript.com> Ralph Giles <giles@ghostscript.com>
Raman Budny <budnyjj@gmail.com>
Ramprakash Jelari <ennajelari@gmail.com>
Riku Voipio <riku.voipio@linaro.org> Riku Voipio <riku.voipio@linaro.org>
Robert Bares <robert@bares.me> Robert Bares <robert@bares.me>
Robert Nagy <robert.nagy@gmail.com> Robert Nagy <robert.nagy@gmail.com>
Ryan Yoakum <ryoakum@skobalt.com> Ryan Yoakum <ryoakum@skobalt.com>
Satender Saroha <ssaroha@yahoo.com>
Sarah Thompson <sarah@telergy.com> Sarah Thompson <sarah@telergy.com>
Satender Saroha <ssaroha@yahoo.com>
Saul Kravitz <Saul.Kravitz@celera.com> Saul Kravitz <Saul.Kravitz@celera.com>
Sergio Garcia Murillo <sergio.garcia.murillo@gmail.com>
Silviu Caragea <silviu.cpp@gmail.com> Silviu Caragea <silviu.cpp@gmail.com>
Stefan Gula <steweg@gmail.com> Stefan Gula <steweg@gmail.com>
Stephan Hartmann <stha09@googlemail.com>
Steve Reid <sreid@sea-to-sky.net> Steve Reid <sreid@sea-to-sky.net>
Tarun Chawla <trnkumarchawla@gmail.com> Tarun Chawla <trnkumarchawla@gmail.com>
Todd Wong <todd.wong.ndq@gmail.com>
Tomas Popela <tomas.popela@gmail.com>
Trevor Hayes <trevor.axiom@gmail.com> Trevor Hayes <trevor.axiom@gmail.com>
Uladzislau Susha <landby@gmail.com> Uladzislau Susha <landby@gmail.com>
Vladimir Beloborodov <VladimirTechMan@gmail.com>
Vicken Simonian <vsimon@gmail.com> Vicken Simonian <vsimon@gmail.com>
Victor Costan <costan@gmail.com> Victor Costan <costan@gmail.com>
Vladimir Beloborodov <VladimirTechMan@gmail.com>
Xiaohong Xu <freemine@yeah.net> Xiaohong Xu <freemine@yeah.net>
Xiaolei Yu <dreifachstein@gmail.com> Xiaolei Yu <dreifachstein@gmail.com>
Yura Yaroshevich <yura.yaroshevich@gmail.com> Yura Yaroshevich <yura.yaroshevich@gmail.com>
Yuriy Pavlyshak <yuriy@appear.in> Yuriy Pavlyshak <yuriy@appear.in>
Hans Knoechel <hans@hans-knoechel.de>
Korniltsev Anatoly <korniltsev.anatoly@gmail.com>
Todd Wong <todd.wong.ndq@gmail.com>
Sergio Garcia Murillo <sergio.garcia.murillo@gmail.com>
Maxim Pavlov <pavllovmax@gmail.com>
Yusuke Suzuki <utatane.tea@gmail.com> Yusuke Suzuki <utatane.tea@gmail.com>
Piasy Xu <xz4215@gmail.com> # END individuals section.
Tomas Popela <tomas.popela@gmail.com>
Jan Grulich <grulja@gmail.com>
Jiwon Kim <jwkim0000@gmail.com>
Eike Rathke <erathke@redhat.com>
Michel Promonet <michel.promonet.1@gmail.com>
Min Wang <mingewang@gmail.com>
Ramprakash Jelari <ennajelari@gmail.com>
CZ Theng <cz.theng@gmail.com>
Miguel Paris <mparisdiaz@gmail.com>
Raman Budny <budnyjj@gmail.com>
Stephan Hartmann <stha09@googlemail.com>
&yet LLC <*@andyet.com> # BEGIN organizations section.
8x8 Inc. <*@sip-communicator.org>
8x8 Inc. <*@8x8.com> 8x8 Inc. <*@8x8.com>
8x8 Inc. <*@sip-communicator.org>
Agora IO <*@agora.io> Agora IO <*@agora.io>
ARM Holdings <*@arm.com> ARM Holdings <*@arm.com>
BroadSoft Inc. <*@broadsoft.com> BroadSoft Inc. <*@broadsoft.com>
CoSMo Software Consulting, Pte Ltd <*@cosmosoftware.io>
Facebook Inc. <*@fb.com> Facebook Inc. <*@fb.com>
Google Inc. <*@google.com> Google Inc. <*@google.com>
Highfive, Inc. <*@highfive.com>
HyperConnect Inc. <*@hpcnt.com> HyperConnect Inc. <*@hpcnt.com>
Life On Air Inc. <*@lifeonair.com>
Intel Corporation <*@intel.com> Intel Corporation <*@intel.com>
Life On Air Inc. <*@lifeonair.com>
Microsoft Corporation <*@microsoft.com> Microsoft Corporation <*@microsoft.com>
MIPS Technologies <*@mips.com> MIPS Technologies <*@mips.com>
Mozilla Foundation <*@mozilla.com> Mozilla Foundation <*@mozilla.com>
Netgem S.A. <*@netgem.com>
NVIDIA Corporation <*@nvidia.com> NVIDIA Corporation <*@nvidia.com>
Opera Software ASA <*@opera.com> Opera Software ASA <*@opera.com>
Optical Tone Ltd <*@opticaltone.com> Optical Tone Ltd <*@opticaltone.com>
@ -112,20 +130,19 @@ Pengutronix e.K. <*@pengutronix.de>
RingCentral, Inc. <*@ringcentral.com> RingCentral, Inc. <*@ringcentral.com>
Signal Messenger, LLC <*@signal.org> Signal Messenger, LLC <*@signal.org>
Sinch AB <*@sinch.com> Sinch AB <*@sinch.com>
Signal Messenger, LLC <*signal.org>
struktur AG <*@struktur.de> struktur AG <*@struktur.de>
Telenor Digital AS <*@telenor.com> Telenor Digital AS <*@telenor.com>
Temasys Communications <*@temasys.io> Temasys Communications <*@temasys.io>
The Chromium Authors <*@chromium.org> The Chromium Authors <*@chromium.org>
The WebRTC Authors <*@webrtc.org> The WebRTC Authors <*@webrtc.org>
Threema GmbH <*@threema.ch>
Tuple, LLC <*@tuple.app>
Twilio, Inc. <*@twilio.com> Twilio, Inc. <*@twilio.com>
Vewd Software AS <*@vewd.com>
Videona Socialmedia <*@videona.com>
Videxio AS <*@videxio.com> Videxio AS <*@videxio.com>
Vidyo, Inc. <*@vidyo.com> Vidyo, Inc. <*@vidyo.com>
Vonage Holdings Corp. <*@vonage.com> Vonage Holdings Corp. <*@vonage.com>
Wire Swiss GmbH <*@wire.com> Wire Swiss GmbH <*@wire.com>
Vewd Software AS <*@vewd.com> &yet LLC <*@andyet.com>
Highfive, Inc. <*@highfive.com> # END organizations section.
CoSMo Software Consulting, Pte Ltd <*@cosmosoftware.io>
Tuple, LLC <*@tuple.app>
Videona Socialmedia <*@videona.com>
Threema GmbH <*@threema.ch>

View file

@ -82,12 +82,15 @@ if (!build_with_chromium) {
} }
if (rtc_enable_protobuf) { if (rtc_enable_protobuf) {
deps += [ deps += [
# "audio:low_bandwidth_audio_test", "audio:low_bandwidth_audio_test",
"logging:rtc_event_log_rtp_dump", "logging:rtc_event_log_rtp_dump",
"tools_webrtc/perf:webrtc_dashboard_upload", "tools_webrtc/perf:webrtc_dashboard_upload",
] ]
} }
} }
if (target_os == "android") {
deps += [ "tools_webrtc:binary_version_check" ]
}
} }
} }
@ -129,6 +132,10 @@ config("common_inherited_config") {
defines += [ "RTC_DISABLE_CHECK_MSG" ] defines += [ "RTC_DISABLE_CHECK_MSG" ]
} }
if (rtc_enable_avx2) {
defines += [ "WEBRTC_ENABLE_AVX2" ]
}
# Some tests need to declare their own trace event handlers. If this define is # Some tests need to declare their own trace event handlers. If this define is
# not set, the first time TRACE_EVENT_* is called it will store the return # not set, the first time TRACE_EVENT_* is called it will store the return
# value for the current handler in an static variable, so that subsequent # value for the current handler in an static variable, so that subsequent
@ -169,7 +176,7 @@ config("common_inherited_config") {
"WEBRTC_IOS", "WEBRTC_IOS",
] ]
} }
if (is_linux) { if (is_linux || is_chromeos) {
defines += [ "WEBRTC_LINUX" ] defines += [ "WEBRTC_LINUX" ]
} }
if (is_mac) { if (is_mac) {
@ -414,7 +421,7 @@ config("common_config") {
} }
config("common_objc") { config("common_objc") {
libs = [ "Foundation.framework" ] frameworks = [ "Foundation.framework" ]
if (rtc_use_metal_rendering) { if (rtc_use_metal_rendering) {
defines = [ "RTC_SUPPORTS_METAL" ] defines = [ "RTC_SUPPORTS_METAL" ]
@ -436,7 +443,6 @@ if (!build_with_chromium) {
defines = [] defines = []
deps = [ deps = [
":webrtc_common",
"api:create_peerconnection_factory", "api:create_peerconnection_factory",
"api:libjingle_peerconnection_api", "api:libjingle_peerconnection_api",
"api:rtc_error", "api:rtc_error",
@ -512,15 +518,6 @@ if (!build_with_chromium) {
} }
} }
rtc_source_set("webrtc_common") {
# Client code SHOULD NOT USE THIS TARGET, but for now it needs to be public
# because there exists client code that uses it.
# TODO(bugs.webrtc.org/9808): Move to private visibility as soon as that
# client code gets updated.
visibility = [ "*" ]
sources = [ "common_types.h" ]
}
if (use_libfuzzer || use_afl) { if (use_libfuzzer || use_afl) {
# This target is only here for gn to discover fuzzer build targets under # This target is only here for gn to discover fuzzer build targets under
# webrtc/test/fuzzers/. # webrtc/test/fuzzers/.
@ -535,17 +532,18 @@ if (rtc_include_tests) {
testonly = true testonly = true
deps = [ deps = [
":webrtc_common",
"api:compile_all_headers", "api:compile_all_headers",
"api:rtc_api_unittests", "api:rtc_api_unittests",
"api/audio/test:audio_api_unittests", "api/audio/test:audio_api_unittests",
"api/audio_codecs/test:audio_codecs_api_unittests", "api/audio_codecs/test:audio_codecs_api_unittests",
"api/numerics:numerics_unittests",
"api/transport:stun_unittest", "api/transport:stun_unittest",
"api/video/test:rtc_api_video_unittests", "api/video/test:rtc_api_video_unittests",
"api/video_codecs/test:video_codecs_api_unittests", "api/video_codecs/test:video_codecs_api_unittests",
"call:fake_network_pipe_unittests", "call:fake_network_pipe_unittests",
"p2p:libstunprober_unittests", "p2p:libstunprober_unittests",
"p2p:rtc_p2p_unittests", "p2p:rtc_p2p_unittests",
"rtc_base:callback_list_unittests",
"rtc_base:rtc_base_approved_unittests", "rtc_base:rtc_base_approved_unittests",
"rtc_base:rtc_base_unittests", "rtc_base:rtc_base_unittests",
"rtc_base:rtc_json_unittests", "rtc_base:rtc_json_unittests",
@ -553,6 +551,7 @@ if (rtc_include_tests) {
"rtc_base:rtc_operations_chain_unittests", "rtc_base:rtc_operations_chain_unittests",
"rtc_base:rtc_task_queue_unittests", "rtc_base:rtc_task_queue_unittests",
"rtc_base:sigslot_unittest", "rtc_base:sigslot_unittest",
"rtc_base:untyped_function_unittest",
"rtc_base:weak_ptr_unittests", "rtc_base:weak_ptr_unittests",
"rtc_base/experiments:experiments_unittests", "rtc_base/experiments:experiments_unittests",
"rtc_base/synchronization:sequence_checker_unittests", "rtc_base/synchronization:sequence_checker_unittests",

521
DEPS

File diff suppressed because it is too large Load diff

View file

@ -6,6 +6,5 @@
# review owners to ensure that the added dependency was OK. # review owners to ensure that the added dependency was OK.
danilchap@webrtc.org danilchap@webrtc.org
kwiberg@webrtc.org
mbonadei@webrtc.org mbonadei@webrtc.org
phoglund@webrtc.org phoglund@webrtc.org

5
OWNERS
View file

@ -1,6 +1,5 @@
henrika@webrtc.org henrika@webrtc.org
juberti@webrtc.org juberti@webrtc.org
kwiberg@webrtc.org
mflodman@webrtc.org mflodman@webrtc.org
stefan@webrtc.org stefan@webrtc.org
tommi@webrtc.org tommi@webrtc.org
@ -13,10 +12,8 @@ per-file DEPS=*
per-file pylintrc=phoglund@webrtc.org per-file pylintrc=phoglund@webrtc.org
per-file WATCHLISTS=* per-file WATCHLISTS=*
per-file abseil-in-webrtc.md=danilchap@webrtc.org per-file abseil-in-webrtc.md=danilchap@webrtc.org
per-file abseil-in-webrtc.md=kwiberg@webrtc.org
per-file abseil-in-webrtc.md=mbonadei@webrtc.org per-file abseil-in-webrtc.md=mbonadei@webrtc.org
per-file style-guide.md=danilchap@webrtc.org per-file style-guide.md=danilchap@webrtc.org
per-file style-guide.md=kwiberg@webrtc.org per-file native-api.md=mbonadei@webrtc.org
per-file native-api.md=kwiberg@webrtc.org
# COMPONENT: Internals>WebRTC # COMPONENT: Internals>WebRTC

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,7 @@
Name: WebRTC Name: WebRTC
URL: http://www.webrtc.org URL: http://www.webrtc.org
Version: 90 Version: 90
CPEPrefix: cpe:/a:webrtc_project:webrtc:90
License: BSD License: BSD
License File: LICENSE License File: LICENSE

View file

@ -6,58 +6,21 @@ It currently has the following changes:
* Various things disabled (RTP header extensions, audio codecs) * Various things disabled (RTP header extensions, audio codecs)
* Various security patches (since the version when the fork branched off) * Various security patches (since the version when the fork branched off)
It began by branching at branch-heads/3987. Since then, we have merge at the following points: See [here][native-dev] for instructions on how to get started
developing with the native code.
At branch-heads/4044: [Authoritative list](native-api.md) of directories that contain the
* Update DEPS on Chromium, BoringSSL, FFMPEG, libvpx, ... native API header files.
* Added support for "GOOG_PING" to ICE
* Send normal STUN binding requests with a special attribute meaning "I support GOOG_PING" until the first response
* Send "I support GOOG_PING" in all STUN binding responses (making them slightly bigger)
* If the response has an "I support GOOG_PING" attribute, switch to supporting GOOG_PING. Else, don't
* Is supporting GOOG_PING mode and the last ACKed request is the same as the one just sent, send a GOOG_PING
* GOOG_PINGs have an HMAC of 4 bytes (instead of 20) and no other attribute (no fingerpint, username, peer reflex priority, etc), which makes them really small
* GOOG_PING responses also have an HMAC of 4 bytes
* Added support for selecting camera by name to Android SDK
* Added support for degredation preference to Android and iOS SDKs
* MessageQueue and Thread merged into one class
* Audio data includes absolute capture timestamps
* VideoEngine has different send and receive codec capabilities
* VideoEncoders report their requested resolution alignment
* VideoDecoders allow specifying the size of the decoded frame buffer pool
* VideoSinks can specify a resolution alignment, which is back
* Change default behavior of audio sending when ANA is enabled to dynamically adjust the packet overhead calculation according to the network route used by ICE and the size of the RTP headers.
* Different behavior for transport-cc1 and transport-cc2 when WebRTC-SendSideBwe-WithOverhead is enabled
* NetEq can take an injectable Clock (which comes from Call::Create)
* NetEq no longer supports INTER_ARRIVAL_TIME HistogramMode (it appeared to be unused)
* Removed AEC(1) (as opposed to AEC2 and AEC3)
* Removed ICE periodic regathering support
* Improved drawing over cursor over desktop capture
* Improved support for WebRTC-RtcpLossNotification ("goog-lntf")
At branch-heads/4103: ### More info
- Updated SCTP
- Added AV1 (although we turned it off to reduce attack surface)
- Header extensions added (turned off to reduce attack surface)
- Adaptation refactored a lot
- Various bug fixes (epoll, non-paced audio, candidates generated on 3G<->4G switching)
- Tweaks to padding
- Support for "inseartable streams" added (not used at the moment)
At branch-heads/4147: * Official web site: http://www.webrtc.org
- Update SCTP * Master source code repo: https://webrtc.googlesource.com/src
- VideoReceiveStream replaced with VideoReceiveStream2 * Samples and reference apps: https://github.com/webrtc
- Tweaks to GoogCC * Mailing list: http://groups.google.com/group/discuss-webrtc
- More adaptation refactoring * Continuous build: http://build.chromium.org/p/client.webrtc
- Support for 5G in network stack * [Coding style guide](style-guide.md)
- Remove SRTP_AES128_CM_SHA1_80 * [Code of conduct](CODE_OF_CONDUCT.md)
- Allow forInjectable APM? * [Reporting bugs](docs/bug-reporting.md)
At branch-heads/4183: [native-dev]: https://webrtc.googlesource.com/src/+/refs/heads/master/docs/native-code/index.md
- Video adapation refactored
- Refactored audio frame length (ptime) adapation
- Support for audio RED payload type added
- Support for audio RED payload type added
- Frame Marking RTP header extension removed
- MediaTransportInterface and DatagramTransportInterface removed
- Switch to using absl::MutexLock
- RtpRtcp module moved to RtpRtcpInterface + RtpRtcpModule2

View file

@ -113,8 +113,9 @@
'peah@webrtc.org', 'peah@webrtc.org',
'saza@webrtc.org'], 'saza@webrtc.org'],
'audio': ['peah@webrtc.org'], 'audio': ['peah@webrtc.org'],
'api': ['kwiberg@webrtc.org','peah@webrtc.org'], 'api': ['hta@webrtc.org',
'base': ['kwiberg@webrtc.org'], 'peah@webrtc.org'],
'base': ['hta@webrtc.org'],
'call': ['mflodman@webrtc.org', 'call': ['mflodman@webrtc.org',
'stefan@webrtc.org'], 'stefan@webrtc.org'],
'video': ['mflodman@webrtc.org', 'video': ['mflodman@webrtc.org',
@ -134,7 +135,6 @@
'audio_coding': ['alessiob@webrtc.org', 'audio_coding': ['alessiob@webrtc.org',
'audio-team@agora.io', 'audio-team@agora.io',
'henrik.lundin@webrtc.org', 'henrik.lundin@webrtc.org',
'kwiberg@webrtc.org',
'minyue@webrtc.org', 'minyue@webrtc.org',
'peah@webrtc.org', 'peah@webrtc.org',
'saza@webrtc.org'], 'saza@webrtc.org'],
@ -152,7 +152,6 @@
'audio-team@agora.io', 'audio-team@agora.io',
'fhernqvist@webrtc.org', 'fhernqvist@webrtc.org',
'henrik.lundin@webrtc.org', 'henrik.lundin@webrtc.org',
'kwiberg@webrtc.org',
'minyue@webrtc.org', 'minyue@webrtc.org',
'peah@webrtc.org', 'peah@webrtc.org',
'saza@webrtc.org'], 'saza@webrtc.org'],

View file

@ -9,6 +9,17 @@ adds the first use.
[abseil]: https://abseil.io/about/ [abseil]: https://abseil.io/about/
## How to depend on Abseil
For build targets of type `rtc_library`, `rtc_source_set` and
`rtc_static_library`, dependencies on Abseil need to be listed in `absl_deps`
instead of `deps`.
This is needed in order to support the Abseil component build in Chromium. In
that build mode, WebRTC will depend on a monolithic Abseil build target that
will generate a shared library.
## **Allowed** ## **Allowed**
* `absl::InlinedVector` * `absl::InlinedVector`
@ -63,12 +74,3 @@ has decided if they will change `absl::Span` to match.
These are optimized for speed, not binary size. Even `StrCat` calls These are optimized for speed, not binary size. Even `StrCat` calls
with a modest number of arguments can easily add several hundred bytes with a modest number of arguments can easily add several hundred bytes
to the binary. to the binary.
## How to depend on Abseil
For build targets `rtc_library`, `rtc_source_set` and `rtc_static_library`,
dependencies on Abseil need to be listed in `absl_deps` instead of `deps`.
This is needed in order to support the Abseil component build in Chromium. In
such build mode, WebRTC will depend on a unique Abseil build target what will
generate a shared library.

View file

@ -55,6 +55,7 @@ if (!build_with_chromium) {
"audio:audio_mixer_api", "audio:audio_mixer_api",
"audio_codecs:audio_codecs_api", "audio_codecs:audio_codecs_api",
"task_queue:default_task_queue_factory", "task_queue:default_task_queue_factory",
"transport:field_trial_based_config",
"video_codecs:video_codecs_api", "video_codecs:video_codecs_api",
] ]
} }
@ -68,7 +69,6 @@ rtc_library("rtp_headers") {
] ]
deps = [ deps = [
":array_view", ":array_view",
"..:webrtc_common",
"units:timestamp", "units:timestamp",
"video:video_rtp_headers", "video:video_rtp_headers",
] ]
@ -87,7 +87,6 @@ rtc_library("rtp_packet_info") {
":refcountedbase", ":refcountedbase",
":rtp_headers", ":rtp_headers",
":scoped_refptr", ":scoped_refptr",
"..:webrtc_common",
"../rtc_base:rtc_base_approved", "../rtc_base:rtc_base_approved",
"../rtc_base/system:rtc_export", "../rtc_base/system:rtc_export",
] ]
@ -99,6 +98,7 @@ rtc_library("media_stream_interface") {
sources = [ sources = [
"media_stream_interface.cc", "media_stream_interface.cc",
"media_stream_interface.h", "media_stream_interface.h",
"media_stream_track.h",
"notifier.h", "notifier.h",
] ]
deps = [ deps = [
@ -127,6 +127,7 @@ rtc_library("libjingle_peerconnection_api") {
"dtls_transport_interface.cc", "dtls_transport_interface.cc",
"dtls_transport_interface.h", "dtls_transport_interface.h",
"dtmf_sender_interface.h", "dtmf_sender_interface.h",
# RingRTC change to add ICE forking
"ice_gatherer_interface.h", "ice_gatherer_interface.h",
"ice_transport_interface.h", "ice_transport_interface.h",
"jsep.cc", "jsep.cc",
@ -150,6 +151,7 @@ rtc_library("libjingle_peerconnection_api") {
"rtp_transceiver_interface.h", "rtp_transceiver_interface.h",
"sctp_transport_interface.cc", "sctp_transport_interface.cc",
"sctp_transport_interface.h", "sctp_transport_interface.h",
"set_local_description_observer_interface.h",
"set_remote_description_observer_interface.h", "set_remote_description_observer_interface.h",
"stats_types.cc", "stats_types.cc",
"stats_types.h", "stats_types.h",
@ -186,6 +188,7 @@ rtc_library("libjingle_peerconnection_api") {
"transport:bitrate_settings", "transport:bitrate_settings",
"transport:enums", "transport:enums",
"transport:network_control", "transport:network_control",
"transport:sctp_transport_factory_interface",
"transport:webrtc_key_value_config", "transport:webrtc_key_value_config",
"transport/rtp:rtp_source", "transport/rtp:rtp_source",
"units:data_rate", "units:data_rate",
@ -197,7 +200,6 @@ rtc_library("libjingle_peerconnection_api") {
# Basically, don't add stuff here. You might break sensitive downstream # Basically, don't add stuff here. You might break sensitive downstream
# targets like pnacl. API should not depend on anything outside of this # targets like pnacl. API should not depend on anything outside of this
# file, really. All these should arguably go away in time. # file, really. All these should arguably go away in time.
"..:webrtc_common",
"../media:rtc_media_base", "../media:rtc_media_base",
"../media:rtc_media_config", "../media:rtc_media_config",
"../modules/audio_processing:audio_processing_statistics", "../modules/audio_processing:audio_processing_statistics",
@ -297,9 +299,10 @@ rtc_source_set("video_quality_analyzer_api") {
] ]
} }
rtc_source_set("track_id_stream_label_map") { rtc_source_set("track_id_stream_info_map") {
visibility = [ "*" ] visibility = [ "*" ]
sources = [ "test/track_id_stream_label_map.h" ] sources = [ "test/track_id_stream_info_map.h" ]
absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
} }
rtc_source_set("rtp_transceiver_direction") { rtc_source_set("rtp_transceiver_direction") {
@ -346,7 +349,7 @@ rtc_source_set("audio_quality_analyzer_api") {
deps = [ deps = [
":stats_observer_interface", ":stats_observer_interface",
":track_id_stream_label_map", ":track_id_stream_info_map",
] ]
} }
@ -378,9 +381,9 @@ rtc_source_set("peer_connection_quality_test_fixture_api") {
":rtp_parameters", ":rtp_parameters",
":simulated_network_api", ":simulated_network_api",
":stats_observer_interface", ":stats_observer_interface",
":track_id_stream_info_map",
":video_quality_analyzer_api", ":video_quality_analyzer_api",
"../media:rtc_media_base", "../media:rtc_media_base",
"../rtc_base:deprecation",
"../rtc_base:rtc_base", "../rtc_base:rtc_base",
"rtc_event_log", "rtc_event_log",
"task_queue", "task_queue",
@ -399,7 +402,10 @@ rtc_source_set("peer_connection_quality_test_fixture_api") {
rtc_source_set("frame_generator_api") { rtc_source_set("frame_generator_api") {
visibility = [ "*" ] visibility = [ "*" ]
testonly = true testonly = true
sources = [ "test/frame_generator_interface.h" ] sources = [
"test/frame_generator_interface.cc",
"test/frame_generator_interface.h",
]
deps = [ deps = [
":scoped_refptr", ":scoped_refptr",
@ -464,6 +470,7 @@ if (rtc_include_tests) {
deps = [ deps = [
":audio_quality_analyzer_api", ":audio_quality_analyzer_api",
":peer_connection_quality_test_fixture_api", ":peer_connection_quality_test_fixture_api",
":time_controller",
":video_quality_analyzer_api", ":video_quality_analyzer_api",
"../test/pc/e2e:peerconnection_quality_test", "../test/pc/e2e:peerconnection_quality_test",
] ]
@ -499,8 +506,8 @@ rtc_library("create_peer_connection_quality_test_frame_generator") {
":peer_connection_quality_test_fixture_api", ":peer_connection_quality_test_fixture_api",
"../rtc_base:checks", "../rtc_base:checks",
"../test:fileutils", "../test:fileutils",
"//third_party/abseil-cpp/absl/types:optional",
] ]
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
} }
rtc_source_set("libjingle_logging_api") { rtc_source_set("libjingle_logging_api") {
@ -578,10 +585,7 @@ rtc_source_set("bitrate_allocation") {
rtc_source_set("simulated_network_api") { rtc_source_set("simulated_network_api") {
visibility = [ "*" ] visibility = [ "*" ]
sources = [ "test/simulated_network.h" ] sources = [ "test/simulated_network.h" ]
deps = [ deps = [ "../rtc_base" ]
"../rtc_base",
"../rtc_base:criticalsection",
]
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ] absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
} }
@ -593,6 +597,7 @@ rtc_source_set("network_emulation_manager_api") {
"test/network_emulation_manager.h", "test/network_emulation_manager.h",
] ]
deps = [ deps = [
":array_view",
":simulated_network_api", ":simulated_network_api",
":time_controller", ":time_controller",
"../call:simulated_network", "../call:simulated_network",
@ -755,7 +760,7 @@ if (rtc_include_tests) {
"test/videocodec_test_stats.h", "test/videocodec_test_stats.h",
] ]
deps = [ deps = [
"..:webrtc_common", "../media:rtc_h264_profile_id",
"../modules/video_coding:video_codec_interface", "../modules/video_coding:video_codec_interface",
"../rtc_base:stringutils", "../rtc_base:stringutils",
"video:video_frame_type", "video:video_frame_type",
@ -789,6 +794,17 @@ if (rtc_include_tests) {
] ]
} }
rtc_source_set("mock_data_channel") {
visibility = [ "*" ]
testonly = true
sources = [ "test/mock_data_channel.h" ]
deps = [
":libjingle_peerconnection_api",
"../test:test_support",
]
}
rtc_source_set("mock_fec_controller_override") { rtc_source_set("mock_fec_controller_override") {
testonly = true testonly = true
sources = [ "test/mock_fec_controller_override.h" ] sources = [ "test/mock_fec_controller_override.h" ]
@ -829,7 +845,6 @@ if (rtc_include_tests) {
":array_view", ":array_view",
":libjingle_peerconnection_api", ":libjingle_peerconnection_api",
":rtp_parameters", ":rtp_parameters",
"..:webrtc_common",
"../rtc_base:checks", "../rtc_base:checks",
"../rtc_base:rtc_base_approved", "../rtc_base:rtc_base_approved",
"crypto:frame_encryptor_interface", "crypto:frame_encryptor_interface",
@ -846,13 +861,23 @@ if (rtc_include_tests) {
":array_view", ":array_view",
":libjingle_peerconnection_api", ":libjingle_peerconnection_api",
":rtp_parameters", ":rtp_parameters",
"..:webrtc_common",
"../rtc_base:checks", "../rtc_base:checks",
"../rtc_base:rtc_base_approved", "../rtc_base:rtc_base_approved",
"crypto:frame_decryptor_interface", "crypto:frame_decryptor_interface",
] ]
} }
rtc_source_set("mock_media_stream_interface") {
visibility = [ "*" ]
testonly = true
sources = [ "test/mock_media_stream_interface.h" ]
deps = [
":media_stream_interface",
"../test:test_support",
]
}
rtc_source_set("dummy_peer_connection") { rtc_source_set("dummy_peer_connection") {
visibility = [ "*" ] visibility = [ "*" ]
testonly = true testonly = true
@ -889,8 +914,10 @@ if (rtc_include_tests) {
} }
rtc_source_set("mock_rtp") { rtc_source_set("mock_rtp") {
visibility = [ "*" ]
testonly = true testonly = true
sources = [ sources = [
"test/mock_rtp_transceiver.h",
"test/mock_rtpreceiver.h", "test/mock_rtpreceiver.h",
"test/mock_rtpsender.h", "test/mock_rtpsender.h",
] ]
@ -1036,8 +1063,10 @@ if (rtc_include_tests) {
":fake_frame_decryptor", ":fake_frame_decryptor",
":fake_frame_encryptor", ":fake_frame_encryptor",
":mock_audio_mixer", ":mock_audio_mixer",
":mock_data_channel",
":mock_frame_decryptor", ":mock_frame_decryptor",
":mock_frame_encryptor", ":mock_frame_encryptor",
":mock_media_stream_interface",
":mock_peer_connection_factory_interface", ":mock_peer_connection_factory_interface",
":mock_peerconnectioninterface", ":mock_peerconnectioninterface",
":mock_rtp", ":mock_rtp",

View file

@ -128,7 +128,7 @@ specific_include_rules = {
"+media/base/media_config.h", "+media/base/media_config.h",
"+media/base/media_engine.h", "+media/base/media_engine.h",
"+p2p/base/port_allocator.h", "+p2p/base/port_allocator.h",
"+rtc_base/network.h", "+rtc_base/network_monitor_factory.h",
"+rtc_base/rtc_certificate.h", "+rtc_base/rtc_certificate.h",
"+rtc_base/rtc_certificate_generator.h", "+rtc_base/rtc_certificate_generator.h",
"+rtc_base/socket_address.h", "+rtc_base/socket_address.h",
@ -172,6 +172,9 @@ specific_include_rules = {
"+rtc_base/ref_count.h", "+rtc_base/ref_count.h",
], ],
"set_local_description_observer_interface\.h": [
"+rtc_base/ref_count.h",
],
"set_remote_description_observer_interface\.h": [ "set_remote_description_observer_interface\.h": [
"+rtc_base/ref_count.h", "+rtc_base/ref_count.h",
], ],
@ -258,7 +261,6 @@ specific_include_rules = {
], ],
"simulated_network\.h": [ "simulated_network\.h": [
"+rtc_base/critical_section.h",
"+rtc_base/random.h", "+rtc_base/random.h",
"+rtc_base/thread_annotations.h", "+rtc_base/thread_annotations.h",
], ],

View file

@ -2,7 +2,6 @@ crodbro@webrtc.org
deadbeef@webrtc.org deadbeef@webrtc.org
hta@webrtc.org hta@webrtc.org
juberti@webrtc.org juberti@webrtc.org
kwiberg@webrtc.org
magjed@webrtc.org magjed@webrtc.org
perkj@webrtc.org perkj@webrtc.org
tkchin@webrtc.org tkchin@webrtc.org
@ -11,4 +10,16 @@ tommi@webrtc.org
per-file peer_connection*=hbos@webrtc.org per-file peer_connection*=hbos@webrtc.org
per-file DEPS=mbonadei@webrtc.org per-file DEPS=mbonadei@webrtc.org
per-file DEPS=kwiberg@webrtc.org
# Please keep this list in sync with Chromium's //base/metrics/OWNERS and
# send a CL when you notice any difference.
# Even if people in the list below cannot formally grant +1 on WebRTC, it
# is good to get their LGTM before sending the CL to one of the folder OWNERS.
per-file uma_metrics.h=asvitkine@chromium.org
per-file uma_metrics.h=bcwhite@chromium.org
per-file uma_metrics.h=caitlinfischer@google.com
per-file uma_metrics.h=holte@chromium.org
per-file uma_metrics.h=isherman@chromium.org
per-file uma_metrics.h=jwd@chromium.org
per-file uma_metrics.h=mpearson@chromium.org
per-file uma_metrics.h=rkaplow@chromium.org

View file

@ -16,6 +16,7 @@ rtc_source_set("resource_adaptation_api") {
] ]
deps = [ deps = [
"../../api:scoped_refptr", "../../api:scoped_refptr",
"../../rtc_base:checks",
"../../rtc_base:refcount", "../../rtc_base:refcount",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
"../../rtc_base/system:rtc_export", "../../rtc_base/system:rtc_export",

View file

@ -10,6 +10,8 @@
#include "api/adaptation/resource.h" #include "api/adaptation/resource.h"
#include "rtc_base/checks.h"
namespace webrtc { namespace webrtc {
const char* ResourceUsageStateToString(ResourceUsageState usage_state) { const char* ResourceUsageStateToString(ResourceUsageState usage_state) {
@ -19,6 +21,7 @@ const char* ResourceUsageStateToString(ResourceUsageState usage_state) {
case ResourceUsageState::kUnderuse: case ResourceUsageState::kUnderuse:
return "kUnderuse"; return "kUnderuse";
} }
RTC_CHECK_NOTREACHED();
} }
ResourceListener::~ResourceListener() {} ResourceListener::~ResourceListener() {}

View file

@ -13,6 +13,7 @@
#include <algorithm> #include <algorithm>
#include <array> #include <array>
#include <iterator>
#include <type_traits> #include <type_traits>
#include "rtc_base/checks.h" #include "rtc_base/checks.h"
@ -258,6 +259,18 @@ class ArrayView final : public impl::ArrayViewBase<T, Size> {
T* end() const { return this->data() + this->size(); } T* end() const { return this->data() + this->size(); }
const T* cbegin() const { return this->data(); } const T* cbegin() const { return this->data(); }
const T* cend() const { return this->data() + this->size(); } const T* cend() const { return this->data() + this->size(); }
std::reverse_iterator<T*> rbegin() const {
return std::make_reverse_iterator(end());
}
std::reverse_iterator<T*> rend() const {
return std::make_reverse_iterator(begin());
}
std::reverse_iterator<const T*> crbegin() const {
return std::make_reverse_iterator(cend());
}
std::reverse_iterator<const T*> crend() const {
return std::make_reverse_iterator(cbegin());
}
ArrayView<T> subview(size_t offset, size_t size) const { ArrayView<T> subview(size_t offset, size_t size) const {
return offset < this->size() return offset < this->size()

View file

@ -451,6 +451,20 @@ TEST(ArrayViewTest, TestIterationEmpty) {
} }
} }
TEST(ArrayViewTest, TestReverseIterationEmpty) {
// Variable-size.
ArrayView<std::vector<std::vector<std::vector<std::string>>>> av;
EXPECT_EQ(av.rbegin(), av.rend());
EXPECT_EQ(av.crbegin(), av.crend());
EXPECT_TRUE(av.empty());
// Fixed-size.
ArrayView<std::vector<std::vector<std::vector<std::string>>>, 0> af;
EXPECT_EQ(af.begin(), af.end());
EXPECT_EQ(af.cbegin(), af.cend());
EXPECT_TRUE(af.empty());
}
TEST(ArrayViewTest, TestIterationVariable) { TEST(ArrayViewTest, TestIterationVariable) {
char arr[] = "Arrr!"; char arr[] = "Arrr!";
ArrayView<char> av(arr); ArrayView<char> av(arr);
@ -472,6 +486,25 @@ TEST(ArrayViewTest, TestIterationVariable) {
} }
} }
TEST(ArrayViewTest, TestReverseIterationVariable) {
char arr[] = "Arrr!";
ArrayView<char> av(arr);
EXPECT_EQ('\0', *av.rbegin());
EXPECT_EQ('\0', *av.crbegin());
EXPECT_EQ('A', *(av.rend() - 1));
EXPECT_EQ('A', *(av.crend() - 1));
const char* cit = av.cend() - 1;
for (auto crit = av.crbegin(); crit != av.crend(); ++crit, --cit) {
EXPECT_EQ(*cit, *crit);
}
char* it = av.end() - 1;
for (auto rit = av.rbegin(); rit != av.rend(); ++rit, --it) {
EXPECT_EQ(*it, *rit);
}
}
TEST(ArrayViewTest, TestIterationFixed) { TEST(ArrayViewTest, TestIterationFixed) {
char arr[] = "Arrr!"; char arr[] = "Arrr!";
ArrayView<char, 6> av(arr); ArrayView<char, 6> av(arr);
@ -493,6 +526,25 @@ TEST(ArrayViewTest, TestIterationFixed) {
} }
} }
TEST(ArrayViewTest, TestReverseIterationFixed) {
char arr[] = "Arrr!";
ArrayView<char, 6> av(arr);
EXPECT_EQ('\0', *av.rbegin());
EXPECT_EQ('\0', *av.crbegin());
EXPECT_EQ('A', *(av.rend() - 1));
EXPECT_EQ('A', *(av.crend() - 1));
const char* cit = av.cend() - 1;
for (auto crit = av.crbegin(); crit != av.crend(); ++crit, --cit) {
EXPECT_EQ(*cit, *crit);
}
char* it = av.end() - 1;
for (auto rit = av.rbegin(); rit != av.rend(); ++rit, --it) {
EXPECT_EQ(*it, *rit);
}
}
TEST(ArrayViewTest, TestEmpty) { TEST(ArrayViewTest, TestEmpty) {
EXPECT_TRUE(ArrayView<int>().empty()); EXPECT_TRUE(ArrayView<int>().empty());
const int a[] = {1, 2, 3}; const int a[] = {1, 2, 3};

View file

@ -24,6 +24,11 @@ rtc_library("audio_frame_api") {
] ]
} }
rtc_source_set("audio_frame_processor") {
visibility = [ "*" ]
sources = [ "audio_frame_processor.h" ]
}
rtc_source_set("audio_mixer_api") { rtc_source_set("audio_mixer_api") {
visibility = [ "*" ] visibility = [ "*" ]
sources = [ "audio_mixer.h" ] sources = [ "audio_mixer.h" ]

View file

@ -0,0 +1,43 @@
/*
* Copyright (c) 2020 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef API_AUDIO_AUDIO_FRAME_PROCESSOR_H_
#define API_AUDIO_AUDIO_FRAME_PROCESSOR_H_
#include <functional>
#include <memory>
namespace webrtc {
class AudioFrame;
// If passed into PeerConnectionFactory, will be used for additional
// processing of captured audio frames, performed before encoding.
// Implementations must be thread-safe.
class AudioFrameProcessor {
public:
using OnAudioFrameCallback = std::function<void(std::unique_ptr<AudioFrame>)>;
virtual ~AudioFrameProcessor() = default;
// Processes the frame received from WebRTC, is called by WebRTC off the
// realtime audio capturing path. AudioFrameProcessor must reply with
// processed frames by calling |sink_callback| if it was provided in SetSink()
// call. |sink_callback| can be called in the context of Process().
virtual void Process(std::unique_ptr<AudioFrame> frame) = 0;
// Atomically replaces the current sink with the new one. Before the
// first call to this function, or if the provided |sink_callback| is nullptr,
// processed frames are simply discarded.
virtual void SetSink(OnAudioFrameCallback sink_callback) = 0;
};
} // namespace webrtc
#endif // API_AUDIO_AUDIO_FRAME_PROCESSOR_H_

View file

@ -153,6 +153,7 @@ bool EchoCanceller3Config::Validate(EchoCanceller3Config* config) {
res = res & Limit(&c->filter.config_change_duration_blocks, 0, 100000); res = res & Limit(&c->filter.config_change_duration_blocks, 0, 100000);
res = res & Limit(&c->filter.initial_state_seconds, 0.f, 100.f); res = res & Limit(&c->filter.initial_state_seconds, 0.f, 100.f);
res = res & Limit(&c->filter.coarse_reset_hangover_blocks, 0, 2500);
res = res & Limit(&c->erle.min, 1.f, 100000.f); res = res & Limit(&c->erle.min, 1.f, 100000.f);
res = res & Limit(&c->erle.max_l, 1.f, 100000.f); res = res & Limit(&c->erle.max_l, 1.f, 100000.f);

View file

@ -86,6 +86,7 @@ struct RTC_EXPORT EchoCanceller3Config {
size_t config_change_duration_blocks = 250; size_t config_change_duration_blocks = 250;
float initial_state_seconds = 2.5f; float initial_state_seconds = 2.5f;
int coarse_reset_hangover_blocks = 25;
bool conservative_initial_phase = false; bool conservative_initial_phase = false;
bool enable_coarse_filter_output_usage = true; bool enable_coarse_filter_output_usage = true;
bool use_linear_filter = true; bool use_linear_filter = true;
@ -143,6 +144,7 @@ struct RTC_EXPORT EchoCanceller3Config {
float noise_gate_slope = 0.3f; float noise_gate_slope = 0.3f;
size_t render_pre_window_size = 1; size_t render_pre_window_size = 1;
size_t render_post_window_size = 1; size_t render_post_window_size = 1;
bool model_reverb_in_nonlinear_mode = true;
} echo_model; } echo_model;
struct ComfortNoise { struct ComfortNoise {
@ -215,11 +217,12 @@ struct RTC_EXPORT EchoCanceller3Config {
struct HighBandsSuppression { struct HighBandsSuppression {
float enr_threshold = 1.f; float enr_threshold = 1.f;
float max_gain_during_echo = 1.f; float max_gain_during_echo = 1.f;
float anti_howling_activation_threshold = 25.f; float anti_howling_activation_threshold = 400.f;
float anti_howling_gain = 0.01f; float anti_howling_gain = 1.f;
} high_bands_suppression; } high_bands_suppression;
float floor_first_increase = 0.00001f; float floor_first_increase = 0.00001f;
bool conservative_hf_suppression = false;
} suppressor; } suppressor;
}; };
} // namespace webrtc } // namespace webrtc

View file

@ -223,6 +223,8 @@ void Aec3ConfigFromJsonString(absl::string_view json_string,
&cfg.filter.config_change_duration_blocks); &cfg.filter.config_change_duration_blocks);
ReadParam(section, "initial_state_seconds", ReadParam(section, "initial_state_seconds",
&cfg.filter.initial_state_seconds); &cfg.filter.initial_state_seconds);
ReadParam(section, "coarse_reset_hangover_blocks",
&cfg.filter.coarse_reset_hangover_blocks);
ReadParam(section, "conservative_initial_phase", ReadParam(section, "conservative_initial_phase",
&cfg.filter.conservative_initial_phase); &cfg.filter.conservative_initial_phase);
ReadParam(section, "enable_coarse_filter_output_usage", ReadParam(section, "enable_coarse_filter_output_usage",
@ -302,6 +304,8 @@ void Aec3ConfigFromJsonString(absl::string_view json_string,
&cfg.echo_model.render_pre_window_size); &cfg.echo_model.render_pre_window_size);
ReadParam(section, "render_post_window_size", ReadParam(section, "render_post_window_size",
&cfg.echo_model.render_post_window_size); &cfg.echo_model.render_post_window_size);
ReadParam(section, "model_reverb_in_nonlinear_mode",
&cfg.echo_model.model_reverb_in_nonlinear_mode);
} }
if (rtc::GetValueFromJsonObject(aec3_root, "comfort_noise", &section)) { if (rtc::GetValueFromJsonObject(aec3_root, "comfort_noise", &section)) {
@ -381,6 +385,8 @@ void Aec3ConfigFromJsonString(absl::string_view json_string,
ReadParam(section, "floor_first_increase", ReadParam(section, "floor_first_increase",
&cfg.suppressor.floor_first_increase); &cfg.suppressor.floor_first_increase);
ReadParam(section, "conservative_hf_suppression",
&cfg.suppressor.conservative_hf_suppression);
} }
} }
@ -498,6 +504,8 @@ std::string Aec3ConfigToJsonString(const EchoCanceller3Config& config) {
<< config.filter.config_change_duration_blocks << ","; << config.filter.config_change_duration_blocks << ",";
ost << "\"initial_state_seconds\": " << config.filter.initial_state_seconds ost << "\"initial_state_seconds\": " << config.filter.initial_state_seconds
<< ","; << ",";
ost << "\"coarse_reset_hangover_blocks\": "
<< config.filter.coarse_reset_hangover_blocks << ",";
ost << "\"conservative_initial_phase\": " ost << "\"conservative_initial_phase\": "
<< (config.filter.conservative_initial_phase ? "true" : "false") << ","; << (config.filter.conservative_initial_phase ? "true" : "false") << ",";
ost << "\"enable_coarse_filter_output_usage\": " ost << "\"enable_coarse_filter_output_usage\": "
@ -585,7 +593,9 @@ std::string Aec3ConfigToJsonString(const EchoCanceller3Config& config) {
ost << "\"render_pre_window_size\": " ost << "\"render_pre_window_size\": "
<< config.echo_model.render_pre_window_size << ","; << config.echo_model.render_pre_window_size << ",";
ost << "\"render_post_window_size\": " ost << "\"render_post_window_size\": "
<< config.echo_model.render_post_window_size; << config.echo_model.render_post_window_size << ",";
ost << "\"model_reverb_in_nonlinear_mode\": "
<< (config.echo_model.model_reverb_in_nonlinear_mode ? "true" : "false");
ost << "},"; ost << "},";
ost << "\"comfort_noise\": {"; ost << "\"comfort_noise\": {";
@ -672,7 +682,10 @@ std::string Aec3ConfigToJsonString(const EchoCanceller3Config& config) {
ost << "\"anti_howling_gain\": " ost << "\"anti_howling_gain\": "
<< config.suppressor.high_bands_suppression.anti_howling_gain; << config.suppressor.high_bands_suppression.anti_howling_gain;
ost << "},"; ost << "},";
ost << "\"floor_first_increase\": " << config.suppressor.floor_first_increase; ost << "\"floor_first_increase\": " << config.suppressor.floor_first_increase
<< ",";
ost << "\"conservative_hf_suppression\": "
<< config.suppressor.conservative_hf_suppression;
ost << "}"; ost << "}";
ost << "}"; ost << "}";
ost << "}"; ost << "}";

View file

@ -22,6 +22,7 @@ TEST(EchoCanceller3JsonHelpers, ToStringAndParseJson) {
cfg.filter.refined.error_floor = 2.f; cfg.filter.refined.error_floor = 2.f;
cfg.filter.coarse_initial.length_blocks = 3u; cfg.filter.coarse_initial.length_blocks = 3u;
cfg.comfort_noise.noise_floor_dbfs = 100.f; cfg.comfort_noise.noise_floor_dbfs = 100.f;
cfg.echo_model.model_reverb_in_nonlinear_mode = false;
cfg.suppressor.normal_tuning.mask_hf.enr_suppress = .5f; cfg.suppressor.normal_tuning.mask_hf.enr_suppress = .5f;
cfg.suppressor.subband_nearend_detection.nearend_average_blocks = 3; cfg.suppressor.subband_nearend_detection.nearend_average_blocks = 3;
cfg.suppressor.subband_nearend_detection.subband1 = {1, 3}; cfg.suppressor.subband_nearend_detection.subband1 = {1, 3};
@ -48,6 +49,8 @@ TEST(EchoCanceller3JsonHelpers, ToStringAndParseJson) {
cfg_transformed.filter.refined.error_floor); cfg_transformed.filter.refined.error_floor);
EXPECT_EQ(cfg.comfort_noise.noise_floor_dbfs, EXPECT_EQ(cfg.comfort_noise.noise_floor_dbfs,
cfg_transformed.comfort_noise.noise_floor_dbfs); cfg_transformed.comfort_noise.noise_floor_dbfs);
EXPECT_EQ(cfg.echo_model.model_reverb_in_nonlinear_mode,
cfg_transformed.echo_model.model_reverb_in_nonlinear_mode);
EXPECT_EQ(cfg.suppressor.normal_tuning.mask_hf.enr_suppress, EXPECT_EQ(cfg.suppressor.normal_tuning.mask_hf.enr_suppress,
cfg_transformed.suppressor.normal_tuning.mask_hf.enr_suppress); cfg_transformed.suppressor.normal_tuning.mask_hf.enr_suppress);
EXPECT_EQ(cfg.suppressor.subband_nearend_detection.nearend_average_blocks, EXPECT_EQ(cfg.suppressor.subband_nearend_detection.nearend_average_blocks,

View file

@ -31,6 +31,7 @@ absl::optional<AudioDecoderL16::Config> AudioDecoderL16::SdpToConfig(
void AudioDecoderL16::AppendSupportedDecoders( void AudioDecoderL16::AppendSupportedDecoders(
std::vector<AudioCodecSpec>* specs) { std::vector<AudioCodecSpec>* specs) {
// RingRTC change to unused audio codecs
// Pcm16BAppendSupportedCodecSpecs(specs); // Pcm16BAppendSupportedCodecSpecs(specs);
} }

View file

@ -43,6 +43,7 @@ absl::optional<AudioEncoderL16::Config> AudioEncoderL16::SdpToConfig(
void AudioEncoderL16::AppendSupportedEncoders( void AudioEncoderL16::AppendSupportedEncoders(
std::vector<AudioCodecSpec>* specs) { std::vector<AudioCodecSpec>* specs) {
// RingRTC change to unused audio codecs
// Pcm16BAppendSupportedCodecSpecs(specs); // Pcm16BAppendSupportedCodecSpecs(specs);
} }

View file

@ -1 +1,2 @@
kwiberg@webrtc.org minyue@webrtc.org
henrik.lundin@webrtc.org

View file

@ -38,6 +38,8 @@ class AudioDecoderFactory : public rtc::RefCountInterface {
// communication between the AudioEncoder and AudioDecoder instances, which is // communication between the AudioEncoder and AudioDecoder instances, which is
// needed for some codecs with built-in bandwidth adaptation.) // needed for some codecs with built-in bandwidth adaptation.)
// //
// Returns null if the format isn't supported.
//
// Note: Implementations need to be robust against combinations other than // Note: Implementations need to be robust against combinations other than
// one encoder, one decoder getting the same ID; such decoders must still // one encoder, one decoder getting the same ID; such decoders must still
// work. // work.

View file

@ -115,6 +115,7 @@ class AudioEncoder {
std::vector<EncodedInfoLeaf> redundant; std::vector<EncodedInfoLeaf> redundant;
}; };
// RingRTC change to enable configuring OPUS
// Very OPUS-specific // Very OPUS-specific
struct Config { struct Config {
// AKA ptime or frame size // AKA ptime or frame size
@ -275,6 +276,7 @@ class AudioEncoder {
virtual absl::optional<std::pair<TimeDelta, TimeDelta>> GetFrameLengthRange() virtual absl::optional<std::pair<TimeDelta, TimeDelta>> GetFrameLengthRange()
const = 0; const = 0;
// RingRTC Change to configure OPUS
virtual bool Configure(const Config& config) { virtual bool Configure(const Config& config) {
RTC_LOG(LS_WARNING) << "Default AudioEncoder::Configure(...) does nothing!"; RTC_LOG(LS_WARNING) << "Default AudioEncoder::Configure(...) does nothing!";
return false; return false;

View file

@ -44,6 +44,8 @@ class AudioEncoderFactory : public rtc::RefCountInterface {
// communication between the AudioEncoder and AudioDecoder instances, which is // communication between the AudioEncoder and AudioDecoder instances, which is
// needed for some codecs with built-in bandwidth adaptation.) // needed for some codecs with built-in bandwidth adaptation.)
// //
// Returns null if the format isn't supported.
//
// Note: Implementations need to be robust against combinations other than // Note: Implementations need to be robust against combinations other than
// one encoder, one decoder getting the same ID; such encoders must still // one encoder, one decoder getting the same ID; such encoders must still
// work. // work.

View file

@ -37,6 +37,7 @@ absl::optional<AudioDecoderG711::Config> AudioDecoderG711::SdpToConfig(
void AudioDecoderG711::AppendSupportedDecoders( void AudioDecoderG711::AppendSupportedDecoders(
std::vector<AudioCodecSpec>* specs) { std::vector<AudioCodecSpec>* specs) {
// RingRTC change to unused audio codecs
// for (const char* type : {"PCMU", "PCMA"}) { // for (const char* type : {"PCMU", "PCMA"}) {
// specs->push_back({{type, 8000, 1}, {8000, 1, 64000}}); // specs->push_back({{type, 8000, 1}, {8000, 1, 64000}});
// } // }

View file

@ -47,6 +47,7 @@ absl::optional<AudioEncoderG711::Config> AudioEncoderG711::SdpToConfig(
void AudioEncoderG711::AppendSupportedEncoders( void AudioEncoderG711::AppendSupportedEncoders(
std::vector<AudioCodecSpec>* specs) { std::vector<AudioCodecSpec>* specs) {
// RingRTC change to unused audio codecs
// for (const char* type : {"PCMU", "PCMA"}) { // for (const char* type : {"PCMU", "PCMA"}) {
// specs->push_back({{type, 8000, 1}, {8000, 1, 64000}}); // specs->push_back({{type, 8000, 1}, {8000, 1, 64000}});
// } // }

View file

@ -31,6 +31,7 @@ absl::optional<AudioDecoderG722::Config> AudioDecoderG722::SdpToConfig(
void AudioDecoderG722::AppendSupportedDecoders( void AudioDecoderG722::AppendSupportedDecoders(
std::vector<AudioCodecSpec>* specs) { std::vector<AudioCodecSpec>* specs) {
// RingRTC change to unused audio codecs
// specs->push_back({{"G722", 8000, 1}, {16000, 1, 64000}}); // specs->push_back({{"G722", 8000, 1}, {16000, 1, 64000}});
} }

View file

@ -44,6 +44,7 @@ absl::optional<AudioEncoderG722Config> AudioEncoderG722::SdpToConfig(
void AudioEncoderG722::AppendSupportedEncoders( void AudioEncoderG722::AppendSupportedEncoders(
std::vector<AudioCodecSpec>* specs) { std::vector<AudioCodecSpec>* specs) {
// RingRTC change to unused audio codecs
// const SdpAudioFormat fmt = {"G722", 8000, 1}; // const SdpAudioFormat fmt = {"G722", 8000, 1};
// const AudioCodecInfo info = QueryAudioEncoder(*SdpToConfig(fmt)); // const AudioCodecInfo info = QueryAudioEncoder(*SdpToConfig(fmt));
// specs->push_back({fmt, info}); // specs->push_back({fmt, info});

View file

@ -28,6 +28,7 @@ absl::optional<AudioDecoderIlbc::Config> AudioDecoderIlbc::SdpToConfig(
void AudioDecoderIlbc::AppendSupportedDecoders( void AudioDecoderIlbc::AppendSupportedDecoders(
std::vector<AudioCodecSpec>* specs) { std::vector<AudioCodecSpec>* specs) {
// RingRTC change to unused audio codecs
// specs->push_back({{"ILBC", 8000, 1}, {8000, 1, 13300}}); // specs->push_back({{"ILBC", 8000, 1}, {8000, 1, 13300}});
} }

View file

@ -32,7 +32,7 @@ int GetIlbcBitrate(int ptime) {
// 50 bytes per frame of 30 ms => (approx) 13333 bits/s. // 50 bytes per frame of 30 ms => (approx) 13333 bits/s.
return 13333; return 13333;
default: default:
FATAL(); RTC_CHECK_NOTREACHED();
} }
} }
} // namespace } // namespace
@ -59,6 +59,7 @@ absl::optional<AudioEncoderIlbcConfig> AudioEncoderIlbc::SdpToConfig(
void AudioEncoderIlbc::AppendSupportedEncoders( void AudioEncoderIlbc::AppendSupportedEncoders(
std::vector<AudioCodecSpec>* specs) { std::vector<AudioCodecSpec>* specs) {
// RingRTC change to unused audio codecs
// const SdpAudioFormat fmt = {"ILBC", 8000, 1}; // const SdpAudioFormat fmt = {"ILBC", 8000, 1};
// const AudioCodecInfo info = QueryAudioEncoder(*SdpToConfig(fmt)); // const AudioCodecInfo info = QueryAudioEncoder(*SdpToConfig(fmt));
// specs->push_back({fmt, info}); // specs->push_back({fmt, info});

View file

@ -27,6 +27,7 @@ absl::optional<AudioDecoderIsacFix::Config> AudioDecoderIsacFix::SdpToConfig(
void AudioDecoderIsacFix::AppendSupportedDecoders( void AudioDecoderIsacFix::AppendSupportedDecoders(
std::vector<AudioCodecSpec>* specs) { std::vector<AudioCodecSpec>* specs) {
// RingRTC change to unused audio codecs
// specs->push_back({{"ISAC", 16000, 1}, {16000, 1, 32000, 10000, 32000}}); // specs->push_back({{"ISAC", 16000, 1}, {16000, 1, 32000, 10000, 32000}});
} }

View file

@ -32,6 +32,7 @@ AudioDecoderIsacFloat::SdpToConfig(const SdpAudioFormat& format) {
void AudioDecoderIsacFloat::AppendSupportedDecoders( void AudioDecoderIsacFloat::AppendSupportedDecoders(
std::vector<AudioCodecSpec>* specs) { std::vector<AudioCodecSpec>* specs) {
// RingRTC change to unused audio codecs
// specs->push_back({{"ISAC", 16000, 1}, {16000, 1, 32000, 10000, 32000}}); // specs->push_back({{"ISAC", 16000, 1}, {16000, 1, 32000, 10000, 32000}});
// specs->push_back({{"ISAC", 32000, 1}, {32000, 1, 56000, 10000, 56000}}); // specs->push_back({{"ISAC", 32000, 1}, {32000, 1, 56000, 10000, 56000}});
} }

View file

@ -38,6 +38,7 @@ absl::optional<AudioEncoderIsacFix::Config> AudioEncoderIsacFix::SdpToConfig(
void AudioEncoderIsacFix::AppendSupportedEncoders( void AudioEncoderIsacFix::AppendSupportedEncoders(
std::vector<AudioCodecSpec>* specs) { std::vector<AudioCodecSpec>* specs) {
// RingRTC change to unused audio codecs
// const SdpAudioFormat fmt = {"ISAC", 16000, 1}; // const SdpAudioFormat fmt = {"ISAC", 16000, 1};
// const AudioCodecInfo info = QueryAudioEncoder(*SdpToConfig(fmt)); // const AudioCodecInfo info = QueryAudioEncoder(*SdpToConfig(fmt));
// specs->push_back({fmt, info}); // specs->push_back({fmt, info});

View file

@ -45,6 +45,7 @@ AudioEncoderIsacFloat::SdpToConfig(const SdpAudioFormat& format) {
void AudioEncoderIsacFloat::AppendSupportedEncoders( void AudioEncoderIsacFloat::AppendSupportedEncoders(
std::vector<AudioCodecSpec>* specs) { std::vector<AudioCodecSpec>* specs) {
// RingRTC change to unused audio codecs
// for (int sample_rate_hz : {16000, 32000}) { // for (int sample_rate_hz : {16000, 32000}) {
// const SdpAudioFormat fmt = {"ISAC", sample_rate_hz, 1}; // const SdpAudioFormat fmt = {"ISAC", sample_rate_hz, 1};
// const AudioCodecInfo info = QueryAudioEncoder(*SdpToConfig(fmt)); // const AudioCodecInfo info = QueryAudioEncoder(*SdpToConfig(fmt));

View file

@ -18,6 +18,7 @@
#include "api/rtc_event_log/rtc_event_log_factory.h" #include "api/rtc_event_log/rtc_event_log_factory.h"
#include "api/scoped_refptr.h" #include "api/scoped_refptr.h"
#include "api/task_queue/default_task_queue_factory.h" #include "api/task_queue/default_task_queue_factory.h"
#include "api/transport/field_trial_based_config.h"
#include "media/base/media_engine.h" #include "media/base/media_engine.h"
#include "media/engine/webrtc_media_engine.h" #include "media/engine/webrtc_media_engine.h"
#include "modules/audio_device/include/audio_device.h" #include "modules/audio_device/include/audio_device.h"
@ -36,7 +37,8 @@ rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
std::unique_ptr<VideoEncoderFactory> video_encoder_factory, std::unique_ptr<VideoEncoderFactory> video_encoder_factory,
std::unique_ptr<VideoDecoderFactory> video_decoder_factory, std::unique_ptr<VideoDecoderFactory> video_decoder_factory,
rtc::scoped_refptr<AudioMixer> audio_mixer, rtc::scoped_refptr<AudioMixer> audio_mixer,
rtc::scoped_refptr<AudioProcessing> audio_processing) { rtc::scoped_refptr<AudioProcessing> audio_processing,
AudioFrameProcessor* audio_frame_processor) {
PeerConnectionFactoryDependencies dependencies; PeerConnectionFactoryDependencies dependencies;
dependencies.network_thread = network_thread; dependencies.network_thread = network_thread;
dependencies.worker_thread = worker_thread; dependencies.worker_thread = worker_thread;
@ -45,12 +47,14 @@ rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
dependencies.call_factory = CreateCallFactory(); dependencies.call_factory = CreateCallFactory();
dependencies.event_log_factory = std::make_unique<RtcEventLogFactory>( dependencies.event_log_factory = std::make_unique<RtcEventLogFactory>(
dependencies.task_queue_factory.get()); dependencies.task_queue_factory.get());
dependencies.trials = std::make_unique<webrtc::FieldTrialBasedConfig>();
cricket::MediaEngineDependencies media_dependencies; cricket::MediaEngineDependencies media_dependencies;
media_dependencies.task_queue_factory = dependencies.task_queue_factory.get(); media_dependencies.task_queue_factory = dependencies.task_queue_factory.get();
media_dependencies.adm = std::move(default_adm); media_dependencies.adm = std::move(default_adm);
media_dependencies.audio_encoder_factory = std::move(audio_encoder_factory); media_dependencies.audio_encoder_factory = std::move(audio_encoder_factory);
media_dependencies.audio_decoder_factory = std::move(audio_decoder_factory); media_dependencies.audio_decoder_factory = std::move(audio_decoder_factory);
media_dependencies.audio_frame_processor = audio_frame_processor;
if (audio_processing) { if (audio_processing) {
media_dependencies.audio_processing = std::move(audio_processing); media_dependencies.audio_processing = std::move(audio_processing);
} else { } else {
@ -59,6 +63,7 @@ rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
media_dependencies.audio_mixer = std::move(audio_mixer); media_dependencies.audio_mixer = std::move(audio_mixer);
media_dependencies.video_encoder_factory = std::move(video_encoder_factory); media_dependencies.video_encoder_factory = std::move(video_encoder_factory);
media_dependencies.video_decoder_factory = std::move(video_decoder_factory); media_dependencies.video_decoder_factory = std::move(video_decoder_factory);
media_dependencies.trials = dependencies.trials.get();
dependencies.media_engine = dependencies.media_engine =
cricket::CreateMediaEngine(std::move(media_dependencies)); cricket::CreateMediaEngine(std::move(media_dependencies));

View file

@ -31,6 +31,7 @@ class Thread;
namespace webrtc { namespace webrtc {
class AudioDeviceModule; class AudioDeviceModule;
class AudioFrameProcessor;
class AudioProcessing; class AudioProcessing;
// Create a new instance of PeerConnectionFactoryInterface with optional video // Create a new instance of PeerConnectionFactoryInterface with optional video
@ -47,7 +48,8 @@ CreatePeerConnectionFactory(
std::unique_ptr<VideoEncoderFactory> video_encoder_factory, std::unique_ptr<VideoEncoderFactory> video_encoder_factory,
std::unique_ptr<VideoDecoderFactory> video_decoder_factory, std::unique_ptr<VideoDecoderFactory> video_decoder_factory,
rtc::scoped_refptr<AudioMixer> audio_mixer, rtc::scoped_refptr<AudioMixer> audio_mixer,
rtc::scoped_refptr<AudioProcessing> audio_processing); rtc::scoped_refptr<AudioProcessing> audio_processing,
AudioFrameProcessor* audio_frame_processor = nullptr);
} // namespace webrtc } // namespace webrtc

View file

@ -23,6 +23,7 @@ CryptoOptions::CryptoOptions(const CryptoOptions& other) {
CryptoOptions::~CryptoOptions() {} CryptoOptions::~CryptoOptions() {}
// RingRTC change to use GCM by default
// static // static
CryptoOptions CryptoOptions::Default() { CryptoOptions CryptoOptions::Default() {
CryptoOptions options; CryptoOptions options;

View file

@ -25,6 +25,7 @@ struct RTC_EXPORT CryptoOptions {
CryptoOptions(const CryptoOptions& other); CryptoOptions(const CryptoOptions& other);
~CryptoOptions(); ~CryptoOptions();
// RingRTC change to use GCM by default
// Helper method to return an instance of the CryptoOptions with GCM crypto // Helper method to return an instance of the CryptoOptions with GCM crypto
// suites disabled. This method should be used instead of depending on current // suites disabled. This method should be used instead of depending on current
// default values set by the constructor. // default values set by the constructor.

View file

@ -27,7 +27,6 @@ namespace webrtc {
// without it. You may assume that this interface will have the same lifetime // without it. You may assume that this interface will have the same lifetime
// as the RTPReceiver it is attached to. It must only be attached to one // as the RTPReceiver it is attached to. It must only be attached to one
// RTPReceiver. Additional data may be null. // RTPReceiver. Additional data may be null.
// Note: This interface is not ready for production use.
class FrameDecryptorInterface : public rtc::RefCountInterface { class FrameDecryptorInterface : public rtc::RefCountInterface {
public: public:
// The Status enum represents all possible states that can be // The Status enum represents all possible states that can be

View file

@ -24,7 +24,6 @@ namespace webrtc {
// addition to the standard SRTP mechanism and is not intended to be used // addition to the standard SRTP mechanism and is not intended to be used
// without it. Implementations of this interface will have the same lifetime as // without it. Implementations of this interface will have the same lifetime as
// the RTPSenders it is attached to. Additional data may be null. // the RTPSenders it is attached to. Additional data may be null.
// Note: This interface is not ready for production use.
class FrameEncryptorInterface : public rtc::RefCountInterface { class FrameEncryptorInterface : public rtc::RefCountInterface {
public: public:
~FrameEncryptorInterface() override {} ~FrameEncryptorInterface() override {}

View file

@ -136,6 +136,13 @@ class RTC_EXPORT SessionDescriptionInterface {
virtual ~SessionDescriptionInterface() {} virtual ~SessionDescriptionInterface() {}
// Create a new SessionDescriptionInterface object
// with the same values as the old object.
// TODO(bugs.webrtc.org:12215): Remove default implementation
virtual std::unique_ptr<SessionDescriptionInterface> Clone() const {
return nullptr;
}
// Only for use internally. // Only for use internally.
virtual cricket::SessionDescription* description() = 0; virtual cricket::SessionDescription* description() = 0;
virtual const cricket::SessionDescription* description() const = 0; virtual const cricket::SessionDescription* description() const = 0;

View file

@ -34,6 +34,8 @@ class RTC_EXPORT JsepIceCandidate : public IceCandidateInterface {
JsepIceCandidate(const std::string& sdp_mid, JsepIceCandidate(const std::string& sdp_mid,
int sdp_mline_index, int sdp_mline_index,
const cricket::Candidate& candidate); const cricket::Candidate& candidate);
JsepIceCandidate(const JsepIceCandidate&) = delete;
JsepIceCandidate& operator=(const JsepIceCandidate&) = delete;
~JsepIceCandidate() override; ~JsepIceCandidate() override;
// |err| may be null. // |err| may be null.
bool Initialize(const std::string& sdp, SdpParseError* err); bool Initialize(const std::string& sdp, SdpParseError* err);
@ -53,8 +55,6 @@ class RTC_EXPORT JsepIceCandidate : public IceCandidateInterface {
std::string sdp_mid_; std::string sdp_mid_;
int sdp_mline_index_; int sdp_mline_index_;
cricket::Candidate candidate_; cricket::Candidate candidate_;
RTC_DISALLOW_COPY_AND_ASSIGN(JsepIceCandidate);
}; };
// Implementation of IceCandidateCollection which stores JsepIceCandidates. // Implementation of IceCandidateCollection which stores JsepIceCandidates.
@ -64,6 +64,8 @@ class JsepCandidateCollection : public IceCandidateCollection {
// Move constructor is defined so that a vector of JsepCandidateCollections // Move constructor is defined so that a vector of JsepCandidateCollections
// can be resized. // can be resized.
JsepCandidateCollection(JsepCandidateCollection&& o); JsepCandidateCollection(JsepCandidateCollection&& o);
// Returns a copy of the candidate collection.
JsepCandidateCollection Clone() const;
size_t count() const override; size_t count() const override;
bool HasCandidate(const IceCandidateInterface* candidate) const override; bool HasCandidate(const IceCandidateInterface* candidate) const override;
// Adds and takes ownership of the JsepIceCandidate. // Adds and takes ownership of the JsepIceCandidate.

View file

@ -49,6 +49,8 @@ class JsepSessionDescription : public SessionDescriptionInterface {
const std::string& session_id, const std::string& session_id,
const std::string& session_version); const std::string& session_version);
virtual std::unique_ptr<SessionDescriptionInterface> Clone() const;
virtual cricket::SessionDescription* description() { virtual cricket::SessionDescription* description() {
return description_.get(); return description_.get();
} }

View file

@ -216,6 +216,11 @@ class AudioTrackSinkInterface {
number_of_frames); number_of_frames);
} }
// Returns the number of channels encoded by the sink. This can be less than
// the number_of_channels if down-mixing occur. A value of -1 means an unknown
// number.
virtual int NumPreferredChannels() const { return -1; }
protected: protected:
virtual ~AudioTrackSinkInterface() {} virtual ~AudioTrackSinkInterface() {}
}; };

View file

@ -22,7 +22,7 @@ namespace webrtc {
// are called on is an implementation detail. // are called on is an implementation detail.
BEGIN_SIGNALING_PROXY_MAP(MediaStream) BEGIN_SIGNALING_PROXY_MAP(MediaStream)
PROXY_SIGNALING_THREAD_DESTRUCTOR() PROXY_SIGNALING_THREAD_DESTRUCTOR()
PROXY_CONSTMETHOD0(std::string, id) BYPASS_PROXY_CONSTMETHOD0(std::string, id)
PROXY_METHOD0(AudioTrackVector, GetAudioTracks) PROXY_METHOD0(AudioTrackVector, GetAudioTracks)
PROXY_METHOD0(VideoTrackVector, GetVideoTracks) PROXY_METHOD0(VideoTrackVector, GetVideoTracks)
PROXY_METHOD1(rtc::scoped_refptr<AudioTrackInterface>, PROXY_METHOD1(rtc::scoped_refptr<AudioTrackInterface>,

View file

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#ifndef PC_MEDIA_STREAM_TRACK_H_ #ifndef API_MEDIA_STREAM_TRACK_H_
#define PC_MEDIA_STREAM_TRACK_H_ #define API_MEDIA_STREAM_TRACK_H_
#include <string> #include <string>
@ -38,6 +38,7 @@ class MediaStreamTrack : public Notifier<T> {
} }
return fire_on_change; return fire_on_change;
} }
void set_ended() { set_state(MediaStreamTrackInterface::TrackState::kEnded); }
protected: protected:
explicit MediaStreamTrack(const std::string& id) explicit MediaStreamTrack(const std::string& id)
@ -53,10 +54,10 @@ class MediaStreamTrack : public Notifier<T> {
private: private:
bool enabled_; bool enabled_;
std::string id_; const std::string id_;
MediaStreamTrackInterface::TrackState state_; MediaStreamTrackInterface::TrackState state_;
}; };
} // namespace webrtc } // namespace webrtc
#endif // PC_MEDIA_STREAM_TRACK_H_ #endif // API_MEDIA_STREAM_TRACK_H_

View file

@ -26,8 +26,8 @@ namespace webrtc {
BEGIN_SIGNALING_PROXY_MAP(AudioTrack) BEGIN_SIGNALING_PROXY_MAP(AudioTrack)
PROXY_SIGNALING_THREAD_DESTRUCTOR() PROXY_SIGNALING_THREAD_DESTRUCTOR()
PROXY_CONSTMETHOD0(std::string, kind) BYPASS_PROXY_CONSTMETHOD0(std::string, kind)
PROXY_CONSTMETHOD0(std::string, id) BYPASS_PROXY_CONSTMETHOD0(std::string, id)
PROXY_CONSTMETHOD0(TrackState, state) PROXY_CONSTMETHOD0(TrackState, state)
PROXY_CONSTMETHOD0(bool, enabled) PROXY_CONSTMETHOD0(bool, enabled)
PROXY_CONSTMETHOD0(AudioSourceInterface*, GetSource) PROXY_CONSTMETHOD0(AudioSourceInterface*, GetSource)
@ -42,8 +42,8 @@ END_PROXY_MAP()
BEGIN_PROXY_MAP(VideoTrack) BEGIN_PROXY_MAP(VideoTrack)
PROXY_SIGNALING_THREAD_DESTRUCTOR() PROXY_SIGNALING_THREAD_DESTRUCTOR()
PROXY_CONSTMETHOD0(std::string, kind) BYPASS_PROXY_CONSTMETHOD0(std::string, kind)
PROXY_CONSTMETHOD0(std::string, id) BYPASS_PROXY_CONSTMETHOD0(std::string, id)
PROXY_CONSTMETHOD0(TrackState, state) PROXY_CONSTMETHOD0(TrackState, state)
PROXY_CONSTMETHOD0(bool, enabled) PROXY_CONSTMETHOD0(bool, enabled)
PROXY_METHOD1(bool, set_enabled, bool) PROXY_METHOD1(bool, set_enabled, bool)

View file

@ -26,10 +26,12 @@ std::string MediaTypeToString(MediaType type) {
return kMediaTypeVideo; return kMediaTypeVideo;
case MEDIA_TYPE_DATA: case MEDIA_TYPE_DATA:
return kMediaTypeData; return kMediaTypeData;
case MEDIA_TYPE_UNSUPPORTED:
// Unsupported media stores the m=<mediatype> differently.
RTC_NOTREACHED();
return "";
} }
FATAL(); RTC_CHECK_NOTREACHED();
// Not reachable; avoids compile warning.
return "";
} }
} // namespace cricket } // namespace cricket

View file

@ -20,7 +20,12 @@
namespace cricket { namespace cricket {
enum MediaType { MEDIA_TYPE_AUDIO, MEDIA_TYPE_VIDEO, MEDIA_TYPE_DATA }; enum MediaType {
MEDIA_TYPE_AUDIO,
MEDIA_TYPE_VIDEO,
MEDIA_TYPE_DATA,
MEDIA_TYPE_UNSUPPORTED
};
extern const char kMediaTypeAudio[]; extern const char kMediaTypeAudio[];
extern const char kMediaTypeVideo[]; extern const char kMediaTypeVideo[];

View file

@ -36,7 +36,6 @@ struct NetEqNetworkStatistics {
uint16_t preferred_buffer_size_ms; // Target buffer size in ms. uint16_t preferred_buffer_size_ms; // Target buffer size in ms.
uint16_t jitter_peaks_found; // 1 if adding extra delay due to peaky uint16_t jitter_peaks_found; // 1 if adding extra delay due to peaky
// jitter; 0 otherwise. // jitter; 0 otherwise.
uint16_t packet_loss_rate; // Loss rate (network + late) in Q14.
uint16_t expand_rate; // Fraction (of original stream) of synthesized uint16_t expand_rate; // Fraction (of original stream) of synthesized
// audio inserted through expansion (in Q14). // audio inserted through expansion (in Q14).
uint16_t speech_expand_rate; // Fraction (of original stream) of synthesized uint16_t speech_expand_rate; // Fraction (of original stream) of synthesized
@ -49,7 +48,6 @@ struct NetEqNetworkStatistics {
// decoding (in Q14). // decoding (in Q14).
uint16_t secondary_discarded_rate; // Fraction of discarded FEC/RED data (in uint16_t secondary_discarded_rate; // Fraction of discarded FEC/RED data (in
// Q14). // Q14).
size_t added_zero_samples; // Number of zero samples added in "off" mode.
// Statistics for packet waiting times, i.e., the time between a packet // Statistics for packet waiting times, i.e., the time between a packet
// arrives until it is decoded. // arrives until it is decoded.
int mean_waiting_time_ms; int mean_waiting_time_ms;
@ -274,6 +272,9 @@ class NetEq {
// after the call. // after the call.
virtual int NetworkStatistics(NetEqNetworkStatistics* stats) = 0; virtual int NetworkStatistics(NetEqNetworkStatistics* stats) = 0;
// Current values only, not resetting any state.
virtual NetEqNetworkStatistics CurrentNetworkStatistics() const = 0;
// Returns a copy of this class's lifetime statistics. These statistics are // Returns a copy of this class's lifetime statistics. These statistics are
// never reset. // never reset.
virtual NetEqLifetimeStatistics GetLifetimeStatistics() const = 0; virtual NetEqLifetimeStatistics GetLifetimeStatistics() const = 0;

View file

@ -97,6 +97,15 @@ class NetEqController {
size_t sync_buffer_samples; size_t sync_buffer_samples;
}; };
struct PacketArrivedInfo {
size_t packet_length_samples;
uint32_t main_timestamp;
uint16_t main_sequence_number;
bool is_cng_or_dtmf;
bool is_dtx;
bool buffer_flush;
};
virtual ~NetEqController() = default; virtual ~NetEqController() = default;
// Resets object to a clean state. // Resets object to a clean state.
@ -152,16 +161,17 @@ class NetEqController {
virtual void AddSampleMemory(int32_t value) = 0; virtual void AddSampleMemory(int32_t value) = 0;
// Returns the target buffer level in ms. // Returns the target buffer level in ms.
virtual int TargetLevelMs() = 0; virtual int TargetLevelMs() const = 0;
// Notify the NetEqController that a packet has arrived. Returns the relative // Notify the NetEqController that a packet has arrived. Returns the relative
// arrival delay, if it can be computed. // arrival delay, if it can be computed.
virtual absl::optional<int> PacketArrived(bool last_cng_or_dtmf, virtual absl::optional<int> PacketArrived(int fs_hz,
size_t packet_length_samples,
bool should_update_stats, bool should_update_stats,
uint16_t main_sequence_number, const PacketArrivedInfo& info) = 0;
uint32_t main_timestamp,
int fs_hz) = 0; // Notify the NetEqController that we are currently in muted state.
// TODO(ivoc): Make pure virtual when downstream is updated.
virtual void NotifyMutedState() {}
// Returns true if a peak was found. // Returns true if a peak was found.
virtual bool PeakFound() const = 0; virtual bool PeakFound() const = 0;

41
api/numerics/BUILD.gn Normal file
View file

@ -0,0 +1,41 @@
# Copyright (c) 2020 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
import("../../webrtc.gni")
rtc_library("numerics") {
visibility = [ "*" ]
sources = [
"samples_stats_counter.cc",
"samples_stats_counter.h",
]
deps = [
"..:array_view",
"../../rtc_base:checks",
"../../rtc_base:rtc_numerics",
"../../rtc_base:timeutils",
"../units:timestamp",
]
absl_deps = [ "//third_party/abseil-cpp/absl/algorithm:container" ]
}
if (rtc_include_tests) {
rtc_library("numerics_unittests") {
visibility = [ "*" ]
testonly = true
sources = [ "samples_stats_counter_unittest.cc" ]
deps = [
":numerics",
"../../test:test_support",
]
absl_deps = [ "//third_party/abseil-cpp/absl/algorithm:container" ]
}
}

6
api/numerics/DEPS Normal file
View file

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

View file

@ -8,8 +8,9 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#include "rtc_base/numerics/samples_stats_counter.h" #include "api/numerics/samples_stats_counter.h"
#include <algorithm>
#include <cmath> #include <cmath>
#include "absl/algorithm/container.h" #include "absl/algorithm/container.h"

View file

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#ifndef RTC_BASE_NUMERICS_SAMPLES_STATS_COUNTER_H_ #ifndef API_NUMERICS_SAMPLES_STATS_COUNTER_H_
#define RTC_BASE_NUMERICS_SAMPLES_STATS_COUNTER_H_ #define API_NUMERICS_SAMPLES_STATS_COUNTER_H_
#include <vector> #include <vector>
@ -45,6 +45,8 @@ class SamplesStatsCounter {
// Returns if there are any values in O(1) time. // Returns if there are any values in O(1) time.
bool IsEmpty() const { return samples_.empty(); } bool IsEmpty() const { return samples_.empty(); }
// Returns the amount of samples added into counter in O(1) time.
int64_t NumSamples() const { return stats_.Size(); }
// Returns min in O(1) time. This function may not be called if there are no // Returns min in O(1) time. This function may not be called if there are no
// samples. // samples.
@ -98,7 +100,7 @@ class SamplesStatsCounter {
} }
private: private:
RunningStatistics<double> stats_; webrtc_impl::RunningStatistics<double> stats_;
std::vector<StatsSample> samples_; std::vector<StatsSample> samples_;
bool sorted_ = false; bool sorted_ = false;
}; };
@ -116,4 +118,4 @@ SamplesStatsCounter operator/(const SamplesStatsCounter& counter, double value);
} // namespace webrtc } // namespace webrtc
#endif // RTC_BASE_NUMERICS_SAMPLES_STATS_COUNTER_H_ #endif // API_NUMERICS_SAMPLES_STATS_COUNTER_H_

View file

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#include "rtc_base/numerics/samples_stats_counter.h" #include "api/numerics/samples_stats_counter.h"
#include <math.h> #include <math.h>

View file

@ -36,6 +36,10 @@ PROXY_METHOD2(rtc::scoped_refptr<PeerConnectionInterface>,
CreatePeerConnection, CreatePeerConnection,
const PeerConnectionInterface::RTCConfiguration&, const PeerConnectionInterface::RTCConfiguration&,
PeerConnectionDependencies) PeerConnectionDependencies)
PROXY_METHOD2(RTCErrorOr<rtc::scoped_refptr<PeerConnectionInterface>>,
CreatePeerConnectionOrError,
const PeerConnectionInterface::RTCConfiguration&,
PeerConnectionDependencies)
PROXY_CONSTMETHOD1(webrtc::RtpCapabilities, PROXY_CONSTMETHOD1(webrtc::RtpCapabilities,
GetRtpSenderCapabilities, GetRtpSenderCapabilities,
cricket::MediaType) cricket::MediaType)

View file

@ -54,54 +54,38 @@ RTCError PeerConnectionInterface::SetConfiguration(
return RTCError(); return RTCError();
} }
RTCError PeerConnectionInterface::SetBitrate(const BitrateSettings& bitrate) { // RingRTC change to add ICE forking
BitrateParameters bitrate_parameters;
bitrate_parameters.min_bitrate_bps = bitrate.min_bitrate_bps;
bitrate_parameters.current_bitrate_bps = bitrate.start_bitrate_bps;
bitrate_parameters.max_bitrate_bps = bitrate.max_bitrate_bps;
return SetBitrate(bitrate_parameters);
}
RTCError PeerConnectionInterface::SetBitrate(
const BitrateParameters& bitrate_parameters) {
BitrateSettings bitrate;
bitrate.min_bitrate_bps = bitrate_parameters.min_bitrate_bps;
bitrate.start_bitrate_bps = bitrate_parameters.current_bitrate_bps;
bitrate.max_bitrate_bps = bitrate_parameters.max_bitrate_bps;
return SetBitrate(bitrate);
}
rtc::scoped_refptr<webrtc::IceGathererInterface> rtc::scoped_refptr<webrtc::IceGathererInterface>
PeerConnectionInterface::CreateSharedIceGatherer() { PeerConnectionInterface::CreateSharedIceGatherer() {
RTC_LOG(LS_ERROR) << "No shared ICE gatherer in dummy implementation"; RTC_LOG(LS_ERROR) << "No shared ICE gatherer in dummy implementation";
return nullptr; return nullptr;
} }
// RingRTC change to add ICE forking
bool PeerConnectionInterface::UseSharedIceGatherer( bool PeerConnectionInterface::UseSharedIceGatherer(
rtc::scoped_refptr<webrtc::IceGathererInterface> shared_ice_gatherer) { rtc::scoped_refptr<webrtc::IceGathererInterface> shared_ice_gatherer) {
RTC_LOG(LS_ERROR) << "No shared ICE gatherer in dummy implementation"; RTC_LOG(LS_ERROR) << "No shared ICE gatherer in dummy implementation";
return false; return false;
} }
// RingRTC change to RTP from being processed before the call is accepted
bool PeerConnectionInterface::SetIncomingRtpEnabled(bool enabled) { bool PeerConnectionInterface::SetIncomingRtpEnabled(bool enabled) {
RTC_LOG(LS_ERROR) << "No enabling of incoming RTP in dummy implementation"; RTC_LOG(LS_ERROR) << "No enabling of incoming RTP in dummy implementation";
return false; return false;
} }
// RingRTC change to send RTP data
bool PeerConnectionInterface::SendRtp(std::unique_ptr<RtpPacket> rtp_packet) { bool PeerConnectionInterface::SendRtp(std::unique_ptr<RtpPacket> rtp_packet) {
RTC_LOG(LS_ERROR) << "No SendRtp in dummy implementation"; RTC_LOG(LS_ERROR) << "No SendRtp in dummy implementation";
return false; return false;
} }
// RingRTC change to receive RTP data
bool PeerConnectionInterface::ReceiveRtp(uint8_t pt) { bool PeerConnectionInterface::ReceiveRtp(uint8_t pt) {
RTC_LOG(LS_ERROR) << "No SendRtp in dummy implementation"; RTC_LOG(LS_ERROR) << "No SendRtp in dummy implementation";
return false; return false;
} }
PeerConnectionInterface::BitrateParameters::BitrateParameters() = default;
PeerConnectionInterface::BitrateParameters::~BitrateParameters() = default;
PeerConnectionDependencies::PeerConnectionDependencies( PeerConnectionDependencies::PeerConnectionDependencies(
PeerConnectionObserver* observer_in) PeerConnectionObserver* observer_in)
: observer(observer_in) {} : observer(observer_in) {}
@ -136,6 +120,13 @@ PeerConnectionFactoryInterface::CreatePeerConnection(
return nullptr; return nullptr;
} }
RTCErrorOr<rtc::scoped_refptr<PeerConnectionInterface>>
PeerConnectionFactoryInterface::CreatePeerConnectionOrError(
const PeerConnectionInterface::RTCConfiguration& configuration,
PeerConnectionDependencies dependencies) {
return RTCError(RTCErrorType::INTERNAL_ERROR);
}
RtpCapabilities PeerConnectionFactoryInterface::GetRtpSenderCapabilities( RtpCapabilities PeerConnectionFactoryInterface::GetRtpSenderCapabilities(
cricket::MediaType kind) const { cricket::MediaType kind) const {
return {}; return {};

View file

@ -98,6 +98,7 @@
#include "api/rtp_sender_interface.h" #include "api/rtp_sender_interface.h"
#include "api/rtp_transceiver_interface.h" #include "api/rtp_transceiver_interface.h"
#include "api/sctp_transport_interface.h" #include "api/sctp_transport_interface.h"
#include "api/set_local_description_observer_interface.h"
#include "api/set_remote_description_observer_interface.h" #include "api/set_remote_description_observer_interface.h"
#include "api/stats/rtc_stats_collector_callback.h" #include "api/stats/rtc_stats_collector_callback.h"
#include "api/stats_types.h" #include "api/stats_types.h"
@ -105,6 +106,7 @@
#include "api/transport/bitrate_settings.h" #include "api/transport/bitrate_settings.h"
#include "api/transport/enums.h" #include "api/transport/enums.h"
#include "api/transport/network_control.h" #include "api/transport/network_control.h"
#include "api/transport/sctp_transport_factory_interface.h"
#include "api/transport/webrtc_key_value_config.h" #include "api/transport/webrtc_key_value_config.h"
#include "api/turn_customizer.h" #include "api/turn_customizer.h"
#include "call/rtp_packet_sink_interface.h" #include "call/rtp_packet_sink_interface.h"
@ -116,7 +118,7 @@
// inject a PacketSocketFactory and/or NetworkManager, and not expose // inject a PacketSocketFactory and/or NetworkManager, and not expose
// PortAllocator in the PeerConnection api. // PortAllocator in the PeerConnection api.
#include "p2p/base/port_allocator.h" // nogncheck #include "p2p/base/port_allocator.h" // nogncheck
#include "rtc_base/network.h" #include "rtc_base/network_monitor_factory.h"
#include "rtc_base/rtc_certificate.h" #include "rtc_base/rtc_certificate.h"
#include "rtc_base/rtc_certificate_generator.h" #include "rtc_base/rtc_certificate_generator.h"
#include "rtc_base/socket_address.h" #include "rtc_base/socket_address.h"
@ -642,8 +644,9 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
// Whether network condition based codec switching is allowed. // Whether network condition based codec switching is allowed.
absl::optional<bool> allow_codec_switching; absl::optional<bool> allow_codec_switching;
bool enable_simulcast_stats = true; // The delay before doing a usage histogram report for long-lived
// PeerConnections. Used for testing only.
absl::optional<int> report_usage_pattern_delay_ms;
// //
// Don't forget to update operator== if adding something. // Don't forget to update operator== if adding something.
// //
@ -914,6 +917,10 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
const std::string& label, const std::string& label,
const DataChannelInit* config) = 0; const DataChannelInit* config) = 0;
// NOTE: For the following 6 methods, it's only safe to dereference the
// SessionDescriptionInterface on signaling_thread() (for example, calling
// ToString).
// Returns the more recently applied description; "pending" if it exists, and // Returns the more recently applied description; "pending" if it exists, and
// otherwise "current". See below. // otherwise "current". See below.
virtual const SessionDescriptionInterface* local_description() const = 0; virtual const SessionDescriptionInterface* local_description() const = 0;
@ -953,26 +960,66 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
const RTCOfferAnswerOptions& options) = 0; const RTCOfferAnswerOptions& options) = 0;
// Sets the local session description. // Sets the local session description.
// The PeerConnection takes the ownership of |desc| even if it fails. //
// The |observer| callback will be called when done. // According to spec, the local session description MUST be the same as was
// TODO(deadbeef): Change |desc| to be a unique_ptr, to make it clear // returned by CreateOffer() or CreateAnswer() or else the operation should
// that this method always takes ownership of it. // fail. Our implementation however allows some amount of "SDP munging", but
// please note that this is HIGHLY DISCOURAGED. If you do not intent to munge
// SDP, the method below that doesn't take |desc| as an argument will create
// the offer or answer for you.
//
// The observer is invoked as soon as the operation completes, which could be
// before or after the SetLocalDescription() method has exited.
virtual void SetLocalDescription(
std::unique_ptr<SessionDescriptionInterface> desc,
rtc::scoped_refptr<SetLocalDescriptionObserverInterface> observer) {}
// Creates an offer or answer (depending on current signaling state) and sets
// it as the local session description.
//
// The observer is invoked as soon as the operation completes, which could be
// before or after the SetLocalDescription() method has exited.
virtual void SetLocalDescription(
rtc::scoped_refptr<SetLocalDescriptionObserverInterface> observer) {}
// Like SetLocalDescription() above, but the observer is invoked with a delay
// after the operation completes. This helps avoid recursive calls by the
// observer but also makes it possible for states to change in-between the
// operation completing and the observer getting called. This makes them racy
// for synchronizing peer connection states to the application.
// TODO(https://crbug.com/webrtc/11798): Delete these methods in favor of the
// ones taking SetLocalDescriptionObserverInterface as argument.
virtual void SetLocalDescription(SetSessionDescriptionObserver* observer, virtual void SetLocalDescription(SetSessionDescriptionObserver* observer,
SessionDescriptionInterface* desc) = 0; SessionDescriptionInterface* desc) = 0;
// Implicitly creates an offer or answer (depending on the current signaling
// state) and performs SetLocalDescription() with the newly generated session
// description.
// TODO(hbos): Make pure virtual when implemented by downstream projects.
virtual void SetLocalDescription(SetSessionDescriptionObserver* observer) {} virtual void SetLocalDescription(SetSessionDescriptionObserver* observer) {}
// Sets the remote session description. // Sets the remote session description.
// The PeerConnection takes the ownership of |desc| even if it fails. //
// The |observer| callback will be called when done. // (Unlike "SDP munging" before SetLocalDescription(), modifying a remote
// TODO(hbos): Remove when Chrome implements the new signature. // offer or answer is allowed by the spec.)
virtual void SetRemoteDescription(SetSessionDescriptionObserver* observer, //
SessionDescriptionInterface* desc) {} // The observer is invoked as soon as the operation completes, which could be
// before or after the SetRemoteDescription() method has exited.
virtual void SetRemoteDescription( virtual void SetRemoteDescription(
std::unique_ptr<SessionDescriptionInterface> desc, std::unique_ptr<SessionDescriptionInterface> desc,
rtc::scoped_refptr<SetRemoteDescriptionObserverInterface> observer) = 0; rtc::scoped_refptr<SetRemoteDescriptionObserverInterface> observer) = 0;
// Like SetRemoteDescription() above, but the observer is invoked with a delay
// after the operation completes. This helps avoid recursive calls by the
// observer but also makes it possible for states to change in-between the
// operation completing and the observer getting called. This makes them racy
// for synchronizing peer connection states to the application.
// TODO(https://crbug.com/webrtc/11798): Delete this method in favor of the
// ones taking SetRemoteDescriptionObserverInterface as argument.
virtual void SetRemoteDescription(SetSessionDescriptionObserver* observer,
SessionDescriptionInterface* desc) {}
// According to spec, we must only fire "negotiationneeded" if the Operations
// Chain is empty. This method takes care of validating an event previously
// generated with PeerConnectionObserver::OnNegotiationNeededEvent() to make
// sure that even if there was a delay (e.g. due to a PostTask) between the
// event being generated and the time of firing, the Operations Chain is empty
// and the event is still valid to be fired.
virtual bool ShouldFireNegotiationNeededEvent(uint32_t event_id) {
return true;
}
virtual PeerConnectionInterface::RTCConfiguration GetConfiguration() = 0; virtual PeerConnectionInterface::RTCConfiguration GetConfiguration() = 0;
@ -1021,10 +1068,13 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
virtual bool RemoveIceCandidates( virtual bool RemoveIceCandidates(
const std::vector<cricket::Candidate>& candidates) = 0; const std::vector<cricket::Candidate>& candidates) = 0;
// RingRTC change to add ICE forking
// Creates an IceGatherer that can be shared/used with UseSharedIceGatherer // Creates an IceGatherer that can be shared/used with UseSharedIceGatherer
virtual rtc::scoped_refptr<webrtc::IceGathererInterface> virtual rtc::scoped_refptr<webrtc::IceGathererInterface>
CreateSharedIceGatherer(); CreateSharedIceGatherer();
// RingRTC change to add ICE forking
// SetGatherer with the same IceGatherer on many ICE transports to get // SetGatherer with the same IceGatherer on many ICE transports to get
// ICE forking behavior. For example, like so: // ICE forking behavior. For example, like so:
// auto gatherer = pc1->CreateSharedIceGatherer(); // auto gatherer = pc1->CreateSharedIceGatherer();
@ -1036,13 +1086,16 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
virtual bool UseSharedIceGatherer( virtual bool UseSharedIceGatherer(
rtc::scoped_refptr<webrtc::IceGathererInterface> shared_ice_gatherer); rtc::scoped_refptr<webrtc::IceGathererInterface> shared_ice_gatherer);
// RingRTC change to RTP from being processed before the call is accepted
// If false, all RTP and RTCP packets will be dropped before being processed. // If false, all RTP and RTCP packets will be dropped before being processed.
virtual bool SetIncomingRtpEnabled(bool enabled); virtual bool SetIncomingRtpEnabled(bool enabled);
// RingRTC change to send RTP data
// Make sure that you don't reuse (SSRC, seqnum) combinations except when rolling // Make sure that you don't reuse (SSRC, seqnum) combinations except when rolling
// over. Otherwise, SRTP won't work properly. // over. Otherwise, SRTP won't work properly.
virtual bool SendRtp(std::unique_ptr<RtpPacket> rtp_packet); virtual bool SendRtp(std::unique_ptr<RtpPacket> rtp_packet);
// RingRTC change to receive RTP data
// Packets will go to the PeerConnectionObserver // Packets will go to the PeerConnectionObserver
virtual bool ReceiveRtp(uint8_t pt); virtual bool ReceiveRtp(uint8_t pt);
@ -1050,15 +1103,6 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
RTC_LOG(LS_WARNING) << "Default PeerConnectionInterface::ConfigureAudioEncoders(...) does nothing!"; RTC_LOG(LS_WARNING) << "Default PeerConnectionInterface::ConfigureAudioEncoders(...) does nothing!";
} }
// 0 <= min <= current <= max should hold for set parameters.
struct BitrateParameters {
BitrateParameters();
~BitrateParameters();
absl::optional<int> min_bitrate_bps;
absl::optional<int> current_bitrate_bps;
absl::optional<int> max_bitrate_bps;
};
// SetBitrate limits the bandwidth allocated for all RTP streams sent by // SetBitrate limits the bandwidth allocated for all RTP streams sent by
// this PeerConnection. Other limitations might affect these limits and // this PeerConnection. Other limitations might affect these limits and
@ -1066,12 +1110,7 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
// //
// Setting |current_bitrate_bps| will reset the current bitrate estimate // Setting |current_bitrate_bps| will reset the current bitrate estimate
// to the provided value. // to the provided value.
virtual RTCError SetBitrate(const BitrateSettings& bitrate); virtual RTCError SetBitrate(const BitrateSettings& bitrate) = 0;
// TODO(nisse): Deprecated - use version above. These two default
// implementations require subclasses to implement one or the other
// of the methods.
virtual RTCError SetBitrate(const BitrateParameters& bitrate_parameters);
// Enable/disable playout of received audio streams. Enabled by default. Note // Enable/disable playout of received audio streams. Enabled by default. Note
// that even if playout is enabled, streams will only be played out if the // that even if playout is enabled, streams will only be played out if the
@ -1155,6 +1194,14 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
// thus the observer object can be safely destroyed. // thus the observer object can be safely destroyed.
virtual void Close() = 0; virtual void Close() = 0;
// The thread on which all PeerConnectionObserver callbacks will be invoked,
// as well as callbacks for other classes such as DataChannelObserver.
//
// Also the only thread on which it's safe to use SessionDescriptionInterface
// pointers.
// TODO(deadbeef): Make pure virtual when all subclasses implement it.
virtual rtc::Thread* signaling_thread() const { return nullptr; }
protected: protected:
// Dtor protected as objects shouldn't be deleted via this interface. // Dtor protected as objects shouldn't be deleted via this interface.
~PeerConnectionInterface() override = default; ~PeerConnectionInterface() override = default;
@ -1183,7 +1230,17 @@ class PeerConnectionObserver : public RtpPacketSinkInterface {
// Triggered when renegotiation is needed. For example, an ICE restart // Triggered when renegotiation is needed. For example, an ICE restart
// has begun. // has begun.
virtual void OnRenegotiationNeeded() = 0; // TODO(hbos): Delete in favor of OnNegotiationNeededEvent() when downstream
// projects have migrated.
virtual void OnRenegotiationNeeded() {}
// Used to fire spec-compliant onnegotiationneeded events, which should only
// fire when the Operations Chain is empty. The observer is responsible for
// queuing a task (e.g. Chromium: jump to main thread) to maybe fire the
// event. The event identified using |event_id| must only fire if
// PeerConnection::ShouldFireNegotiationNeededEvent() returns true since it is
// possible for the event to become invalidated by operations subsequently
// chained.
virtual void OnNegotiationNeededEvent(uint32_t event_id) {}
// Called any time the legacy IceConnectionState changes. // Called any time the legacy IceConnectionState changes.
// //
@ -1347,7 +1404,12 @@ struct RTC_EXPORT PeerConnectionFactoryDependencies final {
std::unique_ptr<NetworkStatePredictorFactoryInterface> std::unique_ptr<NetworkStatePredictorFactoryInterface>
network_state_predictor_factory; network_state_predictor_factory;
std::unique_ptr<NetworkControllerFactoryInterface> network_controller_factory; std::unique_ptr<NetworkControllerFactoryInterface> network_controller_factory;
// This will only be used if CreatePeerConnection is called without a
// |port_allocator|, causing the default allocator and network manager to be
// used.
std::unique_ptr<rtc::NetworkMonitorFactory> network_monitor_factory;
std::unique_ptr<NetEqFactory> neteq_factory; std::unique_ptr<NetEqFactory> neteq_factory;
std::unique_ptr<SctpTransportFactoryInterface> sctp_factory;
std::unique_ptr<WebRtcKeyValueConfig> trials; std::unique_ptr<WebRtcKeyValueConfig> trials;
}; };
@ -1408,6 +1470,12 @@ class RTC_EXPORT PeerConnectionFactoryInterface
// configuration and a PeerConnectionDependencies structure. // configuration and a PeerConnectionDependencies structure.
// TODO(benwright): Make pure virtual once downstream mock PC factory classes // TODO(benwright): Make pure virtual once downstream mock PC factory classes
// are updated. // are updated.
virtual RTCErrorOr<rtc::scoped_refptr<PeerConnectionInterface>>
CreatePeerConnectionOrError(
const PeerConnectionInterface::RTCConfiguration& configuration,
PeerConnectionDependencies dependencies);
// Deprecated creator - does not return an error code on error.
// TODO(bugs.webrtc.org:12238): Deprecate and remove.
virtual rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection( virtual rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection(
const PeerConnectionInterface::RTCConfiguration& configuration, const PeerConnectionInterface::RTCConfiguration& configuration,
PeerConnectionDependencies dependencies); PeerConnectionDependencies dependencies);

View file

@ -96,19 +96,27 @@ PROXY_METHOD2(void,
CreateAnswer, CreateAnswer,
CreateSessionDescriptionObserver*, CreateSessionDescriptionObserver*,
const RTCOfferAnswerOptions&) const RTCOfferAnswerOptions&)
PROXY_METHOD2(void,
SetLocalDescription,
std::unique_ptr<SessionDescriptionInterface>,
rtc::scoped_refptr<SetLocalDescriptionObserverInterface>)
PROXY_METHOD1(void,
SetLocalDescription,
rtc::scoped_refptr<SetLocalDescriptionObserverInterface>)
PROXY_METHOD2(void, PROXY_METHOD2(void,
SetLocalDescription, SetLocalDescription,
SetSessionDescriptionObserver*, SetSessionDescriptionObserver*,
SessionDescriptionInterface*) SessionDescriptionInterface*)
PROXY_METHOD1(void, SetLocalDescription, SetSessionDescriptionObserver*) PROXY_METHOD1(void, SetLocalDescription, SetSessionDescriptionObserver*)
PROXY_METHOD2(void,
SetRemoteDescription,
SetSessionDescriptionObserver*,
SessionDescriptionInterface*)
PROXY_METHOD2(void, PROXY_METHOD2(void,
SetRemoteDescription, SetRemoteDescription,
std::unique_ptr<SessionDescriptionInterface>, std::unique_ptr<SessionDescriptionInterface>,
rtc::scoped_refptr<SetRemoteDescriptionObserverInterface>) rtc::scoped_refptr<SetRemoteDescriptionObserverInterface>)
PROXY_METHOD2(void,
SetRemoteDescription,
SetSessionDescriptionObserver*,
SessionDescriptionInterface*)
PROXY_METHOD1(bool, ShouldFireNegotiationNeededEvent, uint32_t)
PROXY_METHOD0(PeerConnectionInterface::RTCConfiguration, GetConfiguration) PROXY_METHOD0(PeerConnectionInterface::RTCConfiguration, GetConfiguration)
PROXY_METHOD1(RTCError, PROXY_METHOD1(RTCError,
SetConfiguration, SetConfiguration,
@ -155,6 +163,7 @@ PROXY_METHOD2(bool,
PROXY_METHOD1(bool, StartRtcEventLog, std::unique_ptr<RtcEventLogOutput>) PROXY_METHOD1(bool, StartRtcEventLog, std::unique_ptr<RtcEventLogOutput>)
PROXY_METHOD0(void, StopRtcEventLog) PROXY_METHOD0(void, StopRtcEventLog)
PROXY_METHOD0(void, Close) PROXY_METHOD0(void, Close)
BYPASS_PROXY_CONSTMETHOD0(rtc::Thread*, signaling_thread)
END_PROXY_MAP() END_PROXY_MAP()
} // namespace webrtc } // namespace webrtc

View file

@ -10,28 +10,3 @@
#include "api/proxy.h" #include "api/proxy.h"
namespace webrtc {
namespace internal {
SynchronousMethodCall::SynchronousMethodCall(rtc::MessageHandler* proxy)
: proxy_(proxy) {}
SynchronousMethodCall::~SynchronousMethodCall() = default;
void SynchronousMethodCall::Invoke(const rtc::Location& posted_from,
rtc::Thread* t) {
if (t->IsCurrent()) {
proxy_->OnMessage(nullptr);
} else {
t->Post(posted_from, this, 0);
e_.Wait(rtc::Event::kForever);
}
}
void SynchronousMethodCall::OnMessage(rtc::Message*) {
proxy_->OnMessage(nullptr);
e_.Set();
}
} // namespace internal
} // namespace webrtc

View file

@ -59,6 +59,8 @@
#include <utility> #include <utility>
#include "api/scoped_refptr.h" #include "api/scoped_refptr.h"
#include "api/task_queue/queued_task.h"
#include "api/task_queue/task_queue_base.h"
#include "rtc_base/event.h" #include "rtc_base/event.h"
#include "rtc_base/message_handler.h" #include "rtc_base/message_handler.h"
#include "rtc_base/ref_counted_object.h" #include "rtc_base/ref_counted_object.h"
@ -96,27 +98,8 @@ class ReturnType<void> {
void moved_result() {} void moved_result() {}
}; };
namespace internal {
class RTC_EXPORT SynchronousMethodCall : public rtc::MessageData,
public rtc::MessageHandler {
public:
explicit SynchronousMethodCall(rtc::MessageHandler* proxy);
~SynchronousMethodCall() override;
void Invoke(const rtc::Location& posted_from, rtc::Thread* t);
private:
void OnMessage(rtc::Message*) override;
rtc::Event e_;
rtc::MessageHandler* proxy_;
};
} // namespace internal
template <typename C, typename R, typename... Args> template <typename C, typename R, typename... Args>
class MethodCall : public rtc::Message, public rtc::MessageHandler { class MethodCall : public QueuedTask {
public: public:
typedef R (C::*Method)(Args...); typedef R (C::*Method)(Args...);
MethodCall(C* c, Method m, Args&&... args) MethodCall(C* c, Method m, Args&&... args)
@ -125,12 +108,21 @@ class MethodCall : public rtc::Message, public rtc::MessageHandler {
args_(std::forward_as_tuple(std::forward<Args>(args)...)) {} args_(std::forward_as_tuple(std::forward<Args>(args)...)) {}
R Marshal(const rtc::Location& posted_from, rtc::Thread* t) { R Marshal(const rtc::Location& posted_from, rtc::Thread* t) {
internal::SynchronousMethodCall(this).Invoke(posted_from, t); if (t->IsCurrent()) {
Invoke(std::index_sequence_for<Args...>());
} else {
t->PostTask(std::unique_ptr<QueuedTask>(this));
event_.Wait(rtc::Event::kForever);
}
return r_.moved_result(); return r_.moved_result();
} }
private: private:
void OnMessage(rtc::Message*) { Invoke(std::index_sequence_for<Args...>()); } bool Run() override {
Invoke(std::index_sequence_for<Args...>());
event_.Set();
return false;
}
template <size_t... Is> template <size_t... Is>
void Invoke(std::index_sequence<Is...>) { void Invoke(std::index_sequence<Is...>) {
@ -141,10 +133,11 @@ class MethodCall : public rtc::Message, public rtc::MessageHandler {
Method m_; Method m_;
ReturnType<R> r_; ReturnType<R> r_;
std::tuple<Args&&...> args_; std::tuple<Args&&...> args_;
rtc::Event event_;
}; };
template <typename C, typename R, typename... Args> template <typename C, typename R, typename... Args>
class ConstMethodCall : public rtc::Message, public rtc::MessageHandler { class ConstMethodCall : public QueuedTask {
public: public:
typedef R (C::*Method)(Args...) const; typedef R (C::*Method)(Args...) const;
ConstMethodCall(const C* c, Method m, Args&&... args) ConstMethodCall(const C* c, Method m, Args&&... args)
@ -153,12 +146,21 @@ class ConstMethodCall : public rtc::Message, public rtc::MessageHandler {
args_(std::forward_as_tuple(std::forward<Args>(args)...)) {} args_(std::forward_as_tuple(std::forward<Args>(args)...)) {}
R Marshal(const rtc::Location& posted_from, rtc::Thread* t) { R Marshal(const rtc::Location& posted_from, rtc::Thread* t) {
internal::SynchronousMethodCall(this).Invoke(posted_from, t); if (t->IsCurrent()) {
Invoke(std::index_sequence_for<Args...>());
} else {
t->PostTask(std::unique_ptr<QueuedTask>(this));
event_.Wait(rtc::Event::kForever);
}
return r_.moved_result(); return r_.moved_result();
} }
private: private:
void OnMessage(rtc::Message*) { Invoke(std::index_sequence_for<Args...>()); } bool Run() override {
Invoke(std::index_sequence_for<Args...>());
event_.Set();
return false;
}
template <size_t... Is> template <size_t... Is>
void Invoke(std::index_sequence<Is...>) { void Invoke(std::index_sequence<Is...>) {
@ -169,6 +171,7 @@ class ConstMethodCall : public rtc::Message, public rtc::MessageHandler {
Method m_; Method m_;
ReturnType<R> r_; ReturnType<R> r_;
std::tuple<Args&&...> args_; std::tuple<Args&&...> args_;
rtc::Event event_;
}; };
// Helper macros to reduce code duplication. // Helper macros to reduce code duplication.
@ -400,11 +403,13 @@ class ConstMethodCall : public rtc::Message, public rtc::MessageHandler {
// For use when returning purely const state (set during construction). // For use when returning purely const state (set during construction).
// Use with caution. This method should only be used when the return value will // Use with caution. This method should only be used when the return value will
// always be the same. // always be the same.
#define BYPASS_PROXY_CONSTMETHOD0(r, method) \ #define BYPASS_PROXY_CONSTMETHOD0(r, method) \
r method() const override { \ r method() const override { \
static_assert(!std::is_pointer<r>::value, "Type is a pointer"); \ static_assert( \
static_assert(!std::is_reference<r>::value, "Type is a reference"); \ std::is_same<r, rtc::Thread*>::value || !std::is_pointer<r>::value, \
return c_->method(); \ "Type is a pointer"); \
static_assert(!std::is_reference<r>::value, "Type is a reference"); \
return c_->method(); \
} }
} // namespace webrtc } // namespace webrtc

View file

@ -11,9 +11,9 @@
#ifndef API_RTC_ERROR_H_ #ifndef API_RTC_ERROR_H_
#define API_RTC_ERROR_H_ #define API_RTC_ERROR_H_
#ifdef UNIT_TEST #ifdef WEBRTC_UNIT_TEST
#include <ostream> #include <ostream>
#endif // UNIT_TEST #endif // WEBRTC_UNIT_TEST
#include <string> #include <string>
#include <utility> // For std::move. #include <utility> // For std::move.
@ -137,7 +137,7 @@ class RTC_EXPORT RTCError {
RTCErrorDetailType error_detail() const { return error_detail_; } RTCErrorDetailType error_detail() const { return error_detail_; }
void set_error_detail(RTCErrorDetailType detail) { error_detail_ = detail; } void set_error_detail(RTCErrorDetailType detail) { error_detail_ = detail; }
absl::optional<uint16_t> sctp_cause_code() { return sctp_cause_code_; } absl::optional<uint16_t> sctp_cause_code() const { return sctp_cause_code_; }
void set_sctp_cause_code(uint16_t cause_code) { void set_sctp_cause_code(uint16_t cause_code) {
sctp_cause_code_ = cause_code; sctp_cause_code_ = cause_code;
} }
@ -161,7 +161,7 @@ class RTC_EXPORT RTCError {
RTC_EXPORT const char* ToString(RTCErrorType error); RTC_EXPORT const char* ToString(RTCErrorType error);
RTC_EXPORT const char* ToString(RTCErrorDetailType error); RTC_EXPORT const char* ToString(RTCErrorDetailType error);
#ifdef UNIT_TEST #ifdef WEBRTC_UNIT_TEST
inline std::ostream& operator<<( // no-presubmit-check TODO(webrtc:8982) inline std::ostream& operator<<( // no-presubmit-check TODO(webrtc:8982)
std::ostream& stream, // no-presubmit-check TODO(webrtc:8982) std::ostream& stream, // no-presubmit-check TODO(webrtc:8982)
RTCErrorType error) { RTCErrorType error) {
@ -173,7 +173,7 @@ inline std::ostream& operator<<( // no-presubmit-check TODO(webrtc:8982)
RTCErrorDetailType error) { RTCErrorDetailType error) {
return stream << ToString(error); return stream << ToString(error);
} }
#endif // UNIT_TEST #endif // WEBRTC_UNIT_TEST
// Helper macro that can be used by implementations to create an error with a // 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 // message and log it. |message| should be a string literal or movable

View file

@ -37,6 +37,7 @@ rtc_library("rtc_event_log_factory") {
":rtc_event_log", ":rtc_event_log",
"../../rtc_base:checks", "../../rtc_base:checks",
"../../rtc_base/system:rtc_export", "../../rtc_base/system:rtc_export",
"../../system_wrappers:field_trial",
"../task_queue", "../task_queue",
] ]

View file

@ -52,7 +52,8 @@ class RtcEvent {
VideoSendStreamConfig, VideoSendStreamConfig,
GenericPacketSent, GenericPacketSent,
GenericPacketReceived, GenericPacketReceived,
GenericAckReceived GenericAckReceived,
FrameDecoded
}; };
RtcEvent(); RtcEvent();

View file

@ -14,6 +14,7 @@
#include <utility> #include <utility>
#include "rtc_base/checks.h" #include "rtc_base/checks.h"
#include "system_wrappers/include/field_trial.h"
#ifdef WEBRTC_ENABLE_RTC_EVENT_LOG #ifdef WEBRTC_ENABLE_RTC_EVENT_LOG
#include "logging/rtc_event_log/rtc_event_log_impl.h" #include "logging/rtc_event_log/rtc_event_log_impl.h"
@ -29,6 +30,9 @@ RtcEventLogFactory::RtcEventLogFactory(TaskQueueFactory* task_queue_factory)
std::unique_ptr<RtcEventLog> RtcEventLogFactory::CreateRtcEventLog( std::unique_ptr<RtcEventLog> RtcEventLogFactory::CreateRtcEventLog(
RtcEventLog::EncodingType encoding_type) { RtcEventLog::EncodingType encoding_type) {
#ifdef WEBRTC_ENABLE_RTC_EVENT_LOG #ifdef WEBRTC_ENABLE_RTC_EVENT_LOG
if (field_trial::IsEnabled("WebRTC-RtcEventLogKillSwitch")) {
return std::make_unique<RtcEventLogNull>();
}
return std::make_unique<RtcEventLogImpl>(encoding_type, task_queue_factory_); return std::make_unique<RtcEventLogImpl>(encoding_type, task_queue_factory_);
#else #else
return std::make_unique<RtcEventLogNull>(); return std::make_unique<RtcEventLogNull>();

View file

@ -23,7 +23,6 @@
#include "api/video/video_content_type.h" #include "api/video/video_content_type.h"
#include "api/video/video_rotation.h" #include "api/video/video_rotation.h"
#include "api/video/video_timing.h" #include "api/video/video_timing.h"
#include "common_types.h" // NOLINT (build/include)
namespace webrtc { namespace webrtc {
@ -142,7 +141,7 @@ struct RTPHeaderExtension {
bool has_video_timing; bool has_video_timing;
VideoSendTiming video_timing; VideoSendTiming video_timing;
PlayoutDelay playout_delay = {-1, -1}; VideoPlayoutDelay playout_delay;
// For identification of a stream when ssrc is not signaled. See // For identification of a stream when ssrc is not signaled. See
// https://tools.ietf.org/html/draft-ietf-avtext-rid-09 // https://tools.ietf.org/html/draft-ietf-avtext-rid-09

View file

@ -30,6 +30,7 @@ const char* DegradationPreferenceToString(
case DegradationPreference::BALANCED: case DegradationPreference::BALANCED:
return "balanced"; return "balanced";
} }
RTC_CHECK_NOTREACHED();
} }
const double kDefaultBitratePriority = 1.0; const double kDefaultBitratePriority = 1.0;
@ -121,6 +122,7 @@ constexpr char RtpExtension::kVideoContentTypeUri[];
constexpr char RtpExtension::kVideoTimingUri[]; constexpr char RtpExtension::kVideoTimingUri[];
constexpr char RtpExtension::kGenericFrameDescriptorUri00[]; constexpr char RtpExtension::kGenericFrameDescriptorUri00[];
constexpr char RtpExtension::kDependencyDescriptorUri[]; constexpr char RtpExtension::kDependencyDescriptorUri[];
constexpr char RtpExtension::kVideoLayersAllocationUri[];
constexpr char RtpExtension::kTransportSequenceNumberUri[]; constexpr char RtpExtension::kTransportSequenceNumberUri[];
constexpr char RtpExtension::kTransportSequenceNumberV2Uri[]; constexpr char RtpExtension::kTransportSequenceNumberV2Uri[];
constexpr char RtpExtension::kPlayoutDelayUri[]; constexpr char RtpExtension::kPlayoutDelayUri[];
@ -161,7 +163,8 @@ bool RtpExtension::IsSupportedForVideo(absl::string_view uri) {
uri == webrtc::RtpExtension::kDependencyDescriptorUri || uri == webrtc::RtpExtension::kDependencyDescriptorUri ||
uri == webrtc::RtpExtension::kColorSpaceUri || uri == webrtc::RtpExtension::kColorSpaceUri ||
uri == webrtc::RtpExtension::kRidUri || uri == webrtc::RtpExtension::kRidUri ||
uri == webrtc::RtpExtension::kRepairedRidUri; uri == webrtc::RtpExtension::kRepairedRidUri ||
uri == webrtc::RtpExtension::kVideoLayersAllocationUri;
} }
bool RtpExtension::IsEncryptionSupported(absl::string_view uri) { bool RtpExtension::IsEncryptionSupported(absl::string_view uri) {
@ -183,7 +186,8 @@ bool RtpExtension::IsEncryptionSupported(absl::string_view uri) {
uri == webrtc::RtpExtension::kVideoContentTypeUri || uri == webrtc::RtpExtension::kVideoContentTypeUri ||
uri == webrtc::RtpExtension::kMidUri || uri == webrtc::RtpExtension::kMidUri ||
uri == webrtc::RtpExtension::kRidUri || uri == webrtc::RtpExtension::kRidUri ||
uri == webrtc::RtpExtension::kRepairedRidUri; uri == webrtc::RtpExtension::kRepairedRidUri ||
uri == webrtc::RtpExtension::kVideoLayersAllocationUri;
} }
const RtpExtension* RtpExtension::FindHeaderExtensionByUri( const RtpExtension* RtpExtension::FindHeaderExtensionByUri(

View file

@ -318,6 +318,10 @@ struct RTC_EXPORT RtpExtension {
"https://aomediacodec.github.io/av1-rtp-spec/" "https://aomediacodec.github.io/av1-rtp-spec/"
"#dependency-descriptor-rtp-header-extension"; "#dependency-descriptor-rtp-header-extension";
// Experimental extension for signalling target bitrate per layer.
static constexpr char kVideoLayersAllocationUri[] =
"http://www.webrtc.org/experiments/rtp-hdrext/video-layers-allocation00";
// Header extension for transport sequence number, see url for details: // Header extension for transport sequence number, see url for details:
// http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions // http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions
static constexpr char kTransportSequenceNumberUri[] = static constexpr char kTransportSequenceNumberUri[] =
@ -461,6 +465,9 @@ struct RTC_EXPORT RtpEncodingParameters {
// For video, scale the resolution down by this factor. // For video, scale the resolution down by this factor.
absl::optional<double> scale_resolution_down_by; absl::optional<double> scale_resolution_down_by;
// https://w3c.github.io/webrtc-svc/#rtcrtpencodingparameters
absl::optional<std::string> scalability_mode;
// For an RtpSender, set to true to cause this encoding to be encoded and // For an RtpSender, set to true to cause this encoding to be encoded and
// sent, and false for it not to be encoded and sent. This allows control // sent, and false for it not to be encoded and sent. This allows control
// across multiple encodings of a sender for turning simulcast layers on and // across multiple encodings of a sender for turning simulcast layers on and

View file

@ -128,8 +128,8 @@ PROXY_CONSTMETHOD0(rtc::scoped_refptr<DtlsTransportInterface>, dtls_transport)
PROXY_CONSTMETHOD0(std::vector<std::string>, stream_ids) PROXY_CONSTMETHOD0(std::vector<std::string>, stream_ids)
PROXY_CONSTMETHOD0(std::vector<rtc::scoped_refptr<MediaStreamInterface>>, PROXY_CONSTMETHOD0(std::vector<rtc::scoped_refptr<MediaStreamInterface>>,
streams) streams)
PROXY_CONSTMETHOD0(cricket::MediaType, media_type) BYPASS_PROXY_CONSTMETHOD0(cricket::MediaType, media_type)
PROXY_CONSTMETHOD0(std::string, id) BYPASS_PROXY_CONSTMETHOD0(std::string, id)
PROXY_CONSTMETHOD0(RtpParameters, GetParameters) PROXY_CONSTMETHOD0(RtpParameters, GetParameters)
PROXY_METHOD1(void, SetObserver, RtpReceiverObserverInterface*) PROXY_METHOD1(void, SetObserver, RtpReceiverObserverInterface*)
PROXY_METHOD1(void, SetJitterBufferMinimumDelay, absl::optional<double>) PROXY_METHOD1(void, SetJitterBufferMinimumDelay, absl::optional<double>)

View file

@ -110,8 +110,8 @@ PROXY_METHOD1(bool, SetTrack, MediaStreamTrackInterface*)
PROXY_CONSTMETHOD0(rtc::scoped_refptr<MediaStreamTrackInterface>, track) PROXY_CONSTMETHOD0(rtc::scoped_refptr<MediaStreamTrackInterface>, track)
PROXY_CONSTMETHOD0(rtc::scoped_refptr<DtlsTransportInterface>, dtls_transport) PROXY_CONSTMETHOD0(rtc::scoped_refptr<DtlsTransportInterface>, dtls_transport)
PROXY_CONSTMETHOD0(uint32_t, ssrc) PROXY_CONSTMETHOD0(uint32_t, ssrc)
PROXY_CONSTMETHOD0(cricket::MediaType, media_type) BYPASS_PROXY_CONSTMETHOD0(cricket::MediaType, media_type)
PROXY_CONSTMETHOD0(std::string, id) BYPASS_PROXY_CONSTMETHOD0(std::string, id)
PROXY_CONSTMETHOD0(std::vector<std::string>, stream_ids) PROXY_CONSTMETHOD0(std::vector<std::string>, stream_ids)
PROXY_CONSTMETHOD0(std::vector<RtpEncodingParameters>, init_send_encodings) PROXY_CONSTMETHOD0(std::vector<RtpEncodingParameters>, init_send_encodings)
PROXY_CONSTMETHOD0(RtpParameters, GetParameters) PROXY_CONSTMETHOD0(RtpParameters, GetParameters)

View file

@ -25,6 +25,23 @@ RtpTransceiverInterface::fired_direction() const {
return absl::nullopt; return absl::nullopt;
} }
bool RtpTransceiverInterface::stopping() const {
return false;
}
void RtpTransceiverInterface::Stop() {
StopInternal();
}
RTCError RtpTransceiverInterface::StopStandard() {
RTC_NOTREACHED() << "DEBUG: RtpTransceiverInterface::StopStandard called";
return RTCError::OK();
}
void RtpTransceiverInterface::StopInternal() {
RTC_NOTREACHED() << "DEBUG: RtpTransceiverInterface::StopInternal called";
}
RTCError RtpTransceiverInterface::SetCodecPreferences( RTCError RtpTransceiverInterface::SetCodecPreferences(
rtc::ArrayView<RtpCodecCapability>) { rtc::ArrayView<RtpCodecCapability>) {
RTC_NOTREACHED() << "Not implemented"; RTC_NOTREACHED() << "Not implemented";
@ -47,4 +64,22 @@ webrtc::RTCError RtpTransceiverInterface::SetOfferedRtpHeaderExtensions(
return webrtc::RTCError(webrtc::RTCErrorType::UNSUPPORTED_OPERATION); return webrtc::RTCError(webrtc::RTCErrorType::UNSUPPORTED_OPERATION);
} }
std::vector<RtpHeaderExtensionCapability>
RtpTransceiverInterface::HeaderExtensionsNegotiated() const {
return {};
}
// TODO(bugs.webrtc.org/11839) Remove default implementations when clients
// are updated.
void RtpTransceiverInterface::SetDirection(
RtpTransceiverDirection new_direction) {
SetDirectionWithError(new_direction);
}
RTCError RtpTransceiverInterface::SetDirectionWithError(
RtpTransceiverDirection new_direction) {
RTC_NOTREACHED() << "Default implementation called";
return RTCError::OK();
}
} // namespace webrtc } // namespace webrtc

View file

@ -89,6 +89,16 @@ class RTC_EXPORT RtpTransceiverInterface : public rtc::RefCountInterface {
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-stopped // https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-stopped
virtual bool stopped() const = 0; virtual bool stopped() const = 0;
// The stopping attribute indicates that the user has indicated that the
// sender of this transceiver will stop sending, and that the receiver will
// no longer receive. It is always true if stopped() is true.
// If stopping() is true and stopped() is false, it means that the
// transceiver's stop() method has been called, but the negotiation with
// the other end for shutting down the transceiver is not yet done.
// https://w3c.github.io/webrtc-pc/#dfn-stopping-0
// TODO(hta): Remove default implementation.
virtual bool stopping() const;
// The direction attribute indicates the preferred direction of this // The direction attribute indicates the preferred direction of this
// transceiver, which will be used in calls to CreateOffer and CreateAnswer. // transceiver, which will be used in calls to CreateOffer and CreateAnswer.
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-direction // https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-direction
@ -99,7 +109,11 @@ class RTC_EXPORT RtpTransceiverInterface : public rtc::RefCountInterface {
// CreateOffer and CreateAnswer mark the corresponding media descriptions as // CreateOffer and CreateAnswer mark the corresponding media descriptions as
// sendrecv, sendonly, recvonly, or inactive. // sendrecv, sendonly, recvonly, or inactive.
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-direction // https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-direction
virtual void SetDirection(RtpTransceiverDirection new_direction) = 0; // TODO(hta): Deprecate SetDirection without error and rename
// SetDirectionWithError to SetDirection, remove default implementations.
RTC_DEPRECATED virtual void SetDirection(
RtpTransceiverDirection new_direction);
virtual RTCError SetDirectionWithError(RtpTransceiverDirection new_direction);
// The current_direction attribute indicates the current direction negotiated // The current_direction attribute indicates the current direction negotiated
// for this transceiver. If this transceiver has never been represented in an // for this transceiver. If this transceiver has never been represented in an
@ -114,10 +128,19 @@ class RTC_EXPORT RtpTransceiverInterface : public rtc::RefCountInterface {
// Exposed in the public interface for use by Chromium. // Exposed in the public interface for use by Chromium.
virtual absl::optional<RtpTransceiverDirection> fired_direction() const; virtual absl::optional<RtpTransceiverDirection> fired_direction() const;
// The Stop method irreversibly stops the RtpTransceiver. The sender of this // Initiates a stop of the transceiver.
// transceiver will no longer send, the receiver will no longer receive. // The stop is complete when stopped() returns true.
// A stopped transceiver can be reused for a different track.
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-stop // https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-stop
virtual void Stop() = 0; // TODO(hta): Rename to Stop() when users of the non-standard Stop() are
// updated.
virtual RTCError StopStandard();
// Stops a transceiver immediately, without waiting for signalling.
// This is an internal function, and is exposed for historical reasons.
// https://w3c.github.io/webrtc-pc/#dfn-stop-the-rtcrtptransceiver
virtual void StopInternal();
RTC_DEPRECATED virtual void Stop();
// The SetCodecPreferences method overrides the default codec preferences used // The SetCodecPreferences method overrides the default codec preferences used
// by WebRTC for this transceiver. // by WebRTC for this transceiver.
@ -133,6 +156,12 @@ class RTC_EXPORT RtpTransceiverInterface : public rtc::RefCountInterface {
virtual std::vector<RtpHeaderExtensionCapability> HeaderExtensionsToOffer() virtual std::vector<RtpHeaderExtensionCapability> HeaderExtensionsToOffer()
const; const;
// Readonly attribute which is either empty if negotation has not yet
// happened, or a vector of the negotiated header extensions.
// https://w3c.github.io/webrtc-extensions/#rtcrtptransceiver-interface
virtual std::vector<RtpHeaderExtensionCapability> HeaderExtensionsNegotiated()
const;
// The SetOfferedRtpHeaderExtensions method modifies the next SDP negotiation // The SetOfferedRtpHeaderExtensions method modifies the next SDP negotiation
// so that it negotiates use of header extensions which are not kStopped. // so that it negotiates use of header extensions which are not kStopped.
// https://w3c.github.io/webrtc-extensions/#rtcrtptransceiver-interface // https://w3c.github.io/webrtc-extensions/#rtcrtptransceiver-interface

View file

@ -0,0 +1,30 @@
/*
* Copyright 2020 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef API_SET_LOCAL_DESCRIPTION_OBSERVER_INTERFACE_H_
#define API_SET_LOCAL_DESCRIPTION_OBSERVER_INTERFACE_H_
#include "api/rtc_error.h"
#include "rtc_base/ref_count.h"
namespace webrtc {
// OnSetLocalDescriptionComplete() invokes as soon as
// PeerConnectionInterface::SetLocalDescription() operation completes, allowing
// the observer to examine the effects of the operation without delay.
class SetLocalDescriptionObserverInterface : public rtc::RefCountInterface {
public:
// On success, |error.ok()| is true.
virtual void OnSetLocalDescriptionComplete(RTCError error) = 0;
};
} // namespace webrtc
#endif // API_SET_LOCAL_DESCRIPTION_OBSERVER_INTERFACE_H_

View file

@ -84,8 +84,8 @@ class RTC_EXPORT RTCStatsReport : public rtc::RefCountInterface {
// Removes the stats object from the report, returning ownership of it or null // Removes the stats object from the report, returning ownership of it or null
// if there is no object with |id|. // if there is no object with |id|.
std::unique_ptr<const RTCStats> Take(const std::string& id); std::unique_ptr<const RTCStats> Take(const std::string& id);
// Takes ownership of all the stats in |victim|, leaving it empty. // Takes ownership of all the stats in |other|, leaving it empty.
void TakeMembersFrom(rtc::scoped_refptr<RTCStatsReport> victim); void TakeMembersFrom(rtc::scoped_refptr<RTCStatsReport> other);
// Stats iterators. Stats are ordered lexicographically on |RTCStats::id|. // Stats iterators. Stats are ordered lexicographically on |RTCStats::id|.
ConstIterator begin() const; ConstIterator begin() const;

View file

@ -115,6 +115,7 @@ class RTC_EXPORT RTCCodecStats final : public RTCStats {
RTCCodecStats(const RTCCodecStats& other); RTCCodecStats(const RTCCodecStats& other);
~RTCCodecStats() override; ~RTCCodecStats() override;
RTCStatsMember<std::string> transport_id;
RTCStatsMember<uint32_t> payload_type; RTCStatsMember<uint32_t> payload_type;
RTCStatsMember<std::string> mime_type; RTCStatsMember<std::string> mime_type;
RTCStatsMember<uint32_t> clock_rate; RTCStatsMember<uint32_t> clock_rate;
@ -419,6 +420,18 @@ class RTC_EXPORT RTCInboundRTPStreamStats final : public RTCRTPStreamStats {
// TODO(hbos): Collect and populate this value for both "audio" and "video", // TODO(hbos): Collect and populate this value for both "audio" and "video",
// currently not collected for "video". https://bugs.webrtc.org/7065 // currently not collected for "video". https://bugs.webrtc.org/7065
RTCStatsMember<double> jitter; RTCStatsMember<double> jitter;
RTCStatsMember<double> jitter_buffer_delay;
RTCStatsMember<uint64_t> jitter_buffer_emitted_count;
RTCStatsMember<uint64_t> total_samples_received;
RTCStatsMember<uint64_t> concealed_samples;
RTCStatsMember<uint64_t> silent_concealed_samples;
RTCStatsMember<uint64_t> concealment_events;
RTCStatsMember<uint64_t> inserted_samples_for_deceleration;
RTCStatsMember<uint64_t> removed_samples_for_acceleration;
RTCStatsMember<double> audio_level;
RTCStatsMember<double> total_audio_energy;
RTCStatsMember<double> total_samples_duration;
RTCStatsMember<int32_t> frames_received;
// TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
RTCStatsMember<double> round_trip_time; RTCStatsMember<double> round_trip_time;
// TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
@ -441,8 +454,13 @@ class RTC_EXPORT RTCInboundRTPStreamStats final : public RTCRTPStreamStats {
RTCStatsMember<double> gap_loss_rate; RTCStatsMember<double> gap_loss_rate;
// TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065 // TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
RTCStatsMember<double> gap_discard_rate; RTCStatsMember<double> gap_discard_rate;
RTCStatsMember<uint32_t> frame_width;
RTCStatsMember<uint32_t> frame_height;
RTCStatsMember<uint32_t> frame_bit_depth;
RTCStatsMember<double> frames_per_second;
RTCStatsMember<uint32_t> frames_decoded; RTCStatsMember<uint32_t> frames_decoded;
RTCStatsMember<uint32_t> key_frames_decoded; RTCStatsMember<uint32_t> key_frames_decoded;
RTCStatsMember<uint32_t> frames_dropped;
RTCStatsMember<double> total_decode_time; RTCStatsMember<double> total_decode_time;
RTCStatsMember<double> total_inter_frame_delay; RTCStatsMember<double> total_inter_frame_delay;
RTCStatsMember<double> total_squared_inter_frame_delay; RTCStatsMember<double> total_squared_inter_frame_delay;
@ -602,7 +620,9 @@ class RTC_EXPORT RTCTransportStats final : public RTCStats {
~RTCTransportStats() override; ~RTCTransportStats() override;
RTCStatsMember<uint64_t> bytes_sent; RTCStatsMember<uint64_t> bytes_sent;
RTCStatsMember<uint64_t> packets_sent;
RTCStatsMember<uint64_t> bytes_received; RTCStatsMember<uint64_t> bytes_received;
RTCStatsMember<uint64_t> packets_received;
RTCStatsMember<std::string> rtcp_transport_stats_id; RTCStatsMember<std::string> rtcp_transport_stats_id;
// TODO(hbos): Support enum types? "RTCStatsMember<RTCDtlsTransportState>"? // TODO(hbos): Support enum types? "RTCStatsMember<RTCDtlsTransportState>"?
RTCStatsMember<std::string> dtls_state; RTCStatsMember<std::string> dtls_state;

View file

@ -11,12 +11,6 @@ specific_include_rules = {
"fake_constraints\.h": [ "fake_constraints\.h": [
"+rtc_base/string_encode.h", "+rtc_base/string_encode.h",
], ],
"loopback_media_transport\.h": [
"+rtc_base/async_invoker.h",
"+rtc_base/critical_section.h",
"+rtc_base/thread.h",
"+rtc_base/thread_checker.h",
],
"neteq_factory_with_codecs\.h": [ "neteq_factory_with_codecs\.h": [
"+system_wrappers/include/clock.h", "+system_wrappers/include/clock.h",
], ],
@ -41,4 +35,7 @@ specific_include_rules = {
"create_frame_generator\.h": [ "create_frame_generator\.h": [
"+system_wrappers/include/clock.h", "+system_wrappers/include/clock.h",
], ],
"videocodec_test_fixture\.h": [
"+media/base/h264_profile_level_id.h"
],
} }

View file

@ -1,2 +1,5 @@
mbonadei@webrtc.org
sprang@webrtc.org
srte@webrtc.org srte@webrtc.org
titovartem@webrtc.org

View file

@ -14,7 +14,7 @@
#include <string> #include <string>
#include "api/test/stats_observer_interface.h" #include "api/test/stats_observer_interface.h"
#include "api/test/track_id_stream_label_map.h" #include "api/test/track_id_stream_info_map.h"
namespace webrtc { namespace webrtc {
namespace webrtc_pc_e2e { namespace webrtc_pc_e2e {
@ -31,7 +31,7 @@ class AudioQualityAnalyzerInterface : public StatsObserverInterface {
// stream_id matching. The caller is responsible for ensuring the // stream_id matching. The caller is responsible for ensuring the
// AnalyzerHelper outlives the instance of the AudioQualityAnalyzerInterface. // AnalyzerHelper outlives the instance of the AudioQualityAnalyzerInterface.
virtual void Start(std::string test_case_name, virtual void Start(std::string test_case_name,
TrackIdStreamLabelMap* analyzer_helper) = 0; TrackIdStreamInfoMap* analyzer_helper) = 0;
// Will be called by the framework at the end of the test. The analyzer // Will be called by the framework at the end of the test. The analyzer
// has to finalize all its stats and it should report them. // has to finalize all its stats and it should report them.

View file

@ -27,13 +27,17 @@
// "api/test/videocodec_test_fixture.h" // "api/test/videocodec_test_fixture.h"
// "api/test/videocodec_test_stats.h" // "api/test/videocodec_test_stats.h"
#include "api/test/dummy_peer_connection.h"
#include "api/test/fake_frame_decryptor.h" #include "api/test/fake_frame_decryptor.h"
#include "api/test/fake_frame_encryptor.h" #include "api/test/fake_frame_encryptor.h"
#include "api/test/mock_audio_mixer.h" #include "api/test/mock_audio_mixer.h"
#include "api/test/mock_data_channel.h"
#include "api/test/mock_frame_decryptor.h" #include "api/test/mock_frame_decryptor.h"
#include "api/test/mock_frame_encryptor.h" #include "api/test/mock_frame_encryptor.h"
#include "api/test/mock_media_stream_interface.h"
#include "api/test/mock_peer_connection_factory_interface.h" #include "api/test/mock_peer_connection_factory_interface.h"
#include "api/test/mock_peerconnectioninterface.h" #include "api/test/mock_peerconnectioninterface.h"
#include "api/test/mock_rtp_transceiver.h"
#include "api/test/mock_rtpreceiver.h" #include "api/test/mock_rtpreceiver.h"
#include "api/test/mock_rtpsender.h" #include "api/test/mock_rtpsender.h"
#include "api/test/mock_transformable_video_frame.h" #include "api/test/mock_transformable_video_frame.h"

View file

@ -13,6 +13,7 @@
#include <memory> #include <memory>
#include <utility> #include <utility>
#include "api/test/time_controller.h"
#include "test/pc/e2e/peer_connection_quality_test.h" #include "test/pc/e2e/peer_connection_quality_test.h"
namespace webrtc { namespace webrtc {
@ -21,11 +22,12 @@ namespace webrtc_pc_e2e {
std::unique_ptr<PeerConnectionE2EQualityTestFixture> std::unique_ptr<PeerConnectionE2EQualityTestFixture>
CreatePeerConnectionE2EQualityTestFixture( CreatePeerConnectionE2EQualityTestFixture(
std::string test_case_name, std::string test_case_name,
TimeController& time_controller,
std::unique_ptr<AudioQualityAnalyzerInterface> audio_quality_analyzer, std::unique_ptr<AudioQualityAnalyzerInterface> audio_quality_analyzer,
std::unique_ptr<VideoQualityAnalyzerInterface> video_quality_analyzer) { std::unique_ptr<VideoQualityAnalyzerInterface> video_quality_analyzer) {
return std::make_unique<PeerConnectionE2EQualityTest>( return std::make_unique<PeerConnectionE2EQualityTest>(
std::move(test_case_name), std::move(audio_quality_analyzer), std::move(test_case_name), time_controller,
std::move(video_quality_analyzer)); std::move(audio_quality_analyzer), std::move(video_quality_analyzer));
} }
} // namespace webrtc_pc_e2e } // namespace webrtc_pc_e2e

View file

@ -15,20 +15,25 @@
#include "api/test/audio_quality_analyzer_interface.h" #include "api/test/audio_quality_analyzer_interface.h"
#include "api/test/peerconnection_quality_test_fixture.h" #include "api/test/peerconnection_quality_test_fixture.h"
#include "api/test/time_controller.h"
#include "api/test/video_quality_analyzer_interface.h" #include "api/test/video_quality_analyzer_interface.h"
namespace webrtc { namespace webrtc {
namespace webrtc_pc_e2e { namespace webrtc_pc_e2e {
// API is in development. Can be changed/removed without notice. // API is in development. Can be changed/removed without notice.
// Create test fixture to establish test call between Alice and Bob. // Create test fixture to establish test call between Alice and Bob.
// During the test Alice will be caller and Bob will answer the call. // During the test Alice will be caller and Bob will answer the call.
// |test_case_name| is a name of test case, that will be used for all metrics // |test_case_name| is a name of test case, that will be used for all metrics
// reporting. // reporting.
// |time_controller| is used to manage all rtc::Thread's and TaskQueue
// instances. Instance of |time_controller| have to outlive created fixture.
// Returns a non-null PeerConnectionE2EQualityTestFixture instance. // Returns a non-null PeerConnectionE2EQualityTestFixture instance.
std::unique_ptr<PeerConnectionE2EQualityTestFixture> std::unique_ptr<PeerConnectionE2EQualityTestFixture>
CreatePeerConnectionE2EQualityTestFixture( CreatePeerConnectionE2EQualityTestFixture(
std::string test_case_name, std::string test_case_name,
TimeController& time_controller,
std::unique_ptr<AudioQualityAnalyzerInterface> audio_quality_analyzer, std::unique_ptr<AudioQualityAnalyzerInterface> audio_quality_analyzer,
std::unique_ptr<VideoQualityAnalyzerInterface> video_quality_analyzer); std::unique_ptr<VideoQualityAnalyzerInterface> video_quality_analyzer);

View file

@ -37,7 +37,8 @@ std::unique_ptr<CallFactoryInterface> CreateTimeControllerBasedCallFactory(
Call* CreateCall(const Call::Config& config) override { Call* CreateCall(const Call::Config& config) override {
if (!module_thread_) { if (!module_thread_) {
module_thread_ = SharedModuleThread::Create( module_thread_ = SharedModuleThread::Create(
"CallModules", [this]() { module_thread_ = nullptr; }); time_controller_->CreateProcessThread("CallModules"),
[this]() { module_thread_ = nullptr; });
} }
return Call::Create(config, time_controller_->GetClock(), module_thread_, return Call::Create(config, time_controller_->GetClock(), module_thread_,
time_controller_->CreateProcessThread("Pacer")); time_controller_->CreateProcessThread("Pacer"));

View file

@ -36,7 +36,7 @@ class DummyPeerConnection : public PeerConnectionInterface {
bool AddStream(MediaStreamInterface* stream) override { return false; } bool AddStream(MediaStreamInterface* stream) override { return false; }
void RemoveStream(MediaStreamInterface* stream) override { void RemoveStream(MediaStreamInterface* stream) override {
FATAL() << "Not implemented"; RTC_CHECK_NOTREACHED();
} }
RTCErrorOr<rtc::scoped_refptr<RtpSenderInterface>> AddTrack( RTCErrorOr<rtc::scoped_refptr<RtpSenderInterface>> AddTrack(
@ -100,17 +100,17 @@ class DummyPeerConnection : public PeerConnectionInterface {
} }
void GetStats(RTCStatsCollectorCallback* callback) override { void GetStats(RTCStatsCollectorCallback* callback) override {
FATAL() << "Not implemented"; RTC_CHECK_NOTREACHED();
} }
void GetStats( void GetStats(
rtc::scoped_refptr<RtpSenderInterface> selector, rtc::scoped_refptr<RtpSenderInterface> selector,
rtc::scoped_refptr<RTCStatsCollectorCallback> callback) override { rtc::scoped_refptr<RTCStatsCollectorCallback> callback) override {
FATAL() << "Not implemented"; RTC_CHECK_NOTREACHED();
} }
void GetStats( void GetStats(
rtc::scoped_refptr<RtpReceiverInterface> selector, rtc::scoped_refptr<RtpReceiverInterface> selector,
rtc::scoped_refptr<RTCStatsCollectorCallback> callback) override { rtc::scoped_refptr<RTCStatsCollectorCallback> callback) override {
FATAL() << "Not implemented"; RTC_CHECK_NOTREACHED();
} }
void ClearStatsCache() override {} void ClearStatsCache() override {}
@ -145,33 +145,33 @@ class DummyPeerConnection : public PeerConnectionInterface {
return nullptr; return nullptr;
} }
void RestartIce() override { FATAL() << "Not implemented"; } void RestartIce() override { RTC_CHECK_NOTREACHED(); }
// Create a new offer. // Create a new offer.
// The CreateSessionDescriptionObserver callback will be called when done. // The CreateSessionDescriptionObserver callback will be called when done.
void CreateOffer(CreateSessionDescriptionObserver* observer, void CreateOffer(CreateSessionDescriptionObserver* observer,
const RTCOfferAnswerOptions& options) override { const RTCOfferAnswerOptions& options) override {
FATAL() << "Not implemented"; RTC_CHECK_NOTREACHED();
} }
void CreateAnswer(CreateSessionDescriptionObserver* observer, void CreateAnswer(CreateSessionDescriptionObserver* observer,
const RTCOfferAnswerOptions& options) override { const RTCOfferAnswerOptions& options) override {
FATAL() << "Not implemented"; RTC_CHECK_NOTREACHED();
} }
void SetLocalDescription(SetSessionDescriptionObserver* observer, void SetLocalDescription(SetSessionDescriptionObserver* observer,
SessionDescriptionInterface* desc) override { SessionDescriptionInterface* desc) override {
FATAL() << "Not implemented"; RTC_CHECK_NOTREACHED();
} }
void SetRemoteDescription(SetSessionDescriptionObserver* observer, void SetRemoteDescription(SetSessionDescriptionObserver* observer,
SessionDescriptionInterface* desc) override { SessionDescriptionInterface* desc) override {
FATAL() << "Not implemented"; RTC_CHECK_NOTREACHED();
} }
void SetRemoteDescription( void SetRemoteDescription(
std::unique_ptr<SessionDescriptionInterface> desc, std::unique_ptr<SessionDescriptionInterface> desc,
rtc::scoped_refptr<SetRemoteDescriptionObserverInterface> observer) rtc::scoped_refptr<SetRemoteDescriptionObserverInterface> observer)
override { override {
FATAL() << "Not implemented"; RTC_CHECK_NOTREACHED();
} }
PeerConnectionInterface::RTCConfiguration GetConfiguration() override { PeerConnectionInterface::RTCConfiguration GetConfiguration() override {
@ -194,14 +194,8 @@ class DummyPeerConnection : public PeerConnectionInterface {
return RTCError(RTCErrorType::UNSUPPORTED_OPERATION, "Not implemented"); return RTCError(RTCErrorType::UNSUPPORTED_OPERATION, "Not implemented");
} }
RTCError SetBitrate(const BitrateParameters& bitrate_parameters) override { void SetAudioPlayout(bool playout) override { RTC_CHECK_NOTREACHED(); }
return RTCError(RTCErrorType::UNSUPPORTED_OPERATION, "Not implemented"); void SetAudioRecording(bool recording) override { RTC_CHECK_NOTREACHED(); }
}
void SetAudioPlayout(bool playout) override { FATAL() << "Not implemented"; }
void SetAudioRecording(bool recording) override {
FATAL() << "Not implemented";
}
rtc::scoped_refptr<DtlsTransportInterface> LookupDtlsTransportByMid( rtc::scoped_refptr<DtlsTransportInterface> LookupDtlsTransportByMid(
const std::string& mid) override { const std::string& mid) override {
@ -239,9 +233,13 @@ class DummyPeerConnection : public PeerConnectionInterface {
return false; return false;
} }
void StopRtcEventLog() { FATAL() << "Not implemented"; } void StopRtcEventLog() { RTC_CHECK_NOTREACHED(); }
void Close() {} void Close() override {}
rtc::Thread* signaling_thread() const override {
return rtc::Thread::Current();
}
}; };
static_assert( static_assert(

View file

@ -0,0 +1,34 @@
/*
* Copyright (c) 2020 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "api/test/frame_generator_interface.h"
namespace webrtc {
namespace test {
// static
const char* FrameGeneratorInterface::OutputTypeToString(
FrameGeneratorInterface::OutputType type) {
switch (type) {
case OutputType::kI420:
return "I420";
case OutputType::kI420A:
return "I420A";
case OutputType::kI010:
return "I010";
case OutputType::kNV12:
return "NV12";
default:
RTC_NOTREACHED();
}
}
} // namespace test
} // namespace webrtc

View file

@ -32,7 +32,8 @@ class FrameGeneratorInterface {
absl::optional<VideoFrame::UpdateRect> update_rect; absl::optional<VideoFrame::UpdateRect> update_rect;
}; };
enum class OutputType { kI420, kI420A, kI010 }; enum class OutputType { kI420, kI420A, kI010, kNV12 };
static const char* OutputTypeToString(OutputType type);
virtual ~FrameGeneratorInterface() = default; virtual ~FrameGeneratorInterface() = default;

View file

@ -0,0 +1,60 @@
/*
* Copyright 2020 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef API_TEST_MOCK_DATA_CHANNEL_H_
#define API_TEST_MOCK_DATA_CHANNEL_H_
#include <string>
#include "api/data_channel_interface.h"
#include "test/gmock.h"
namespace webrtc {
class MockDataChannelInterface final
: public rtc::RefCountedObject<webrtc::DataChannelInterface> {
public:
static rtc::scoped_refptr<MockDataChannelInterface> Create() {
return new MockDataChannelInterface();
}
MOCK_METHOD(void,
RegisterObserver,
(DataChannelObserver * observer),
(override));
MOCK_METHOD(void, UnregisterObserver, (), (override));
MOCK_METHOD(std::string, label, (), (const, override));
MOCK_METHOD(bool, reliable, (), (const, override));
MOCK_METHOD(bool, ordered, (), (const, override));
MOCK_METHOD(uint16_t, maxRetransmitTime, (), (const, override));
MOCK_METHOD(uint16_t, maxRetransmits, (), (const, override));
MOCK_METHOD(absl::optional<int>, maxRetransmitsOpt, (), (const, override));
MOCK_METHOD(absl::optional<int>, maxPacketLifeTime, (), (const, override));
MOCK_METHOD(std::string, protocol, (), (const, override));
MOCK_METHOD(bool, negotiated, (), (const, override));
MOCK_METHOD(int, id, (), (const, override));
MOCK_METHOD(Priority, priority, (), (const, override));
MOCK_METHOD(DataState, state, (), (const, override));
MOCK_METHOD(RTCError, error, (), (const, override));
MOCK_METHOD(uint32_t, messages_sent, (), (const, override));
MOCK_METHOD(uint64_t, bytes_sent, (), (const, override));
MOCK_METHOD(uint32_t, messages_received, (), (const, override));
MOCK_METHOD(uint64_t, bytes_received, (), (const, override));
MOCK_METHOD(uint64_t, buffered_amount, (), (const, override));
MOCK_METHOD(void, Close, (), (override));
MOCK_METHOD(bool, Send, (const DataBuffer& buffer), (override));
protected:
MockDataChannelInterface() = default;
};
} // namespace webrtc
#endif // API_TEST_MOCK_DATA_CHANNEL_H_

View file

@ -0,0 +1,89 @@
/*
* Copyright 2020 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef API_TEST_MOCK_MEDIA_STREAM_INTERFACE_H_
#define API_TEST_MOCK_MEDIA_STREAM_INTERFACE_H_
#include <string>
#include "api/media_stream_interface.h"
#include "test/gmock.h"
namespace webrtc {
class MockAudioSource final
: public rtc::RefCountedObject<AudioSourceInterface> {
public:
static rtc::scoped_refptr<MockAudioSource> Create() {
return new MockAudioSource();
}
MOCK_METHOD(void,
RegisterObserver,
(ObserverInterface * observer),
(override));
MOCK_METHOD(void,
UnregisterObserver,
(ObserverInterface * observer),
(override));
MOCK_METHOD(SourceState, state, (), (const, override));
MOCK_METHOD(bool, remote, (), (const, override));
MOCK_METHOD(void, SetVolume, (double volume), (override));
MOCK_METHOD(void,
RegisterAudioObserver,
(AudioObserver * observer),
(override));
MOCK_METHOD(void,
UnregisterAudioObserver,
(AudioObserver * observer),
(override));
MOCK_METHOD(void, AddSink, (AudioTrackSinkInterface * sink), (override));
MOCK_METHOD(void, RemoveSink, (AudioTrackSinkInterface * sink), (override));
MOCK_METHOD(const cricket::AudioOptions, options, (), (const, override));
private:
MockAudioSource() = default;
};
class MockAudioTrack final : public rtc::RefCountedObject<AudioTrackInterface> {
public:
static rtc::scoped_refptr<MockAudioTrack> Create() {
return new MockAudioTrack();
}
MOCK_METHOD(void,
RegisterObserver,
(ObserverInterface * observer),
(override));
MOCK_METHOD(void,
UnregisterObserver,
(ObserverInterface * observer),
(override));
MOCK_METHOD(std::string, kind, (), (const, override));
MOCK_METHOD(std::string, id, (), (const override));
MOCK_METHOD(bool, enabled, (), (const, override));
MOCK_METHOD(bool, set_enabled, (bool enable), (override));
MOCK_METHOD(TrackState, state, (), (const, override));
MOCK_METHOD(AudioSourceInterface*, GetSource, (), (const, override));
MOCK_METHOD(void, AddSink, (AudioTrackSinkInterface * sink), (override));
MOCK_METHOD(void, RemoveSink, (AudioTrackSinkInterface * sink), (override));
MOCK_METHOD(bool, GetSignalLevel, (int* level), (override));
MOCK_METHOD(rtc::scoped_refptr<AudioProcessorInterface>,
GetAudioProcessor,
(),
(override));
private:
MockAudioTrack() = default;
};
} // namespace webrtc
#endif // API_TEST_MOCK_MEDIA_STREAM_INTERFACE_H_

View file

@ -22,7 +22,7 @@ namespace webrtc {
class MockPeerConnectionFactoryInterface final class MockPeerConnectionFactoryInterface final
: public rtc::RefCountedObject<webrtc::PeerConnectionFactoryInterface> { : public rtc::RefCountedObject<webrtc::PeerConnectionFactoryInterface> {
public: public:
rtc::scoped_refptr<MockPeerConnectionFactoryInterface> Create() { static rtc::scoped_refptr<MockPeerConnectionFactoryInterface> Create() {
return new MockPeerConnectionFactoryInterface(); return new MockPeerConnectionFactoryInterface();
} }
@ -32,6 +32,11 @@ class MockPeerConnectionFactoryInterface final
(const PeerConnectionInterface::RTCConfiguration&, (const PeerConnectionInterface::RTCConfiguration&,
PeerConnectionDependencies), PeerConnectionDependencies),
(override)); (override));
MOCK_METHOD(RTCErrorOr<rtc::scoped_refptr<PeerConnectionInterface>>,
CreatePeerConnectionOrError,
(const PeerConnectionInterface::RTCConfiguration&,
PeerConnectionDependencies),
(override));
MOCK_METHOD(rtc::scoped_refptr<PeerConnectionInterface>, MOCK_METHOD(rtc::scoped_refptr<PeerConnectionInterface>,
CreatePeerConnection, CreatePeerConnection,
(const PeerConnectionInterface::RTCConfiguration&, (const PeerConnectionInterface::RTCConfiguration&,

View file

@ -167,7 +167,6 @@ class MockPeerConnectionInterface
(const std::vector<cricket::Candidate>&), (const std::vector<cricket::Candidate>&),
(override)); (override));
MOCK_METHOD(RTCError, SetBitrate, (const BitrateSettings&), (override)); MOCK_METHOD(RTCError, SetBitrate, (const BitrateSettings&), (override));
MOCK_METHOD(RTCError, SetBitrate, (const BitrateParameters&), (override));
MOCK_METHOD(void, SetAudioPlayout, (bool), (override)); MOCK_METHOD(void, SetAudioPlayout, (bool), (override));
MOCK_METHOD(void, SetAudioRecording, (bool), (override)); MOCK_METHOD(void, SetAudioRecording, (bool), (override));
MOCK_METHOD(rtc::scoped_refptr<DtlsTransportInterface>, MOCK_METHOD(rtc::scoped_refptr<DtlsTransportInterface>,
@ -194,6 +193,7 @@ class MockPeerConnectionInterface
MOCK_METHOD(void, StopRtcEventLog, (), (override)); MOCK_METHOD(void, StopRtcEventLog, (), (override));
MOCK_METHOD(void, Close, (), (override)); MOCK_METHOD(void, Close, (), (override));
// RingRTC changes for added methods
MOCK_METHOD0(CreateSharedIceGatherer, MOCK_METHOD0(CreateSharedIceGatherer,
rtc::scoped_refptr<webrtc::IceGathererInterface>()); rtc::scoped_refptr<webrtc::IceGathererInterface>());
MOCK_METHOD1(UseSharedIceGatherer, MOCK_METHOD1(UseSharedIceGatherer,

View file

@ -0,0 +1,85 @@
/*
* Copyright 2020 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef API_TEST_MOCK_RTP_TRANSCEIVER_H_
#define API_TEST_MOCK_RTP_TRANSCEIVER_H_
#include <string>
#include <vector>
#include "api/rtp_transceiver_interface.h"
#include "test/gmock.h"
namespace webrtc {
class MockRtpTransceiver final
: public rtc::RefCountedObject<RtpTransceiverInterface> {
public:
static rtc::scoped_refptr<MockRtpTransceiver> Create() {
return new MockRtpTransceiver();
}
MOCK_METHOD(cricket::MediaType, media_type, (), (const, override));
MOCK_METHOD(absl::optional<std::string>, mid, (), (const, override));
MOCK_METHOD(rtc::scoped_refptr<RtpSenderInterface>,
sender,
(),
(const, override));
MOCK_METHOD(rtc::scoped_refptr<RtpReceiverInterface>,
receiver,
(),
(const, override));
MOCK_METHOD(bool, stopped, (), (const, override));
MOCK_METHOD(bool, stopping, (), (const, override));
MOCK_METHOD(RtpTransceiverDirection, direction, (), (const, override));
MOCK_METHOD(void,
SetDirection,
(RtpTransceiverDirection new_direction),
(override));
MOCK_METHOD(RTCError,
SetDirectionWithError,
(RtpTransceiverDirection new_direction),
(override));
MOCK_METHOD(absl::optional<RtpTransceiverDirection>,
current_direction,
(),
(const, override));
MOCK_METHOD(absl::optional<RtpTransceiverDirection>,
fired_direction,
(),
(const, override));
MOCK_METHOD(RTCError, StopStandard, (), (override));
MOCK_METHOD(void, StopInternal, (), (override));
MOCK_METHOD(void, Stop, (), (override));
MOCK_METHOD(RTCError,
SetCodecPreferences,
(rtc::ArrayView<RtpCodecCapability> codecs),
(override));
MOCK_METHOD(std::vector<RtpCodecCapability>,
codec_preferences,
(),
(const, override));
MOCK_METHOD(std::vector<RtpHeaderExtensionCapability>,
HeaderExtensionsToOffer,
(),
(const, override));
MOCK_METHOD(webrtc::RTCError,
SetOfferedRtpHeaderExtensions,
(rtc::ArrayView<const RtpHeaderExtensionCapability>
header_extensions_to_offer),
(override));
private:
MockRtpTransceiver() = default;
};
} // namespace webrtc
#endif // API_TEST_MOCK_RTP_TRANSCEIVER_H_

View file

@ -22,9 +22,7 @@ class MockEncodedImageCallback : public EncodedImageCallback {
public: public:
MOCK_METHOD(Result, MOCK_METHOD(Result,
OnEncodedImage, OnEncodedImage,
(const EncodedImage& encodedImage, (const EncodedImage&, const CodecSpecificInfo*),
const CodecSpecificInfo*,
const RTPFragmentationHeader*),
(override)); (override));
MOCK_METHOD(void, OnDroppedFrame, (DropReason reason), (override)); MOCK_METHOD(void, OnDroppedFrame, (DropReason reason), (override));
}; };

View file

@ -21,6 +21,24 @@
namespace webrtc { namespace webrtc {
namespace test { namespace test {
namespace {
NetEqTestFactory::Config convertConfig(
const NetEqSimulatorFactory::Config& simulation_config,
absl::string_view replacement_audio_filename) {
NetEqTestFactory::Config config;
config.replacement_audio_file = std::string(replacement_audio_filename);
config.max_nr_packets_in_buffer = simulation_config.max_nr_packets_in_buffer;
config.initial_dummy_packets = simulation_config.initial_dummy_packets;
config.skip_get_audio_events = simulation_config.skip_get_audio_events;
config.field_trial_string = simulation_config.field_trial_string;
config.output_audio_filename = simulation_config.output_audio_filename;
config.pythonplot = simulation_config.python_plot_filename.has_value();
config.plot_scripts_basename = simulation_config.python_plot_filename;
config.textlog = simulation_config.text_log_filename.has_value();
config.textlog_filename = simulation_config.text_log_filename;
return config;
}
} // namespace
NetEqSimulatorFactory::NetEqSimulatorFactory() NetEqSimulatorFactory::NetEqSimulatorFactory()
: factory_(std::make_unique<NetEqTestFactory>()) {} : factory_(std::make_unique<NetEqTestFactory>()) {}
@ -31,13 +49,8 @@ std::unique_ptr<NetEqSimulator> NetEqSimulatorFactory::CreateSimulatorFromFile(
absl::string_view event_log_filename, absl::string_view event_log_filename,
absl::string_view replacement_audio_filename, absl::string_view replacement_audio_filename,
Config simulation_config) { Config simulation_config) {
NetEqTestFactory::Config config; NetEqTestFactory::Config config =
config.replacement_audio_file = std::string(replacement_audio_filename); convertConfig(simulation_config, replacement_audio_filename);
config.max_nr_packets_in_buffer = simulation_config.max_nr_packets_in_buffer;
config.initial_dummy_packets = simulation_config.initial_dummy_packets;
config.skip_get_audio_events = simulation_config.skip_get_audio_events;
config.field_trial_string = simulation_config.field_trial_string;
config.output_audio_filename = simulation_config.output_audio_filename;
return factory_->InitializeTestFromFile( return factory_->InitializeTestFromFile(
std::string(event_log_filename), simulation_config.neteq_factory, config); std::string(event_log_filename), simulation_config.neteq_factory, config);
} }
@ -47,12 +60,8 @@ NetEqSimulatorFactory::CreateSimulatorFromString(
absl::string_view event_log_file_contents, absl::string_view event_log_file_contents,
absl::string_view replacement_audio_filename, absl::string_view replacement_audio_filename,
Config simulation_config) { Config simulation_config) {
NetEqTestFactory::Config config; NetEqTestFactory::Config config =
config.replacement_audio_file = std::string(replacement_audio_filename); convertConfig(simulation_config, replacement_audio_filename);
config.max_nr_packets_in_buffer = simulation_config.max_nr_packets_in_buffer;
config.initial_dummy_packets = simulation_config.initial_dummy_packets;
config.skip_get_audio_events = simulation_config.skip_get_audio_events;
config.field_trial_string = simulation_config.field_trial_string;
return factory_->InitializeTestFromString( return factory_->InitializeTestFromString(
std::string(event_log_file_contents), simulation_config.neteq_factory, std::string(event_log_file_contents), simulation_config.neteq_factory,
config); config);

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