diff options
Diffstat (limited to 'third_party/libwebrtc/api')
172 files changed, 1845 insertions, 1742 deletions
diff --git a/third_party/libwebrtc/api/BUILD.gn b/third_party/libwebrtc/api/BUILD.gn index d2b7f06c87..10a4c8c95f 100644 --- a/third_party/libwebrtc/api/BUILD.gn +++ b/third_party/libwebrtc/api/BUILD.gn @@ -35,21 +35,62 @@ rtc_source_set("callfactory_api") { ] } +rtc_source_set("enable_media") { + visibility = [ "*" ] + sources = [ + "enable_media.cc", + "enable_media.h", + ] + deps = [ + ":libjingle_peerconnection_api", + "../call", + "../media:rtc_audio_video", + "../pc:media_factory", + "../rtc_base/system:rtc_export", + "environment", + ] + if (build_with_mozilla) { + deps -= [ "../pc:media_factory" ] + } +} + +rtc_source_set("enable_media_with_defaults") { + visibility = [ "*" ] + allow_poison = [ + "audio_codecs", + "environment_construction", + "software_video_codecs", + ] + sources = [ + "enable_media_with_defaults.cc", + "enable_media_with_defaults.h", + ] + deps = [ + ":enable_media", + ":libjingle_peerconnection_api", + "../modules/audio_processing:api", + "../rtc_base/system:rtc_export", + "audio_codecs:builtin_audio_decoder_factory", + "audio_codecs:builtin_audio_encoder_factory", + "task_queue:default_task_queue_factory", + "video_codecs:builtin_video_decoder_factory", + "video_codecs:builtin_video_encoder_factory", + ] +} + if (!build_with_chromium && !build_with_mozilla) { rtc_library("create_peerconnection_factory") { visibility = [ "*" ] - allow_poison = [ "default_task_queue" ] + allow_poison = [ "environment_construction" ] sources = [ "create_peerconnection_factory.cc", "create_peerconnection_factory.h", ] deps = [ - ":callfactory_api", + ":enable_media", ":libjingle_peerconnection_api", ":scoped_refptr", "../api/rtc_event_log:rtc_event_log_factory", - "../media:rtc_audio_video", - "../media:rtc_media_base", "../modules/audio_device:audio_device_api", "../modules/audio_processing:api", "../pc:peer_connection_factory", @@ -127,13 +168,14 @@ rtc_library("media_stream_interface") { deps = [ ":audio_options_api", ":make_ref_counted", + ":ref_count", + ":ref_count", ":rtp_parameters", ":scoped_refptr", ":sequence_checker", ":video_track_source_constraints", "../modules/audio_processing:audio_processing_statistics", "../rtc_base:checks", - "../rtc_base:refcount", "../rtc_base/system:no_unique_address", "../rtc_base/system:rtc_export", "video:recordable_encoded_frame", @@ -181,9 +223,9 @@ rtc_source_set("ice_transport_interface") { deps = [ ":async_dns_resolver", ":packet_socket_factory", + ":ref_count", ":rtc_error", ":scoped_refptr", - "../rtc_base:refcount", "rtc_event_log:rtc_event_log", ] } @@ -201,9 +243,9 @@ if (!build_with_mozilla) { ] deps = [ ":ice_transport_interface", + ":ref_count", ":rtc_error", ":scoped_refptr", - "../rtc_base:refcount", "../rtc_base:ssl", "../rtc_base/system:rtc_export", ] @@ -217,7 +259,7 @@ rtc_library("dtmf_sender_interface") { sources = [ "dtmf_sender_interface.h" ] deps = [ ":media_stream_interface", - "../rtc_base:refcount", + ":ref_count", ] } @@ -237,11 +279,12 @@ if (!build_with_mozilla) { ":dtmf_sender_interface", ":frame_transformer_interface", ":media_stream_interface", + ":ref_count", + ":rtc_error", ":rtp_parameters", ":rtp_sender_setparameters_callback", ":scoped_refptr", "../rtc_base:checks", - "../rtc_base:refcount", "../rtc_base/system:rtc_export", "crypto:frame_encryptor_interface", "video_codecs:video_codecs_api", @@ -303,7 +346,6 @@ if (!build_with_mozilla) { ":array_view", ":async_dns_resolver", ":audio_options_api", - ":callfactory_api", ":candidate", ":dtls_transport_interface", ":fec_controller_api", @@ -317,6 +359,7 @@ if (!build_with_mozilla) { ":network_state_predictor_api", ":packet_socket_factory", ":priority", + ":ref_count", ":rtc_error", ":rtc_stats_api", ":rtp_packet_info", @@ -328,11 +371,11 @@ if (!build_with_mozilla) { ":turn_customizer", "../call:rtp_interfaces", "../p2p:rtc_p2p", + "../pc:media_factory", "../rtc_base:copy_on_write_buffer", "../rtc_base:logging", "../rtc_base:network", "../rtc_base:network_constants", - "../rtc_base:refcount", "../rtc_base:rtc_certificate_generator", "../rtc_base:ssl", "../rtc_base:stringutils", @@ -387,8 +430,8 @@ rtc_source_set("frame_transformer_interface") { sources = [ "frame_transformer_interface.h" ] deps = [ ":make_ref_counted", + ":ref_count", ":scoped_refptr", - "../rtc_base:refcount", "video:encoded_frame", "video:video_frame_metadata", ] @@ -414,15 +457,10 @@ rtc_library("rtc_error") { rtc_source_set("packet_socket_factory") { visibility = [ "*" ] - sources = [ - "async_resolver_factory.h", - "packet_socket_factory.h", - ] + sources = [ "packet_socket_factory.h" ] deps = [ ":async_dns_resolver", - ":wrapping_async_dns_resolver", "../rtc_base:async_packet_socket", - "../rtc_base:async_resolver_interface", "../rtc_base:proxy_info", "../rtc_base:socket_address", "../rtc_base/system:rtc_export", @@ -440,26 +478,9 @@ rtc_source_set("async_dns_resolver") { absl_deps = [ "//third_party/abseil-cpp/absl/functional:any_invocable" ] } -rtc_source_set("wrapping_async_dns_resolver") { - visibility = [ - ":*", - "../p2p:rtc_p2p", - ] - sources = [ - "wrapping_async_dns_resolver.cc", - "wrapping_async_dns_resolver.h", - ] - deps = [ - ":async_dns_resolver", - ":sequence_checker", - "../rtc_base:async_resolver_interface", - "../rtc_base:checks", - "../rtc_base:macromagic", - "../rtc_base:socket_address", - "../rtc_base:threading", - "../rtc_base/third_party/sigslot", - ] - absl_deps = [ "//third_party/abseil-cpp/absl/memory" ] +rtc_source_set("ref_count") { + visibility = [ "*" ] + sources = [ "ref_count.h" ] } rtc_source_set("scoped_refptr") { @@ -470,7 +491,10 @@ rtc_source_set("scoped_refptr") { rtc_source_set("make_ref_counted") { visibility = [ "*" ] sources = [ "make_ref_counted.h" ] - deps = [ "../rtc_base:refcount" ] + deps = [ + ":ref_count", + "../rtc_base:refcount", + ] } rtc_source_set("video_quality_analyzer_api") { @@ -795,6 +819,7 @@ rtc_source_set("rtc_stats_api") { deps = [ ":make_ref_counted", + ":ref_count", ":scoped_refptr", "../api:refcountedbase", "../rtc_base:checks", @@ -927,6 +952,7 @@ rtc_source_set("refcountedbase") { visibility = [ "*" ] sources = [ "ref_counted_base.h" ] deps = [ + ":ref_count", "../rtc_base:macromagic", "../rtc_base:refcount", ] @@ -1052,24 +1078,6 @@ if (rtc_include_tests) { absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ] } - rtc_library("video_codec_stats_api") { - visibility = [ "*" ] - testonly = true - sources = [ - "test/video_codec_stats.cc", - "test/video_codec_stats.h", - ] - deps = [ - "../api/numerics:numerics", - "../api/units:data_rate", - "../api/units:data_size", - "../api/units:frequency", - "test/metrics:metric", - "test/metrics:metrics_logger", - ] - absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ] - } - rtc_library("videocodec_test_fixture_api") { visibility = [ "*" ] testonly = true @@ -1081,23 +1089,6 @@ if (rtc_include_tests) { ] } - rtc_library("video_codec_tester_api") { - visibility = [ "*" ] - testonly = true - sources = [ "test/video_codec_tester.h" ] - deps = [ - ":video_codec_stats_api", - "../modules/video_coding/svc:scalability_mode_util", - "video:encoded_image", - "video:resolution", - "video:video_frame", - ] - absl_deps = [ - "//third_party/abseil-cpp/absl/functional:any_invocable", - "//third_party/abseil-cpp/absl/types:optional", - ] - } - rtc_library("create_videocodec_test_fixture_api") { visibility = [ "*" ] testonly = true @@ -1113,19 +1104,6 @@ if (rtc_include_tests) { ] } - rtc_library("create_video_codec_tester_api") { - visibility = [ "*" ] - testonly = true - sources = [ - "test/create_video_codec_tester.cc", - "test/create_video_codec_tester.h", - ] - deps = [ - ":video_codec_tester_api", - "../modules/video_coding:video_codec_tester", - ] - } - rtc_source_set("mock_audio_mixer") { visibility = [ "*" ] testonly = true @@ -1227,6 +1205,7 @@ if (rtc_include_tests) { ":array_view", ":libjingle_peerconnection_api", ":make_ref_counted", + ":ref_count", ":rtp_parameters", "../rtc_base:checks", "../rtc_base:refcount", @@ -1280,6 +1259,7 @@ if (rtc_include_tests) { deps = [ ":libjingle_peerconnection_api", + ":ref_count", "../api:scoped_refptr", "../rtc_base:refcount", "../test:test_support", @@ -1307,6 +1287,18 @@ if (rtc_include_tests) { ] } + rtc_source_set("mock_transformable_frame") { + visibility = [ "*" ] + testonly = true + sources = [ "test/mock_transformable_frame.h" ] + deps = [ + ":array_view", + ":frame_transformer_interface", + "../test:test_support", + "units:timestamp", + ] + } + rtc_source_set("mock_async_dns_resolver") { visibility = [ "*" ] testonly = true @@ -1420,6 +1412,7 @@ if (rtc_include_tests) { sources = [ "test/mock_video_track.h" ] deps = [ + ":ref_count", "../api:media_stream_interface", "../api:scoped_refptr", "../rtc_base:refcount", @@ -1436,13 +1429,19 @@ if (rtc_include_tests) { ] deps = [ - ":callfactory_api", + ":enable_media_with_defaults", + ":libjingle_peerconnection_api", ":time_controller", "../call", "../call:call_interfaces", "../call:rtp_interfaces", + "../pc:media_factory", + "../rtc_base:checks", + "../system_wrappers", "../test/time_controller", + "environment", ] + absl_deps = [ "//third_party/abseil-cpp/absl/base:nullability" ] } rtc_library("rtc_api_unittests") { @@ -1492,6 +1491,7 @@ if (rtc_include_tests) { "../test:fileutils", "../test:rtc_expect_death", "../test:test_support", + "environment:environment_unittests", "task_queue:task_queue_default_factory_unittests", "test/pclf:media_configuration", "test/video:video_frame_writer", @@ -1531,6 +1531,7 @@ if (rtc_include_tests) { ":mock_rtp", ":mock_session_description_interface", ":mock_transformable_audio_frame", + ":mock_transformable_frame", ":mock_transformable_video_frame", ":mock_video_bitrate_allocator", ":mock_video_bitrate_allocator_factory", @@ -1600,10 +1601,10 @@ rtc_library("frame_transformer_factory") { ] deps = [ ":frame_transformer_interface", + ":ref_count", ":scoped_refptr", "../audio:audio", "../modules/rtp_rtcp", - "../rtc_base:refcount", "video:encoded_frame", "video:video_frame_metadata", ] diff --git a/third_party/libwebrtc/api/DEPS b/third_party/libwebrtc/api/DEPS index bcfd705741..3a650b6253 100644 --- a/third_party/libwebrtc/api/DEPS +++ b/third_party/libwebrtc/api/DEPS @@ -81,7 +81,6 @@ specific_include_rules = { "data_channel_interface\.h": [ "+rtc_base/copy_on_write_buffer.h", - "+rtc_base/ref_count.h", ], "data_channel_transport_interface\.h": [ @@ -89,33 +88,15 @@ specific_include_rules = { ], "dtls_transport_interface\.h": [ - "+rtc_base/ref_count.h", "+rtc_base/ssl_certificate.h", ], - "dtmf_sender_interface\.h": [ - "+rtc_base/ref_count.h", - ], - "fec_controller\.h": [ "+modules/include/module_fec_types.h", ], - "frame_transformer_interface\.h": [ - "+rtc_base/ref_count.h", - ], - - "ice_transport_interface\.h": [ - "+rtc_base/ref_count.h", - ], - - "jsep\.h": [ - "+rtc_base/ref_count.h", - ], - "media_stream_interface\.h": [ "+modules/audio_processing/include/audio_processing_statistics.h", - "+rtc_base/ref_count.h", ], "packet_socket_factory\.h": [ @@ -132,7 +113,6 @@ specific_include_rules = { "+rtc_base/network.h", "+rtc_base/network_constants.h", "+rtc_base/network_monitor_factory.h", - "+rtc_base/ref_count.h", "+rtc_base/rtc_certificate.h", "+rtc_base/rtc_certificate_generator.h", "+rtc_base/socket_address.h", @@ -148,7 +128,6 @@ specific_include_rules = { ], "ref_counted_base\.h": [ - "+rtc_base/ref_count.h", "+rtc_base/ref_counter.h", ], @@ -159,74 +138,19 @@ specific_include_rules = { # For private member and constructor. "+rtc_base/system/file_wrapper.h", ], - "rtp_receiver_interface\.h": [ - "+rtc_base/ref_count.h", - ], - - "rtp_sender_interface\.h": [ - "+rtc_base/ref_count.h", - ], - - "rtp_transceiver_interface\.h": [ - "+rtc_base/ref_count.h", - ], - - "sctp_transport_interface\.h": [ - "+rtc_base/ref_count.h", - ], - - "set_local_description_observer_interface\.h": [ - "+rtc_base/ref_count.h", - ], - "set_remote_description_observer_interface\.h": [ - "+rtc_base/ref_count.h", - ], "legacy_stats_types\.h": [ - "+rtc_base/ref_count.h", "+rtc_base/thread_checker.h", ], - "uma_metrics\.h": [ - "+rtc_base/ref_count.h", - ], - - "audio_mixer\.h": [ - "+rtc_base/ref_count.h", - ], - "audio_decoder\.h": [ "+rtc_base/buffer.h", ], - "audio_decoder_factory\.h": [ - "+rtc_base/ref_count.h", - ], - "audio_encoder\.h": [ "+rtc_base/buffer.h", ], - "audio_encoder_factory\.h": [ - "+rtc_base/ref_count.h", - ], - - "frame_decryptor_interface\.h": [ - "+rtc_base/ref_count.h", - ], - - "frame_encryptor_interface\.h": [ - "+rtc_base/ref_count.h", - ], - - "rtc_stats_collector_callback\.h": [ - "+rtc_base/ref_count.h", - ], - - "rtc_stats_report\.h": [ - "+rtc_base/ref_count.h", - ], - "audioproc_float\.h": [ "+modules/audio_processing/include/audio_processing.h", ], @@ -279,10 +203,6 @@ specific_include_rules = { "+modules/video_coding/include/video_codec_interface.h" ], - "video_encoder_config\.h": [ - "+rtc_base/ref_count.h", - ], - "sequence_checker\.h": [ "+rtc_base/synchronization/sequence_checker_internal.h", "+rtc_base/thread_annotations.h", diff --git a/third_party/libwebrtc/api/adaptation/resource_adaptation_api_gn/moz.build b/third_party/libwebrtc/api/adaptation/resource_adaptation_api_gn/moz.build index c06f943d1b..b0671b5d4a 100644 --- a/third_party/libwebrtc/api/adaptation/resource_adaptation_api_gn/moz.build +++ b/third_party/libwebrtc/api/adaptation/resource_adaptation_api_gn/moz.build @@ -188,7 +188,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -198,10 +197,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/array_view_gn/moz.build b/third_party/libwebrtc/api/array_view_gn/moz.build index e89811c36f..e090bcdfc5 100644 --- a/third_party/libwebrtc/api/array_view_gn/moz.build +++ b/third_party/libwebrtc/api/array_view_gn/moz.build @@ -180,16 +180,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/async_dns_resolver_gn/moz.build b/third_party/libwebrtc/api/async_dns_resolver_gn/moz.build index 5e31fd1734..6a2d55b776 100644 --- a/third_party/libwebrtc/api/async_dns_resolver_gn/moz.build +++ b/third_party/libwebrtc/api/async_dns_resolver_gn/moz.build @@ -188,16 +188,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/async_resolver_factory.h b/third_party/libwebrtc/api/async_resolver_factory.h deleted file mode 100644 index 997fe5ce57..0000000000 --- a/third_party/libwebrtc/api/async_resolver_factory.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2018 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_ASYNC_RESOLVER_FACTORY_H_ -#define API_ASYNC_RESOLVER_FACTORY_H_ - -#include "rtc_base/async_resolver_interface.h" - -namespace webrtc { - -// An abstract factory for creating AsyncResolverInterfaces. This allows -// client applications to provide WebRTC with their own mechanism for -// performing DNS resolution. -// TODO(bugs.webrtc.org/12598): Deprecate and remove. -class [[deprecated("Use AsyncDnsResolverFactory")]] AsyncResolverFactory { - public: - AsyncResolverFactory() = default; - virtual ~AsyncResolverFactory() = default; - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - // The caller should call Destroy on the returned object to delete it. - virtual rtc::AsyncResolverInterface* Create() = 0; -#pragma clang diagnostic pop -}; - -} // namespace webrtc - -#endif // API_ASYNC_RESOLVER_FACTORY_H_ diff --git a/third_party/libwebrtc/api/audio/aec3_config_gn/moz.build b/third_party/libwebrtc/api/audio/aec3_config_gn/moz.build index 4b96910919..ee6df1d36f 100644 --- a/third_party/libwebrtc/api/audio/aec3_config_gn/moz.build +++ b/third_party/libwebrtc/api/audio/aec3_config_gn/moz.build @@ -188,7 +188,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -198,10 +197,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/audio/aec3_factory_gn/moz.build b/third_party/libwebrtc/api/audio/aec3_factory_gn/moz.build index de044719cc..0c3ce503ad 100644 --- a/third_party/libwebrtc/api/audio/aec3_factory_gn/moz.build +++ b/third_party/libwebrtc/api/audio/aec3_factory_gn/moz.build @@ -200,7 +200,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -210,10 +209,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/audio/audio_frame_api_gn/moz.build b/third_party/libwebrtc/api/audio/audio_frame_api_gn/moz.build index ca2c90ecfa..1317ad89b0 100644 --- a/third_party/libwebrtc/api/audio/audio_frame_api_gn/moz.build +++ b/third_party/libwebrtc/api/audio/audio_frame_api_gn/moz.build @@ -196,7 +196,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -206,10 +205,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/audio/audio_frame_processor_gn/moz.build b/third_party/libwebrtc/api/audio/audio_frame_processor_gn/moz.build index 87847bb863..e04682bee3 100644 --- a/third_party/libwebrtc/api/audio/audio_frame_processor_gn/moz.build +++ b/third_party/libwebrtc/api/audio/audio_frame_processor_gn/moz.build @@ -176,16 +176,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/audio/audio_mixer_api_gn/moz.build b/third_party/libwebrtc/api/audio/audio_mixer_api_gn/moz.build index 27baf1a796..c74637daa3 100644 --- a/third_party/libwebrtc/api/audio/audio_mixer_api_gn/moz.build +++ b/third_party/libwebrtc/api/audio/audio_mixer_api_gn/moz.build @@ -187,16 +187,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/audio/echo_control_gn/moz.build b/third_party/libwebrtc/api/audio/echo_control_gn/moz.build index 6a5ce44f46..eb9e4ec669 100644 --- a/third_party/libwebrtc/api/audio/echo_control_gn/moz.build +++ b/third_party/libwebrtc/api/audio/echo_control_gn/moz.build @@ -180,16 +180,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/audio_codecs/BUILD.gn b/third_party/libwebrtc/api/audio_codecs/BUILD.gn index 82ed31a5da..158ab74cce 100644 --- a/third_party/libwebrtc/api/audio_codecs/BUILD.gn +++ b/third_party/libwebrtc/api/audio_codecs/BUILD.gn @@ -32,6 +32,7 @@ rtc_library("audio_codecs_api") { "..:array_view", "..:bitrate_allocation", "..:make_ref_counted", + "..:ref_count", "..:scoped_refptr", "../../api:field_trials_view", "../../rtc_base:buffer", diff --git a/third_party/libwebrtc/api/audio_codecs/L16/audio_decoder_L16_gn/moz.build b/third_party/libwebrtc/api/audio_codecs/L16/audio_decoder_L16_gn/moz.build index 9ab87e6a0e..9dcc9826de 100644 --- a/third_party/libwebrtc/api/audio_codecs/L16/audio_decoder_L16_gn/moz.build +++ b/third_party/libwebrtc/api/audio_codecs/L16/audio_decoder_L16_gn/moz.build @@ -195,7 +195,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -205,10 +204,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/audio_codecs/L16/audio_encoder_L16_gn/moz.build b/third_party/libwebrtc/api/audio_codecs/L16/audio_encoder_L16_gn/moz.build index 0efa8c28a2..b5c7fe8b37 100644 --- a/third_party/libwebrtc/api/audio_codecs/L16/audio_encoder_L16_gn/moz.build +++ b/third_party/libwebrtc/api/audio_codecs/L16/audio_encoder_L16_gn/moz.build @@ -195,7 +195,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -205,10 +204,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/audio_codecs/audio_codecs_api_gn/moz.build b/third_party/libwebrtc/api/audio_codecs/audio_codecs_api_gn/moz.build index 6c8b6b3b2b..8eaebf875c 100644 --- a/third_party/libwebrtc/api/audio_codecs/audio_codecs_api_gn/moz.build +++ b/third_party/libwebrtc/api/audio_codecs/audio_codecs_api_gn/moz.build @@ -198,7 +198,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -208,10 +207,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/audio_codecs/audio_decoder_factory.h b/third_party/libwebrtc/api/audio_codecs/audio_decoder_factory.h index 2811f6704b..19b921a97f 100644 --- a/third_party/libwebrtc/api/audio_codecs/audio_decoder_factory.h +++ b/third_party/libwebrtc/api/audio_codecs/audio_decoder_factory.h @@ -18,12 +18,12 @@ #include "api/audio_codecs/audio_codec_pair_id.h" #include "api/audio_codecs/audio_decoder.h" #include "api/audio_codecs/audio_format.h" -#include "rtc_base/ref_count.h" +#include "api/ref_count.h" namespace webrtc { // A factory that creates AudioDecoders. -class AudioDecoderFactory : public rtc::RefCountInterface { +class AudioDecoderFactory : public RefCountInterface { public: virtual std::vector<AudioCodecSpec> GetSupportedDecoders() = 0; diff --git a/third_party/libwebrtc/api/audio_codecs/builtin_audio_decoder_factory_gn/moz.build b/third_party/libwebrtc/api/audio_codecs/builtin_audio_decoder_factory_gn/moz.build index f64e3e3340..3ce5ad2d5d 100644 --- a/third_party/libwebrtc/api/audio_codecs/builtin_audio_decoder_factory_gn/moz.build +++ b/third_party/libwebrtc/api/audio_codecs/builtin_audio_decoder_factory_gn/moz.build @@ -201,7 +201,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -211,10 +210,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/audio_codecs/builtin_audio_encoder_factory_gn/moz.build b/third_party/libwebrtc/api/audio_codecs/builtin_audio_encoder_factory_gn/moz.build index 6965c4298f..e8acc1186e 100644 --- a/third_party/libwebrtc/api/audio_codecs/builtin_audio_encoder_factory_gn/moz.build +++ b/third_party/libwebrtc/api/audio_codecs/builtin_audio_encoder_factory_gn/moz.build @@ -201,7 +201,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -211,10 +210,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/audio_codecs/g711/audio_decoder_g711_gn/moz.build b/third_party/libwebrtc/api/audio_codecs/g711/audio_decoder_g711_gn/moz.build index e0dcf8f032..2dbe0fd6bc 100644 --- a/third_party/libwebrtc/api/audio_codecs/g711/audio_decoder_g711_gn/moz.build +++ b/third_party/libwebrtc/api/audio_codecs/g711/audio_decoder_g711_gn/moz.build @@ -195,7 +195,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -205,10 +204,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/audio_codecs/g711/audio_encoder_g711_gn/moz.build b/third_party/libwebrtc/api/audio_codecs/g711/audio_encoder_g711_gn/moz.build index 708744cf3b..a1b1f8e9fc 100644 --- a/third_party/libwebrtc/api/audio_codecs/g711/audio_encoder_g711_gn/moz.build +++ b/third_party/libwebrtc/api/audio_codecs/g711/audio_encoder_g711_gn/moz.build @@ -195,7 +195,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -205,10 +204,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/audio_codecs/g722/audio_decoder_g722_gn/moz.build b/third_party/libwebrtc/api/audio_codecs/g722/audio_decoder_g722_gn/moz.build index 4b96ef2068..838977ba10 100644 --- a/third_party/libwebrtc/api/audio_codecs/g722/audio_decoder_g722_gn/moz.build +++ b/third_party/libwebrtc/api/audio_codecs/g722/audio_decoder_g722_gn/moz.build @@ -195,7 +195,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -205,10 +204,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/audio_codecs/g722/audio_encoder_g722_config_gn/moz.build b/third_party/libwebrtc/api/audio_codecs/g722/audio_encoder_g722_config_gn/moz.build index bddf7d5571..2b1c0d220c 100644 --- a/third_party/libwebrtc/api/audio_codecs/g722/audio_encoder_g722_config_gn/moz.build +++ b/third_party/libwebrtc/api/audio_codecs/g722/audio_encoder_g722_config_gn/moz.build @@ -187,16 +187,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/audio_codecs/g722/audio_encoder_g722_gn/moz.build b/third_party/libwebrtc/api/audio_codecs/g722/audio_encoder_g722_gn/moz.build index e35ace4e0a..367caa077f 100644 --- a/third_party/libwebrtc/api/audio_codecs/g722/audio_encoder_g722_gn/moz.build +++ b/third_party/libwebrtc/api/audio_codecs/g722/audio_encoder_g722_gn/moz.build @@ -195,7 +195,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -205,10 +204,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/audio_codecs/ilbc/audio_decoder_ilbc_gn/moz.build b/third_party/libwebrtc/api/audio_codecs/ilbc/audio_decoder_ilbc_gn/moz.build index 123ba8eb1c..b8bf808d3d 100644 --- a/third_party/libwebrtc/api/audio_codecs/ilbc/audio_decoder_ilbc_gn/moz.build +++ b/third_party/libwebrtc/api/audio_codecs/ilbc/audio_decoder_ilbc_gn/moz.build @@ -199,7 +199,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -209,10 +208,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/audio_codecs/ilbc/audio_encoder_ilbc_config_gn/moz.build b/third_party/libwebrtc/api/audio_codecs/ilbc/audio_encoder_ilbc_config_gn/moz.build index 843a9aee3b..909cc8c26f 100644 --- a/third_party/libwebrtc/api/audio_codecs/ilbc/audio_encoder_ilbc_config_gn/moz.build +++ b/third_party/libwebrtc/api/audio_codecs/ilbc/audio_encoder_ilbc_config_gn/moz.build @@ -176,16 +176,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/audio_codecs/ilbc/audio_encoder_ilbc_gn/moz.build b/third_party/libwebrtc/api/audio_codecs/ilbc/audio_encoder_ilbc_gn/moz.build index a01bbe78d5..08b426b9ab 100644 --- a/third_party/libwebrtc/api/audio_codecs/ilbc/audio_encoder_ilbc_gn/moz.build +++ b/third_party/libwebrtc/api/audio_codecs/ilbc/audio_encoder_ilbc_gn/moz.build @@ -199,7 +199,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -209,10 +208,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_multiopus_gn/moz.build b/third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_multiopus_gn/moz.build index fec5701696..c36b4324e4 100644 --- a/third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_multiopus_gn/moz.build +++ b/third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_multiopus_gn/moz.build @@ -196,7 +196,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -206,10 +205,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_opus_config_gn/moz.build b/third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_opus_config_gn/moz.build index 41887d1871..a9896dd203 100644 --- a/third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_opus_config_gn/moz.build +++ b/third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_opus_config_gn/moz.build @@ -187,16 +187,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_opus_gn/moz.build b/third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_opus_gn/moz.build index 9c9bbb415b..7c7ed25cbc 100644 --- a/third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_opus_gn/moz.build +++ b/third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_opus_gn/moz.build @@ -200,7 +200,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -210,10 +209,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_multiopus_gn/moz.build b/third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_multiopus_gn/moz.build index ec36454e9f..7a8b6dc2e6 100644 --- a/third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_multiopus_gn/moz.build +++ b/third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_multiopus_gn/moz.build @@ -196,7 +196,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -206,10 +205,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_opus_config_gn/moz.build b/third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_opus_config_gn/moz.build index 6c061ce58f..f68dce0d9d 100644 --- a/third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_opus_config_gn/moz.build +++ b/third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_opus_config_gn/moz.build @@ -189,7 +189,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -199,10 +198,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_opus_gn/moz.build b/third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_opus_gn/moz.build index b5c0f484ad..f44d8836ef 100644 --- a/third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_opus_gn/moz.build +++ b/third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_opus_gn/moz.build @@ -200,7 +200,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -210,10 +209,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/audio_options_api_gn/moz.build b/third_party/libwebrtc/api/audio_options_api_gn/moz.build index f31b230650..5e169a3ffe 100644 --- a/third_party/libwebrtc/api/audio_options_api_gn/moz.build +++ b/third_party/libwebrtc/api/audio_options_api_gn/moz.build @@ -188,7 +188,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -198,10 +197,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/bitrate_allocation_gn/moz.build b/third_party/libwebrtc/api/bitrate_allocation_gn/moz.build index dcf9b27ca3..530662eb2f 100644 --- a/third_party/libwebrtc/api/bitrate_allocation_gn/moz.build +++ b/third_party/libwebrtc/api/bitrate_allocation_gn/moz.build @@ -180,16 +180,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/call/call_factory_interface.h b/third_party/libwebrtc/api/call/call_factory_interface.h index fde8cba66e..db53d724a6 100644 --- a/third_party/libwebrtc/api/call/call_factory_interface.h +++ b/third_party/libwebrtc/api/call/call_factory_interface.h @@ -24,6 +24,9 @@ struct CallConfig; // This interface exists to allow webrtc to be optionally built without media // support (i.e., if only being used for data channels). PeerConnectionFactory // is constructed with a CallFactoryInterface, which may or may not be null. +// TODO(bugs.webrtc.org/15574): Delete this interface when +// `PeerConnectionFactoryDependencies::call_factory` is removed in favor of +// `PeerConnectionFactoryDependencies::media_factory`. class CallFactoryInterface { public: virtual ~CallFactoryInterface() = default; @@ -31,7 +34,9 @@ class CallFactoryInterface { virtual std::unique_ptr<Call> CreateCall(const CallConfig& config) = 0; }; -RTC_EXPORT std::unique_ptr<CallFactoryInterface> CreateCallFactory(); +[[deprecated("bugs.webrtc.org/15574")]] // +RTC_EXPORT std::unique_ptr<CallFactoryInterface> +CreateCallFactory(); } // namespace webrtc diff --git a/third_party/libwebrtc/api/call_api_gn/moz.build b/third_party/libwebrtc/api/call_api_gn/moz.build index 5c4a7f29a0..5656999ecb 100644 --- a/third_party/libwebrtc/api/call_api_gn/moz.build +++ b/third_party/libwebrtc/api/call_api_gn/moz.build @@ -176,16 +176,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/callfactory_api_gn/moz.build b/third_party/libwebrtc/api/callfactory_api_gn/moz.build index a671079943..157a34ec8e 100644 --- a/third_party/libwebrtc/api/callfactory_api_gn/moz.build +++ b/third_party/libwebrtc/api/callfactory_api_gn/moz.build @@ -191,16 +191,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/create_peerconnection_factory.cc b/third_party/libwebrtc/api/create_peerconnection_factory.cc index b7f9eb7f30..5d3aace05f 100644 --- a/third_party/libwebrtc/api/create_peerconnection_factory.cc +++ b/third_party/libwebrtc/api/create_peerconnection_factory.cc @@ -13,14 +13,12 @@ #include <memory> #include <utility> -#include "api/call/call_factory_interface.h" +#include "api/enable_media.h" #include "api/peer_connection_interface.h" #include "api/rtc_event_log/rtc_event_log_factory.h" #include "api/scoped_refptr.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/engine/webrtc_media_engine.h" #include "modules/audio_device/include/audio_device.h" #include "modules/audio_processing/include/audio_processing.h" #include "rtc_base/thread.h" @@ -38,8 +36,7 @@ rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory( std::unique_ptr<VideoDecoderFactory> video_decoder_factory, rtc::scoped_refptr<AudioMixer> audio_mixer, rtc::scoped_refptr<AudioProcessing> audio_processing, - AudioFrameProcessor* audio_frame_processor, - std::unique_ptr<AudioFrameProcessor> owned_audio_frame_processor, + std::unique_ptr<AudioFrameProcessor> audio_frame_processor, std::unique_ptr<FieldTrialsView> field_trials) { if (!field_trials) { field_trials = std::make_unique<webrtc::FieldTrialBasedConfig>(); @@ -51,7 +48,6 @@ rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory( dependencies.signaling_thread = signaling_thread; dependencies.task_queue_factory = CreateDefaultTaskQueueFactory(field_trials.get()); - dependencies.call_factory = CreateCallFactory(); dependencies.event_log_factory = std::make_unique<RtcEventLogFactory>( dependencies.task_queue_factory.get()); dependencies.trials = std::move(field_trials); @@ -60,70 +56,21 @@ rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory( // TODO(bugs.webrtc.org/13145): Add an rtc::SocketFactory* argument. dependencies.socket_factory = network_thread->socketserver(); } - cricket::MediaEngineDependencies media_dependencies; - media_dependencies.task_queue_factory = dependencies.task_queue_factory.get(); - media_dependencies.adm = std::move(default_adm); - media_dependencies.audio_encoder_factory = std::move(audio_encoder_factory); - media_dependencies.audio_decoder_factory = std::move(audio_decoder_factory); - if (audio_frame_processor) { - media_dependencies.audio_frame_processor = audio_frame_processor; - } else if (owned_audio_frame_processor) { - media_dependencies.owned_audio_frame_processor = - std::move(owned_audio_frame_processor); - } + dependencies.adm = std::move(default_adm); + dependencies.audio_encoder_factory = std::move(audio_encoder_factory); + dependencies.audio_decoder_factory = std::move(audio_decoder_factory); + dependencies.audio_frame_processor = std::move(audio_frame_processor); if (audio_processing) { - media_dependencies.audio_processing = std::move(audio_processing); + dependencies.audio_processing = std::move(audio_processing); } else { - media_dependencies.audio_processing = AudioProcessingBuilder().Create(); + dependencies.audio_processing = AudioProcessingBuilder().Create(); } - media_dependencies.audio_mixer = std::move(audio_mixer); - media_dependencies.video_encoder_factory = std::move(video_encoder_factory); - media_dependencies.video_decoder_factory = std::move(video_decoder_factory); - media_dependencies.trials = dependencies.trials.get(); - dependencies.media_engine = - cricket::CreateMediaEngine(std::move(media_dependencies)); + dependencies.audio_mixer = std::move(audio_mixer); + dependencies.video_encoder_factory = std::move(video_encoder_factory); + dependencies.video_decoder_factory = std::move(video_decoder_factory); + EnableMedia(dependencies); return CreateModularPeerConnectionFactory(std::move(dependencies)); } -rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory( - rtc::Thread* network_thread, - rtc::Thread* worker_thread, - rtc::Thread* signaling_thread, - rtc::scoped_refptr<AudioDeviceModule> default_adm, - rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory, - rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory, - std::unique_ptr<VideoEncoderFactory> video_encoder_factory, - std::unique_ptr<VideoDecoderFactory> video_decoder_factory, - rtc::scoped_refptr<AudioMixer> audio_mixer, - rtc::scoped_refptr<AudioProcessing> audio_processing, - AudioFrameProcessor* audio_frame_processor) { - return CreatePeerConnectionFactory( - network_thread, worker_thread, signaling_thread, default_adm, - audio_encoder_factory, audio_decoder_factory, - std::move(video_encoder_factory), std::move(video_decoder_factory), - audio_mixer, audio_processing, audio_frame_processor, nullptr, nullptr); -} - -rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory( - rtc::Thread* network_thread, - rtc::Thread* worker_thread, - rtc::Thread* signaling_thread, - rtc::scoped_refptr<AudioDeviceModule> default_adm, - rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory, - rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory, - std::unique_ptr<VideoEncoderFactory> video_encoder_factory, - std::unique_ptr<VideoDecoderFactory> video_decoder_factory, - rtc::scoped_refptr<AudioMixer> audio_mixer, - rtc::scoped_refptr<AudioProcessing> audio_processing, - std::unique_ptr<AudioFrameProcessor> owned_audio_frame_processor, - std::unique_ptr<FieldTrialsView> field_trials) { - return CreatePeerConnectionFactory( - network_thread, worker_thread, signaling_thread, default_adm, - audio_encoder_factory, audio_decoder_factory, - std::move(video_encoder_factory), std::move(video_decoder_factory), - audio_mixer, audio_processing, nullptr, - std::move(owned_audio_frame_processor), std::move(field_trials)); -} - } // namespace webrtc diff --git a/third_party/libwebrtc/api/create_peerconnection_factory.h b/third_party/libwebrtc/api/create_peerconnection_factory.h index f8f52a0869..d829bc19be 100644 --- a/third_party/libwebrtc/api/create_peerconnection_factory.h +++ b/third_party/libwebrtc/api/create_peerconnection_factory.h @@ -37,9 +37,6 @@ class AudioProcessing; // Create a new instance of PeerConnectionFactoryInterface with optional video // codec factories. These video factories represents all video codecs, i.e. no // extra internal video codecs will be added. -// TODO(bugs.webrtc.org/15111): -// Remove the method with the raw AudioFrameProcessor pointer in the -// follow-up. RTC_EXPORT rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory( rtc::Thread* network_thread, @@ -52,21 +49,7 @@ CreatePeerConnectionFactory( std::unique_ptr<VideoDecoderFactory> video_decoder_factory, rtc::scoped_refptr<AudioMixer> audio_mixer, rtc::scoped_refptr<AudioProcessing> audio_processing, - AudioFrameProcessor* audio_frame_processor = nullptr); - -RTC_EXPORT rtc::scoped_refptr<PeerConnectionFactoryInterface> -CreatePeerConnectionFactory( - rtc::Thread* network_thread, - rtc::Thread* worker_thread, - rtc::Thread* signaling_thread, - rtc::scoped_refptr<AudioDeviceModule> default_adm, - rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory, - rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory, - std::unique_ptr<VideoEncoderFactory> video_encoder_factory, - std::unique_ptr<VideoDecoderFactory> video_decoder_factory, - rtc::scoped_refptr<AudioMixer> audio_mixer, - rtc::scoped_refptr<AudioProcessing> audio_processing, - std::unique_ptr<AudioFrameProcessor> owned_audio_frame_processor, + std::unique_ptr<AudioFrameProcessor> audio_frame_processor = nullptr, std::unique_ptr<FieldTrialsView> field_trials = nullptr); } // namespace webrtc diff --git a/third_party/libwebrtc/api/crypto/frame_decryptor_interface_gn/moz.build b/third_party/libwebrtc/api/crypto/frame_decryptor_interface_gn/moz.build index 65794fbdd2..4147b3868b 100644 --- a/third_party/libwebrtc/api/crypto/frame_decryptor_interface_gn/moz.build +++ b/third_party/libwebrtc/api/crypto/frame_decryptor_interface_gn/moz.build @@ -180,16 +180,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/crypto/frame_encryptor_interface_gn/moz.build b/third_party/libwebrtc/api/crypto/frame_encryptor_interface_gn/moz.build index 19352a6da4..93034ef6e2 100644 --- a/third_party/libwebrtc/api/crypto/frame_encryptor_interface_gn/moz.build +++ b/third_party/libwebrtc/api/crypto/frame_encryptor_interface_gn/moz.build @@ -180,16 +180,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/crypto/options_gn/moz.build b/third_party/libwebrtc/api/crypto/options_gn/moz.build index 3219fce47f..9b5cca4f8b 100644 --- a/third_party/libwebrtc/api/crypto/options_gn/moz.build +++ b/third_party/libwebrtc/api/crypto/options_gn/moz.build @@ -184,7 +184,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -194,10 +193,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/data_channel_interface.h b/third_party/libwebrtc/api/data_channel_interface.h index bf27c6c4f3..d2deace2e6 100644 --- a/third_party/libwebrtc/api/data_channel_interface.h +++ b/third_party/libwebrtc/api/data_channel_interface.h @@ -22,10 +22,10 @@ #include "absl/functional/any_invocable.h" #include "absl/types/optional.h" #include "api/priority.h" +#include "api/ref_count.h" #include "api/rtc_error.h" #include "rtc_base/checks.h" #include "rtc_base/copy_on_write_buffer.h" -#include "rtc_base/ref_count.h" #include "rtc_base/system/rtc_export.h" namespace webrtc { @@ -116,7 +116,7 @@ class DataChannelObserver { virtual ~DataChannelObserver() = default; }; -class RTC_EXPORT DataChannelInterface : public rtc::RefCountInterface { +class RTC_EXPORT DataChannelInterface : public RefCountInterface { public: // C++ version of: https://www.w3.org/TR/webrtc/#idl-def-rtcdatachannelstate // Unlikely to change, but keep in sync with DataChannel.java:State and diff --git a/third_party/libwebrtc/api/dtls_transport_interface.h b/third_party/libwebrtc/api/dtls_transport_interface.h index 7b0151249c..fe64fb1947 100644 --- a/third_party/libwebrtc/api/dtls_transport_interface.h +++ b/third_party/libwebrtc/api/dtls_transport_interface.h @@ -16,9 +16,9 @@ #include "absl/types/optional.h" #include "api/ice_transport_interface.h" +#include "api/ref_count.h" #include "api/rtc_error.h" #include "api/scoped_refptr.h" -#include "rtc_base/ref_count.h" #include "rtc_base/ssl_certificate.h" #include "rtc_base/system/rtc_export.h" @@ -107,7 +107,7 @@ class DtlsTransportObserverInterface { // accessed on that thread, except for functions explicitly marked otherwise. // References can be held by other threads, and destruction can therefore // be initiated by other threads. -class DtlsTransportInterface : public rtc::RefCountInterface { +class DtlsTransportInterface : public webrtc::RefCountInterface { public: // Returns a pointer to the ICE transport that is owned by the DTLS transport. virtual rtc::scoped_refptr<IceTransportInterface> ice_transport() = 0; diff --git a/third_party/libwebrtc/api/dtmf_sender_interface.h b/third_party/libwebrtc/api/dtmf_sender_interface.h index d63e66bbf7..4aed3382ed 100644 --- a/third_party/libwebrtc/api/dtmf_sender_interface.h +++ b/third_party/libwebrtc/api/dtmf_sender_interface.h @@ -14,7 +14,7 @@ #include <string> #include "api/media_stream_interface.h" -#include "rtc_base/ref_count.h" +#include "api/ref_count.h" namespace webrtc { @@ -42,7 +42,7 @@ class DtmfSenderObserverInterface { // The interface of native implementation of the RTCDTMFSender defined by the // WebRTC W3C Editor's Draft. // See: https://www.w3.org/TR/webrtc/#peer-to-peer-dtmf -class DtmfSenderInterface : public rtc::RefCountInterface { +class DtmfSenderInterface : public webrtc::RefCountInterface { public: // Provides the spec compliant default 2 second delay for the ',' character. static const int kDtmfDefaultCommaDelayMs = 2000; diff --git a/third_party/libwebrtc/api/enable_media.cc b/third_party/libwebrtc/api/enable_media.cc new file mode 100644 index 0000000000..a05b1b328a --- /dev/null +++ b/third_party/libwebrtc/api/enable_media.cc @@ -0,0 +1,72 @@ +/* + * Copyright 2023 The WebRTC Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#include "api/enable_media.h" + +#include <memory> +#include <utility> + +#include "api/environment/environment.h" +#include "api/peer_connection_interface.h" +#include "call/call_factory.h" +#include "media/engine/webrtc_media_engine.h" +#include "media/engine/webrtc_video_engine.h" +#include "media/engine/webrtc_voice_engine.h" +#include "pc/media_factory.h" + +namespace webrtc { +namespace { + +using ::cricket::CompositeMediaEngine; +using ::cricket::MediaEngineInterface; +using ::cricket::WebRtcVideoEngine; +using ::cricket::WebRtcVoiceEngine; + +class MediaFactoryImpl : public MediaFactory { + public: + MediaFactoryImpl() = default; + MediaFactoryImpl(const MediaFactoryImpl&) = delete; + MediaFactoryImpl& operator=(const MediaFactoryImpl&) = delete; + ~MediaFactoryImpl() override = default; + + std::unique_ptr<Call> CreateCall(const CallConfig& config) override { + CallFactory call_factory; + return static_cast<CallFactoryInterface&>(call_factory).CreateCall(config); + } + + std::unique_ptr<MediaEngineInterface> CreateMediaEngine( + const Environment& env, + PeerConnectionFactoryDependencies& deps) override { + auto audio_engine = std::make_unique<WebRtcVoiceEngine>( + &env.task_queue_factory(), deps.adm.get(), + std::move(deps.audio_encoder_factory), + std::move(deps.audio_decoder_factory), std::move(deps.audio_mixer), + std::move(deps.audio_processing), std::move(deps.audio_frame_processor), + env.field_trials()); + auto video_engine = std::make_unique<WebRtcVideoEngine>( + std::move(deps.video_encoder_factory), + std::move(deps.video_decoder_factory), env.field_trials()); + return std::make_unique<CompositeMediaEngine>(std::move(audio_engine), + std::move(video_engine)); + } +}; + +} // namespace + +void EnableMedia(PeerConnectionFactoryDependencies& deps) { + if (deps.media_factory != nullptr) { + // Do nothing if media is already enabled. Overwriting media_factory can be + // harmful when a different (e.g. test-only) implementation is used. + return; + } + deps.media_factory = std::make_unique<MediaFactoryImpl>(); +} + +} // namespace webrtc diff --git a/third_party/libwebrtc/api/enable_media.h b/third_party/libwebrtc/api/enable_media.h new file mode 100644 index 0000000000..85183963cf --- /dev/null +++ b/third_party/libwebrtc/api/enable_media.h @@ -0,0 +1,27 @@ +/* + * Copyright 2023 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef API_ENABLE_MEDIA_H_ +#define API_ENABLE_MEDIA_H_ + +#include "api/peer_connection_interface.h" +#include "rtc_base/system/rtc_export.h" + +namespace webrtc { + +// Enables media support for PeerConnnectionFactory created from `deps` +// This function is located in its own build target to allow webrtc users that +// do not need any media to avoid linking media specific code and thus to reduce +// binary size. +RTC_EXPORT void EnableMedia(PeerConnectionFactoryDependencies& deps); + +} // namespace webrtc + +#endif // API_ENABLE_MEDIA_H_ diff --git a/third_party/libwebrtc/api/enable_media_with_defaults.cc b/third_party/libwebrtc/api/enable_media_with_defaults.cc new file mode 100644 index 0000000000..81462f703e --- /dev/null +++ b/third_party/libwebrtc/api/enable_media_with_defaults.cc @@ -0,0 +1,46 @@ +/* + * Copyright 2023 The WebRTC Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#include "api/enable_media_with_defaults.h" + +#include "api/audio_codecs/builtin_audio_decoder_factory.h" +#include "api/audio_codecs/builtin_audio_encoder_factory.h" +#include "api/enable_media.h" +#include "api/task_queue/default_task_queue_factory.h" +#include "api/video_codecs/builtin_video_decoder_factory.h" +#include "api/video_codecs/builtin_video_encoder_factory.h" +#include "modules/audio_processing/include/audio_processing.h" + +namespace webrtc { + +void EnableMediaWithDefaults(PeerConnectionFactoryDependencies& deps) { + if (deps.task_queue_factory == nullptr) { + deps.task_queue_factory = CreateDefaultTaskQueueFactory(); + } + if (deps.audio_encoder_factory == nullptr) { + deps.audio_encoder_factory = CreateBuiltinAudioEncoderFactory(); + } + if (deps.audio_decoder_factory == nullptr) { + deps.audio_decoder_factory = CreateBuiltinAudioDecoderFactory(); + } + if (deps.audio_processing == nullptr) { + deps.audio_processing = AudioProcessingBuilder().Create(); + } + + if (deps.video_encoder_factory == nullptr) { + deps.video_encoder_factory = CreateBuiltinVideoEncoderFactory(); + } + if (deps.video_decoder_factory == nullptr) { + deps.video_decoder_factory = CreateBuiltinVideoDecoderFactory(); + } + EnableMedia(deps); +} + +} // namespace webrtc diff --git a/third_party/libwebrtc/api/enable_media_with_defaults.h b/third_party/libwebrtc/api/enable_media_with_defaults.h new file mode 100644 index 0000000000..1b13a98fc9 --- /dev/null +++ b/third_party/libwebrtc/api/enable_media_with_defaults.h @@ -0,0 +1,28 @@ +/* + * Copyright 2023 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef API_ENABLE_MEDIA_WITH_DEFAULTS_H_ +#define API_ENABLE_MEDIA_WITH_DEFAULTS_H_ + +#include "api/peer_connection_interface.h" +#include "rtc_base/system/rtc_export.h" + +namespace webrtc { + +// Fills unset media related dependencies in `deps` and enables media support +// for a PeerConnectionFactory created from `deps`. +// This function is located in its own build target as it pulls additional +// dependencies compared to `EnableMedia`, and thus may add extra binary size. +RTC_EXPORT void EnableMediaWithDefaults( + PeerConnectionFactoryDependencies& deps); + +} // namespace webrtc + +#endif // API_ENABLE_MEDIA_WITH_DEFAULTS_H_ diff --git a/third_party/libwebrtc/api/environment/BUILD.gn b/third_party/libwebrtc/api/environment/BUILD.gn new file mode 100644 index 0000000000..c2b73b327e --- /dev/null +++ b/third_party/libwebrtc/api/environment/BUILD.gn @@ -0,0 +1,63 @@ +# Copyright (c) 2023 The WebRTC project authors. All Rights Reserved. +# +# Use of this source code is governed by a BSD-style license +# that can be found in the LICENSE file in the root of the source +# tree. An additional intellectual property rights grant can be found +# in the file PATENTS. All contributing project authors may +# be found in the AUTHORS file in the root of the source tree. + +import("../../webrtc.gni") + +rtc_source_set("environment") { + visibility = [ "*" ] + sources = [ "environment.h" ] + deps = [ + "..:refcountedbase", + "..:scoped_refptr", + "../../rtc_base/system:rtc_export", + ] + absl_deps = [ "//third_party/abseil-cpp/absl/base:nullability" ] +} + +rtc_library("environment_factory") { + visibility = [ "*" ] + poisonous = [ "environment_construction" ] + sources = [ + "environment_factory.cc", + "environment_factory.h", + ] + deps = [ + ":environment", + "..:make_ref_counted", + "..:refcountedbase", + "..:scoped_refptr", + "../../rtc_base:checks", + "../../rtc_base/system:rtc_export", + "../../system_wrappers", + "../rtc_event_log", + "../task_queue:default_task_queue_factory", + "../transport:field_trial_based_config", + ] + absl_deps = [ "//third_party/abseil-cpp/absl/base:nullability" ] +} + +if (rtc_include_tests) { + rtc_library("environment_unittests") { + testonly = true + sources = [ "environment_unittest.cc" ] + deps = [ + ":environment", + ":environment_factory", + "..:field_trials_view", + "../../system_wrappers", + "../../test:test_support", + "../rtc_event_log", + "../task_queue", + "../units:timestamp", + ] + absl_deps = [ + "//third_party/abseil-cpp/absl/functional:any_invocable", + "//third_party/abseil-cpp/absl/types:optional", + ] + } +} diff --git a/third_party/libwebrtc/api/environment/OWNERS b/third_party/libwebrtc/api/environment/OWNERS new file mode 100644 index 0000000000..a8af6b5b26 --- /dev/null +++ b/third_party/libwebrtc/api/environment/OWNERS @@ -0,0 +1,15 @@ +# Environment has a limited visibility for stronger control what utilities are +# exposed through it. +# Utilities exposed through environemnt +# - should be helpful for various WebRTC sub components. +# - should be thread safe. +# - should have a default implementation. +# - should provide functionality different to existing utilities in the +# environemnt. +# - should need at most one instance per peer connection. +set noparent +include ../../OWNERS_INFRA + +danilchap@webrtc.org +hta@webrtc.org +mbonadei@webrtc.org diff --git a/third_party/libwebrtc/api/environment/environment.h b/third_party/libwebrtc/api/environment/environment.h new file mode 100644 index 0000000000..d86b7ae780 --- /dev/null +++ b/third_party/libwebrtc/api/environment/environment.h @@ -0,0 +1,148 @@ +/* + * Copyright 2023 The WebRTC Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +// This header file provides wrapper for common WebRTC utilities. +// Different application may need different implementations of these utilities, +// Moreover, single application may need to use WebRTC for multiple purposes, +// and thus would need to provide different utilities implementations for +// different peer connections. +// The main purpose of the `Environment` class below is to propagate references +// to those utilities to all WebRTC classes that need them. + +#ifndef API_ENVIRONMENT_ENVIRONMENT_H_ +#define API_ENVIRONMENT_ENVIRONMENT_H_ + +#include <utility> + +#include "absl/base/nullability.h" +#include "api/ref_counted_base.h" +#include "api/scoped_refptr.h" +#include "rtc_base/system/rtc_export.h" + +namespace webrtc { + +// These classes are forward declared to keep Environment dependencies +// lightweight. Users who need any of the types below should include their +// header explicitely. +class Clock; +class TaskQueueFactory; +class FieldTrialsView; +class RtcEventLog; + +// Contains references to WebRTC utilities. Object of this class should be +// passed as a construction parameter and saved by value in each class that +// needs it. Most classes shouldn't create a new instance of the `Environment`, +// but instead should use a propagated copy. +// Usually Environment should be the first parameter in a constructor or a +// factory, and the first member in the class. Keeping Environment as the first +// member in the class ensures utilities (e.g. clock) are still valid during +// destruction of other members. +// +// Example: +// class PeerConnection { +// public: +// PeerConnection(const Environment& env, ...) +// : env_(env), +// log_duration_on_destruction_(&env_.clock()), +// rtp_manager_(env_, ...), +// ... +// +// const FieldTrialsView& trials() const { return env_.field_trials(); } +// +// scoped_refptr<RtpTransceiverInterface> AddTransceiver(...) { +// return make_ref_counted<RtpTransceiverImpl>(env_, ...); +// } +// +// private: +// const Environment env_; +// Stats log_duration_on_destruction_; +// RtpTransmissionManager rtp_manager_; +// }; +// This class is thread safe. +class RTC_EXPORT Environment final { + public: + // Default constructor is deleted in favor of creating this object using + // `EnvironmentFactory`. To create the default environment use + // `EnvironmentFactory().Create()` or `CreateEnvironment()`. + Environment() = delete; + + Environment(const Environment&) = default; + Environment(Environment&&) = default; + Environment& operator=(const Environment&) = default; + Environment& operator=(Environment&&) = default; + + ~Environment() = default; + + // Provides means to alter behavior, mostly for A/B testing new features. + // See ../../g3doc/field-trials.md + const FieldTrialsView& field_trials() const; + + // Provides an interface to query current time. + // See ../../g3doc/implementation_basics.md#time + Clock& clock() const; + + // Provides a factory for task queues, WebRTC threading primitives. + // See ../../g3doc/implementation_basics.md#threads + TaskQueueFactory& task_queue_factory() const; + + // Provides an interface for collecting structured logs. + // See ../../logging/g3doc/rtc_event_log.md + RtcEventLog& event_log() const; + + private: + friend class EnvironmentFactory; + Environment(scoped_refptr<const rtc::RefCountedBase> storage, + absl::Nonnull<const FieldTrialsView*> field_trials, + absl::Nonnull<Clock*> clock, + absl::Nonnull<TaskQueueFactory*> task_queue_factory, + absl::Nonnull<RtcEventLog*> event_log) + : storage_(std::move(storage)), + field_trials_(field_trials), + clock_(clock), + task_queue_factory_(task_queue_factory), + event_log_(event_log) {} + + // Container that keeps ownership of the utilities below. + // Defining this as a RefCountedBase allows `Environment` to share this + // storage with another `Environment`, in particular allows `Environment` to + // be copyable. It is up to the `EnvironmentFactory` to provide an object that + // ensures references to utilties below are valid while object in the + // `storage_` is alive. + scoped_refptr<const rtc::RefCountedBase> storage_; + + absl::Nonnull<const FieldTrialsView*> field_trials_; + absl::Nonnull<Clock*> clock_; + absl::Nonnull<TaskQueueFactory*> task_queue_factory_; + absl::Nonnull<RtcEventLog*> event_log_; +}; + +//------------------------------------------------------------------------------ +// Implementation details follow +//------------------------------------------------------------------------------ + +inline const FieldTrialsView& Environment::field_trials() const { + return *field_trials_; +} + +inline Clock& Environment::clock() const { + return *clock_; +} + +inline TaskQueueFactory& Environment::task_queue_factory() const { + return *task_queue_factory_; +} + +inline RtcEventLog& Environment::event_log() const { + return *event_log_; +} + +} // namespace webrtc + +#endif // API_ENVIRONMENT_ENVIRONMENT_H_ diff --git a/third_party/libwebrtc/api/environment/environment_factory.cc b/third_party/libwebrtc/api/environment/environment_factory.cc new file mode 100644 index 0000000000..c0b681aa08 --- /dev/null +++ b/third_party/libwebrtc/api/environment/environment_factory.cc @@ -0,0 +1,123 @@ +/* + * Copyright 2023 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#include "api/environment/environment_factory.h" + +#include <memory> +#include <utility> +#include <vector> + +#include "api/make_ref_counted.h" +#include "api/rtc_event_log/rtc_event_log.h" +#include "api/task_queue/default_task_queue_factory.h" +#include "api/transport/field_trial_based_config.h" +#include "rtc_base/checks.h" +#include "system_wrappers/include/clock.h" + +namespace webrtc { +namespace { + +template <typename T> +void Store(absl::Nonnull<std::unique_ptr<T>> value, + scoped_refptr<const rtc::RefCountedBase>& leaf) { + class StorageNode : public rtc::RefCountedBase { + public: + StorageNode(scoped_refptr<const rtc::RefCountedBase> parent, + absl::Nonnull<std::unique_ptr<T>> value) + : parent_(std::move(parent)), value_(std::move(value)) {} + + StorageNode(const StorageNode&) = delete; + StorageNode& operator=(const StorageNode&) = delete; + + ~StorageNode() override = default; + + private: + scoped_refptr<const rtc::RefCountedBase> parent_; + absl::Nonnull<std::unique_ptr<T>> value_; + }; + + // Utilities provided with ownership form a tree: + // Root is nullptr, each node keeps an ownership of one utility. + // Each child node has a link to the parent, but parent is unaware of its + // children. Each `EnvironmentFactory` and `Environment` keep a reference to a + // 'leaf_' - node with the last provided utility. This way `Environment` keeps + // ownership of a single branch of the storage tree with each used utiltity + // owned by one of the nodes on that branch. + leaf = rtc::make_ref_counted<StorageNode>(std::move(leaf), std::move(value)); +} + +} // namespace + +EnvironmentFactory::EnvironmentFactory(const Environment& env) + : leaf_(env.storage_), + field_trials_(env.field_trials_), + clock_(env.clock_), + task_queue_factory_(env.task_queue_factory_), + event_log_(env.event_log_) {} + +void EnvironmentFactory::Set( + absl::Nullable<std::unique_ptr<const FieldTrialsView>> utility) { + if (utility != nullptr) { + field_trials_ = utility.get(); + Store(std::move(utility), leaf_); + } +} + +void EnvironmentFactory::Set(absl::Nullable<std::unique_ptr<Clock>> utility) { + if (utility != nullptr) { + clock_ = utility.get(); + Store(std::move(utility), leaf_); + } +} + +void EnvironmentFactory::Set( + absl::Nullable<std::unique_ptr<TaskQueueFactory>> utility) { + if (utility != nullptr) { + task_queue_factory_ = utility.get(); + Store(std::move(utility), leaf_); + } +} + +void EnvironmentFactory::Set( + absl::Nullable<std::unique_ptr<RtcEventLog>> utility) { + if (utility != nullptr) { + event_log_ = utility.get(); + Store(std::move(utility), leaf_); + } +} + +Environment EnvironmentFactory::CreateWithDefaults() && { + if (field_trials_ == nullptr) { + Set(std::make_unique<FieldTrialBasedConfig>()); + } + if (clock_ == nullptr) { + Set(Clock::GetRealTimeClock()); + } + if (task_queue_factory_ == nullptr) { + Set(CreateDefaultTaskQueueFactory(field_trials_)); + } + if (event_log_ == nullptr) { + Set(std::make_unique<RtcEventLogNull>()); + } + + RTC_DCHECK(field_trials_ != nullptr); + RTC_DCHECK(clock_ != nullptr); + RTC_DCHECK(task_queue_factory_ != nullptr); + RTC_DCHECK(event_log_ != nullptr); + return Environment(std::move(leaf_), // + field_trials_, clock_, task_queue_factory_, event_log_); +} + +Environment EnvironmentFactory::Create() const { + // Create a temporary copy to avoid mutating `this` with default utilities. + return EnvironmentFactory(*this).CreateWithDefaults(); +} + +} // namespace webrtc diff --git a/third_party/libwebrtc/api/environment/environment_factory.h b/third_party/libwebrtc/api/environment/environment_factory.h new file mode 100644 index 0000000000..a0fc3effdb --- /dev/null +++ b/third_party/libwebrtc/api/environment/environment_factory.h @@ -0,0 +1,148 @@ +/* + * Copyright 2023 The WebRTC Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef API_ENVIRONMENT_ENVIRONMENT_FACTORY_H_ +#define API_ENVIRONMENT_ENVIRONMENT_FACTORY_H_ + +#include <memory> +#include <utility> + +#include "absl/base/nullability.h" +#include "api/environment/environment.h" +#include "api/ref_counted_base.h" +#include "api/scoped_refptr.h" +#include "rtc_base/system/rtc_export.h" + +namespace webrtc { + +// These classes are forward declared to reduce amount of headers exposed +// through api header. +class Clock; +class TaskQueueFactory; +class FieldTrialsView; +class RtcEventLog; + +// Constructs `Environment`. +// Individual utilities are provided using one of the `Set` functions. +// `Set` functions do nothing when nullptr value is passed. +// Creates default implementations for utilities that are not provided. +// +// Examples: +// Environment default_env = EnvironmentFactory().Create(); +// +// EnvironmentFactory factory; +// factory.Set(std::make_unique<CustomTaskQueueFactory>()); +// factory.Set(std::make_unique<CustomFieldTrials>()); +// Environment custom_env = factory.Create(); +// +class RTC_EXPORT EnvironmentFactory final { + public: + EnvironmentFactory() = default; + explicit EnvironmentFactory(const Environment& env); + + EnvironmentFactory(const EnvironmentFactory&) = default; + EnvironmentFactory(EnvironmentFactory&&) = default; + EnvironmentFactory& operator=(const EnvironmentFactory&) = default; + EnvironmentFactory& operator=(EnvironmentFactory&&) = default; + + ~EnvironmentFactory() = default; + + void Set(absl::Nullable<std::unique_ptr<const FieldTrialsView>> utility); + void Set(absl::Nullable<std::unique_ptr<Clock>> utility); + void Set(absl::Nullable<std::unique_ptr<TaskQueueFactory>> utility); + void Set(absl::Nullable<std::unique_ptr<RtcEventLog>> utility); + + void Set(absl::Nullable<const FieldTrialsView*> utility); + void Set(absl::Nullable<Clock*> utility); + void Set(absl::Nullable<TaskQueueFactory*> utility); + void Set(absl::Nullable<RtcEventLog*> utility); + + Environment Create() const; + + private: + Environment CreateWithDefaults() &&; + + scoped_refptr<const rtc::RefCountedBase> leaf_; + + absl::Nullable<const FieldTrialsView*> field_trials_ = nullptr; + absl::Nullable<Clock*> clock_ = nullptr; + absl::Nullable<TaskQueueFactory*> task_queue_factory_ = nullptr; + absl::Nullable<RtcEventLog*> event_log_ = nullptr; +}; + +// Helper for concise way to create an environment. +// `Environment env = CreateEnvironment(utility1, utility2)` is a shortcut to +// `EnvironmentFactory factory; +// factory.Set(utility1); +// factory.Set(utility2); +// Environment env = factory.Create();` +// +// Examples: +// Environment default_env = CreateEnvironment(); +// Environment custom_env = +// CreateEnvironment(std::make_unique<CustomTaskQueueFactory>(), +// std::make_unique<CustomFieldTrials>()); +template <typename... Utilities> +Environment CreateEnvironment(Utilities&&... utilities); + +//------------------------------------------------------------------------------ +// Implementation details follow +//------------------------------------------------------------------------------ + +inline void EnvironmentFactory::Set( + absl::Nullable<const FieldTrialsView*> utility) { + if (utility != nullptr) { + field_trials_ = utility; + } +} + +inline void EnvironmentFactory::Set(absl::Nullable<Clock*> utility) { + if (utility != nullptr) { + clock_ = utility; + } +} + +inline void EnvironmentFactory::Set(absl::Nullable<TaskQueueFactory*> utility) { + if (utility != nullptr) { + task_queue_factory_ = utility; + } +} + +inline void EnvironmentFactory::Set(absl::Nullable<RtcEventLog*> utility) { + if (utility != nullptr) { + event_log_ = utility; + } +} + +namespace webrtc_create_environment_internal { + +inline void Set(EnvironmentFactory& factory) {} + +template <typename FirstUtility, typename... Utilities> +void Set(EnvironmentFactory& factory, + FirstUtility&& first, + Utilities&&... utilities) { + factory.Set(std::forward<FirstUtility>(first)); + Set(factory, std::forward<Utilities>(utilities)...); +} + +} // namespace webrtc_create_environment_internal + +template <typename... Utilities> +Environment CreateEnvironment(Utilities&&... utilities) { + EnvironmentFactory factory; + webrtc_create_environment_internal::Set( + factory, std::forward<Utilities>(utilities)...); + return factory.Create(); +} + +} // namespace webrtc + +#endif // API_ENVIRONMENT_ENVIRONMENT_FACTORY_H_ diff --git a/third_party/libwebrtc/api/environment/environment_gn/moz.build b/third_party/libwebrtc/api/environment/environment_gn/moz.build new file mode 100644 index 0000000000..e7105ff573 --- /dev/null +++ b/third_party/libwebrtc/api/environment/environment_gn/moz.build @@ -0,0 +1,198 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + + + ### This moz.build was AUTOMATICALLY GENERATED from a GN config, ### + ### DO NOT edit it by hand. ### + +COMPILE_FLAGS["OS_INCLUDES"] = [] +AllowCompilerWarnings() + +DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1" +DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True +DEFINES["RTC_ENABLE_VP9"] = True +DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0" +DEFINES["WEBRTC_LIBRARY_IMPL"] = True +DEFINES["WEBRTC_MOZILLA_BUILD"] = True +DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0" +DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0" + +FINAL_LIBRARY = "webrtc" + + +LOCAL_INCLUDES += [ + "!/ipc/ipdl/_ipdlheaders", + "!/third_party/libwebrtc/gen", + "/ipc/chromium/src", + "/third_party/libwebrtc/", + "/third_party/libwebrtc/third_party/abseil-cpp/", + "/tools/profiler/public" +] + +if not CONFIG["MOZ_DEBUG"]: + + DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "0" + DEFINES["NDEBUG"] = True + DEFINES["NVALGRIND"] = True + +if CONFIG["MOZ_DEBUG"] == "1": + + DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1" + +if CONFIG["OS_TARGET"] == "Android": + + DEFINES["ANDROID"] = True + DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1" + DEFINES["HAVE_SYS_UIO_H"] = True + DEFINES["WEBRTC_ANDROID"] = True + DEFINES["WEBRTC_ANDROID_OPENSLES"] = True + DEFINES["WEBRTC_ENABLE_LIBEVENT"] = True + DEFINES["WEBRTC_LINUX"] = True + DEFINES["WEBRTC_POSIX"] = True + DEFINES["_GNU_SOURCE"] = True + DEFINES["__STDC_CONSTANT_MACROS"] = True + DEFINES["__STDC_FORMAT_MACROS"] = True + +if CONFIG["OS_TARGET"] == "Darwin": + + DEFINES["WEBRTC_MAC"] = True + DEFINES["WEBRTC_POSIX"] = True + DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True + DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0" + DEFINES["__STDC_CONSTANT_MACROS"] = True + DEFINES["__STDC_FORMAT_MACROS"] = True + +if CONFIG["OS_TARGET"] == "Linux": + + DEFINES["USE_AURA"] = "1" + DEFINES["USE_GLIB"] = "1" + DEFINES["USE_NSS_CERTS"] = "1" + DEFINES["USE_OZONE"] = "1" + DEFINES["USE_UDEV"] = True + DEFINES["WEBRTC_ENABLE_LIBEVENT"] = True + DEFINES["WEBRTC_LINUX"] = True + DEFINES["WEBRTC_POSIX"] = True + DEFINES["_FILE_OFFSET_BITS"] = "64" + DEFINES["_LARGEFILE64_SOURCE"] = True + DEFINES["_LARGEFILE_SOURCE"] = True + DEFINES["__STDC_CONSTANT_MACROS"] = True + DEFINES["__STDC_FORMAT_MACROS"] = True + +if CONFIG["OS_TARGET"] == "OpenBSD": + + DEFINES["USE_GLIB"] = "1" + DEFINES["USE_OZONE"] = "1" + DEFINES["USE_X11"] = "1" + DEFINES["WEBRTC_BSD"] = True + DEFINES["WEBRTC_ENABLE_LIBEVENT"] = True + DEFINES["WEBRTC_POSIX"] = True + DEFINES["_FILE_OFFSET_BITS"] = "64" + DEFINES["_LARGEFILE64_SOURCE"] = True + DEFINES["_LARGEFILE_SOURCE"] = True + DEFINES["__STDC_CONSTANT_MACROS"] = True + DEFINES["__STDC_FORMAT_MACROS"] = True + +if CONFIG["OS_TARGET"] == "WINNT": + + DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True + DEFINES["NOMINMAX"] = True + DEFINES["NTDDI_VERSION"] = "0x0A000000" + DEFINES["PSAPI_VERSION"] = "2" + DEFINES["RTC_ENABLE_WIN_WGC"] = True + DEFINES["UNICODE"] = True + DEFINES["USE_AURA"] = "1" + DEFINES["WEBRTC_WIN"] = True + DEFINES["WIN32"] = True + DEFINES["WIN32_LEAN_AND_MEAN"] = True + DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP" + DEFINES["WINVER"] = "0x0A00" + DEFINES["_ATL_NO_OPENGL"] = True + DEFINES["_CRT_RAND_S"] = True + DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True + DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True + DEFINES["_HAS_EXCEPTIONS"] = "0" + DEFINES["_HAS_NODISCARD"] = True + DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True + DEFINES["_SECURE_ATL"] = True + DEFINES["_UNICODE"] = True + DEFINES["_WIN32_WINNT"] = "0x0A00" + DEFINES["_WINDOWS"] = True + DEFINES["__STD_C"] = True + +if CONFIG["TARGET_CPU"] == "aarch64": + + DEFINES["WEBRTC_ARCH_ARM64"] = True + DEFINES["WEBRTC_HAS_NEON"] = True + +if CONFIG["TARGET_CPU"] == "arm": + + DEFINES["WEBRTC_ARCH_ARM"] = True + DEFINES["WEBRTC_ARCH_ARM_V7"] = True + DEFINES["WEBRTC_HAS_NEON"] = True + +if CONFIG["TARGET_CPU"] == "mips32": + + DEFINES["MIPS32_LE"] = True + DEFINES["MIPS_FPU_LE"] = True + DEFINES["_GNU_SOURCE"] = True + +if CONFIG["TARGET_CPU"] == "mips64": + + DEFINES["_GNU_SOURCE"] = True + +if CONFIG["TARGET_CPU"] == "x86": + + DEFINES["WEBRTC_ENABLE_AVX2"] = True + +if CONFIG["TARGET_CPU"] == "x86_64": + + DEFINES["WEBRTC_ENABLE_AVX2"] = True + +if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android": + + DEFINES["_DEBUG"] = True + +if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin": + + DEFINES["_DEBUG"] = True + +if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux": + + DEFINES["_DEBUG"] = True + +if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD": + + DEFINES["_DEBUG"] = True + +if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT": + + DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0" + +if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": + + DEFINES["USE_X11"] = "1" + +if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": + + OS_LIBS += [ + "unwind" + ] + +if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": + + DEFINES["_GNU_SOURCE"] = True + +if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm": + + DEFINES["_GNU_SOURCE"] = True + +if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86": + + DEFINES["_GNU_SOURCE"] = True + +if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64": + + DEFINES["_GNU_SOURCE"] = True + +Library("environment_gn") diff --git a/third_party/libwebrtc/api/environment/environment_unittest.cc b/third_party/libwebrtc/api/environment/environment_unittest.cc new file mode 100644 index 0000000000..07bd8793bc --- /dev/null +++ b/third_party/libwebrtc/api/environment/environment_unittest.cc @@ -0,0 +1,275 @@ +/* + * Copyright (c) 2023 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#include "api/environment/environment.h" + +#include <memory> +#include <string> +#include <utility> +#include <vector> + +#include "absl/functional/any_invocable.h" +#include "absl/types/optional.h" +#include "api/environment/environment_factory.h" +#include "api/field_trials_view.h" +#include "api/rtc_event_log/rtc_event_log.h" +#include "api/task_queue/task_queue_factory.h" +#include "api/units/timestamp.h" +#include "system_wrappers/include/clock.h" +#include "test/gmock.h" +#include "test/gtest.h" + +namespace webrtc { +namespace { + +using ::testing::ElementsAre; +using ::testing::IsEmpty; +using ::testing::Not; +using ::testing::NotNull; +using ::testing::Ref; + +class FakeEvent : public RtcEvent { + public: + Type GetType() const override { return RtcEvent::Type::FakeEvent; } + bool IsConfigEvent() const override { return false; } +}; + +class FakeFieldTrials : public FieldTrialsView { + public: + explicit FakeFieldTrials(absl::AnyInvocable<void() &&> on_destroyed = nullptr) + : on_destroyed_(std::move(on_destroyed)) {} + ~FakeFieldTrials() override { + if (on_destroyed_ != nullptr) { + std::move(on_destroyed_)(); + } + } + + std::string Lookup(absl::string_view key) const override { return "fake"; } + + private: + absl::AnyInvocable<void() &&> on_destroyed_; +}; + +class FakeTaskQueueFactory : public TaskQueueFactory { + public: + explicit FakeTaskQueueFactory( + absl::AnyInvocable<void() &&> on_destroyed = nullptr) + : on_destroyed_(std::move(on_destroyed)) {} + ~FakeTaskQueueFactory() override { + if (on_destroyed_ != nullptr) { + std::move(on_destroyed_)(); + } + } + + std::unique_ptr<TaskQueueBase, TaskQueueDeleter> CreateTaskQueue( + absl::string_view name, + Priority priority) const override { + return nullptr; + } + + private: + absl::AnyInvocable<void() &&> on_destroyed_; +}; + +TEST(EnvironmentTest, DefaultEnvironmentHasAllUtilities) { + Environment env = EnvironmentFactory().Create(); + + // Try to use each utility, expect no crashes. + env.clock().CurrentTime(); + EXPECT_THAT(env.task_queue_factory().CreateTaskQueue( + "test", TaskQueueFactory::Priority::NORMAL), + NotNull()); + env.event_log().Log(std::make_unique<FakeEvent>()); + env.field_trials().Lookup("WebRTC-Debugging-RtpDump"); +} + +TEST(EnvironmentTest, UsesProvidedUtilitiesWithOwnership) { + auto owned_field_trials = std::make_unique<FakeFieldTrials>(); + auto owned_task_queue_factory = std::make_unique<FakeTaskQueueFactory>(); + auto owned_clock = std::make_unique<SimulatedClock>(Timestamp::Zero()); + auto owned_event_log = std::make_unique<RtcEventLogNull>(); + + FieldTrialsView& field_trials = *owned_field_trials; + TaskQueueFactory& task_queue_factory = *owned_task_queue_factory; + Clock& clock = *owned_clock; + RtcEventLog& event_log = *owned_event_log; + + Environment env = CreateEnvironment( + std::move(owned_field_trials), std::move(owned_clock), + std::move(owned_task_queue_factory), std::move(owned_event_log)); + + EXPECT_THAT(env.field_trials(), Ref(field_trials)); + EXPECT_THAT(env.task_queue_factory(), Ref(task_queue_factory)); + EXPECT_THAT(env.clock(), Ref(clock)); + EXPECT_THAT(env.event_log(), Ref(event_log)); +} + +TEST(EnvironmentTest, UsesProvidedUtilitiesWithoutOwnership) { + FakeFieldTrials field_trials; + FakeTaskQueueFactory task_queue_factory; + SimulatedClock clock(Timestamp::Zero()); + RtcEventLogNull event_log; + + Environment env = + CreateEnvironment(&field_trials, &clock, &task_queue_factory, &event_log); + + EXPECT_THAT(env.field_trials(), Ref(field_trials)); + EXPECT_THAT(env.task_queue_factory(), Ref(task_queue_factory)); + EXPECT_THAT(env.clock(), Ref(clock)); + EXPECT_THAT(env.event_log(), Ref(event_log)); +} + +TEST(EnvironmentTest, UsesLastProvidedUtility) { + auto owned_field_trials1 = std::make_unique<FakeFieldTrials>(); + auto owned_field_trials2 = std::make_unique<FakeFieldTrials>(); + FieldTrialsView& field_trials2 = *owned_field_trials2; + + Environment env = CreateEnvironment(std::move(owned_field_trials1), + std::move(owned_field_trials2)); + + EXPECT_THAT(env.field_trials(), Ref(field_trials2)); +} + +// Utilities can be provided from different sources, and when some source +// choose not to provide an utility, it is usually expressed with nullptr. +// When utility is not provided, it is natural to use previously set one. +// E.g. Both PeerConnectionFactoryDependencies and PeerConnectionDependencies +// provide field trials. When PeerConnectionDependencies::trials == nullptr, +// then trials from the PeerConnectionFactoryDependencies should be used. +// With nullptr accepted and ignored this can be expressed by +// `Environemt env = CreateEnvironment(pcf_deps.trials, pc_deps.trials);` +// That would use pc_deps.trials when not nullptr, pcf_deps.trials when +// pc_deps.trials is nullptr, but pcf_deps.trials is not, and default field +// trials when both are nullptr. +TEST(EnvironmentTest, IgnoresProvidedNullptrUtility) { + auto owned_field_trials = std::make_unique<FakeFieldTrials>(); + std::unique_ptr<FieldTrialsView> null_field_trials = nullptr; + FieldTrialsView& field_trials = *owned_field_trials; + + Environment env = CreateEnvironment(std::move(owned_field_trials), + std::move(null_field_trials)); + + EXPECT_THAT(env.field_trials(), Ref(field_trials)); +} + +TEST(EnvironmentTest, KeepsUtilityAliveWhileEnvironmentIsAlive) { + bool utility_destroyed = false; + auto field_trials = std::make_unique<FakeFieldTrials>( + /*on_destroyed=*/[&] { utility_destroyed = true; }); + + // Wrap Environment into optional to have explicit control when it is deleted. + absl::optional<Environment> env = CreateEnvironment(std::move(field_trials)); + + EXPECT_FALSE(utility_destroyed); + env = absl::nullopt; + EXPECT_TRUE(utility_destroyed); +} + +TEST(EnvironmentTest, KeepsUtilityAliveWhileCopyOfEnvironmentIsAlive) { + bool utility_destroyed = false; + auto field_trials = std::make_unique<FakeFieldTrials>( + /*on_destroyed=*/[&] { utility_destroyed = true; }); + + absl::optional<Environment> env1 = CreateEnvironment(std::move(field_trials)); + absl::optional<Environment> env2 = env1; + + EXPECT_FALSE(utility_destroyed); + env1 = absl::nullopt; + EXPECT_FALSE(utility_destroyed); + env2 = absl::nullopt; + EXPECT_TRUE(utility_destroyed); +} + +TEST(EnvironmentTest, FactoryCanBeReusedToCreateDifferentEnvironments) { + auto owned_task_queue_factory = std::make_unique<FakeTaskQueueFactory>(); + auto owned_field_trials1 = std::make_unique<FakeFieldTrials>(); + auto owned_field_trials2 = std::make_unique<FakeFieldTrials>(); + TaskQueueFactory& task_queue_factory = *owned_task_queue_factory; + FieldTrialsView& field_trials1 = *owned_field_trials1; + FieldTrialsView& field_trials2 = *owned_field_trials2; + + EnvironmentFactory factory; + factory.Set(std::move(owned_task_queue_factory)); + factory.Set(std::move(owned_field_trials1)); + Environment env1 = factory.Create(); + factory.Set(std::move(owned_field_trials2)); + Environment env2 = factory.Create(); + + // Environments share the same custom task queue factory. + EXPECT_THAT(env1.task_queue_factory(), Ref(task_queue_factory)); + EXPECT_THAT(env2.task_queue_factory(), Ref(task_queue_factory)); + + // Environments have different field trials. + EXPECT_THAT(env1.field_trials(), Ref(field_trials1)); + EXPECT_THAT(env2.field_trials(), Ref(field_trials2)); +} + +TEST(EnvironmentTest, FactoryCanCreateNewEnvironmentFromExistingOne) { + Environment env1 = + CreateEnvironment(std::make_unique<FakeTaskQueueFactory>()); + EnvironmentFactory factory(env1); + factory.Set(std::make_unique<FakeFieldTrials>()); + Environment env2 = factory.Create(); + + // Environments share the same default clock. + EXPECT_THAT(env2.clock(), Ref(env1.clock())); + + // Environments share the same custom task queue factory. + EXPECT_THAT(env2.task_queue_factory(), Ref(env1.task_queue_factory())); + + // Environments have different field trials. + EXPECT_THAT(env2.field_trials(), Not(Ref(env1.field_trials()))); +} + +TEST(EnvironmentTest, KeepsOwnershipsWhenCreateNewEnvironmentFromExistingOne) { + bool utility1_destroyed = false; + bool utility2_destroyed = false; + absl::optional<Environment> env1 = + CreateEnvironment(std::make_unique<FakeTaskQueueFactory>( + /*on_destroyed=*/[&] { utility1_destroyed = true; })); + + absl::optional<EnvironmentFactory> factory = EnvironmentFactory(*env1); + + // Destroy env1, check utility1 it was using is still alive. + env1 = absl::nullopt; + EXPECT_FALSE(utility1_destroyed); + + factory->Set(std::make_unique<FakeFieldTrials>( + /*on_destroyed=*/[&] { utility2_destroyed = true; })); + absl::optional<Environment> env2 = factory->Create(); + + // Destroy the factory, check all utilities used by env2 are alive. + factory = absl::nullopt; + EXPECT_FALSE(utility1_destroyed); + EXPECT_FALSE(utility2_destroyed); + + // Once last Environment object is deleted, utilties should be deleted too. + env2 = absl::nullopt; + EXPECT_TRUE(utility1_destroyed); + EXPECT_TRUE(utility2_destroyed); +} + +TEST(EnvironmentTest, DestroysUtilitiesInReverseProvidedOrder) { + std::vector<std::string> destroyed; + auto field_trials = std::make_unique<FakeFieldTrials>( + /*on_destroyed=*/[&] { destroyed.push_back("field_trials"); }); + auto task_queue_factory = std::make_unique<FakeTaskQueueFactory>( + /*on_destroyed=*/[&] { destroyed.push_back("task_queue_factory"); }); + + absl::optional<Environment> env = + CreateEnvironment(std::move(field_trials), std::move(task_queue_factory)); + + ASSERT_THAT(destroyed, IsEmpty()); + env = absl::nullopt; + EXPECT_THAT(destroyed, ElementsAre("task_queue_factory", "field_trials")); +} + +} // namespace +} // namespace webrtc diff --git a/third_party/libwebrtc/api/fec_controller_api_gn/moz.build b/third_party/libwebrtc/api/fec_controller_api_gn/moz.build index a0129cce5a..619ea937f0 100644 --- a/third_party/libwebrtc/api/fec_controller_api_gn/moz.build +++ b/third_party/libwebrtc/api/fec_controller_api_gn/moz.build @@ -180,16 +180,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/field_trials_registry_gn/moz.build b/third_party/libwebrtc/api/field_trials_registry_gn/moz.build index 5133134fc2..01ce20c5a6 100644 --- a/third_party/libwebrtc/api/field_trials_registry_gn/moz.build +++ b/third_party/libwebrtc/api/field_trials_registry_gn/moz.build @@ -195,7 +195,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -205,10 +204,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/field_trials_view_gn/moz.build b/third_party/libwebrtc/api/field_trials_view_gn/moz.build index 0e5ed09f70..967e416aad 100644 --- a/third_party/libwebrtc/api/field_trials_view_gn/moz.build +++ b/third_party/libwebrtc/api/field_trials_view_gn/moz.build @@ -176,16 +176,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/frame_transformer_interface.h b/third_party/libwebrtc/api/frame_transformer_interface.h index d1ea15a54e..afa79b92ea 100644 --- a/third_party/libwebrtc/api/frame_transformer_interface.h +++ b/third_party/libwebrtc/api/frame_transformer_interface.h @@ -13,12 +13,11 @@ #include <memory> #include <string> -#include <vector> +#include "api/ref_count.h" #include "api/scoped_refptr.h" #include "api/video/encoded_frame.h" #include "api/video/video_frame_metadata.h" -#include "rtc_base/ref_count.h" namespace webrtc { @@ -54,11 +53,7 @@ class TransformableFrameInterface { // sender frames to allow received frames to be directly re-transmitted on // other PeerConnectionss. virtual Direction GetDirection() const { return Direction::kUnknown; } - virtual std::string GetMimeType() const { - // TODO(bugs.webrtc.org/15579): Change this to pure virtual after it - // is implemented everywhere. - return "unknown/unknown"; - } + virtual std::string GetMimeType() const = 0; }; class TransformableVideoFrameInterface : public TransformableFrameInterface { @@ -100,6 +95,12 @@ class TransformedFrameCallback : public rtc::RefCountInterface { virtual void OnTransformedFrame( std::unique_ptr<TransformableFrameInterface> frame) = 0; + // Request to no longer be called on each frame, instead having frames be + // sent directly to OnTransformedFrame without additional work. + // TODO(crbug.com/1502781): Make pure virtual once all mocks have + // implementations. + virtual void StartShortCircuiting() {} + protected: ~TransformedFrameCallback() override = default; }; diff --git a/third_party/libwebrtc/api/frame_transformer_interface_gn/moz.build b/third_party/libwebrtc/api/frame_transformer_interface_gn/moz.build index 20da3e9cdb..ea4cac1276 100644 --- a/third_party/libwebrtc/api/frame_transformer_interface_gn/moz.build +++ b/third_party/libwebrtc/api/frame_transformer_interface_gn/moz.build @@ -187,16 +187,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/function_view_gn/moz.build b/third_party/libwebrtc/api/function_view_gn/moz.build index 0854c1f771..980c9d9ca6 100644 --- a/third_party/libwebrtc/api/function_view_gn/moz.build +++ b/third_party/libwebrtc/api/function_view_gn/moz.build @@ -180,16 +180,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/ice_transport_interface.h b/third_party/libwebrtc/api/ice_transport_interface.h index 001395c215..f4c7613fa8 100644 --- a/third_party/libwebrtc/api/ice_transport_interface.h +++ b/third_party/libwebrtc/api/ice_transport_interface.h @@ -14,11 +14,10 @@ #include <string> #include "api/async_dns_resolver.h" -#include "api/async_resolver_factory.h" +#include "api/ref_count.h" #include "api/rtc_error.h" #include "api/rtc_event_log/rtc_event_log.h" #include "api/scoped_refptr.h" -#include "rtc_base/ref_count.h" namespace cricket { class IceTransportInternal; @@ -33,7 +32,7 @@ class FieldTrialsView; // An ICE transport, as represented to the outside world. // This object is refcounted, and is therefore alive until the // last holder has released it. -class IceTransportInterface : public rtc::RefCountInterface { +class IceTransportInterface : public webrtc::RefCountInterface { public: // Accessor for the internal representation of an ICE transport. // The returned object can only be safely used on the signalling thread. @@ -61,19 +60,8 @@ struct IceTransportInit final { } void set_async_dns_resolver_factory( AsyncDnsResolverFactoryInterface* async_dns_resolver_factory) { - RTC_DCHECK(!async_resolver_factory_); async_dns_resolver_factory_ = async_dns_resolver_factory; } - [[deprecated("Use async_dns_resolver_factory")]] AsyncResolverFactory* - async_resolver_factory() { - return async_resolver_factory_; - } - ABSL_DEPRECATED("bugs.webrtc.org/12598") - void set_async_resolver_factory( - AsyncResolverFactory* async_resolver_factory) { - RTC_DCHECK(!async_dns_resolver_factory_); - async_resolver_factory_ = async_resolver_factory; - } RtcEventLog* event_log() { return event_log_; } void set_event_log(RtcEventLog* event_log) { event_log_ = event_log; } @@ -115,11 +103,6 @@ struct IceTransportInit final { private: cricket::PortAllocator* port_allocator_ = nullptr; AsyncDnsResolverFactoryInterface* async_dns_resolver_factory_ = nullptr; -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - // For backwards compatibility. Only one resolver factory can be set. - AsyncResolverFactory* async_resolver_factory_ = nullptr; -#pragma clang diagnostic pop RtcEventLog* event_log_ = nullptr; cricket::IceControllerFactoryInterface* ice_controller_factory_ = nullptr; cricket::ActiveIceControllerFactoryInterface* active_ice_controller_factory_ = diff --git a/third_party/libwebrtc/api/jsep.h b/third_party/libwebrtc/api/jsep.h index d2aa57c784..643a99d315 100644 --- a/third_party/libwebrtc/api/jsep.h +++ b/third_party/libwebrtc/api/jsep.h @@ -27,8 +27,8 @@ #include <vector> #include "absl/types/optional.h" +#include "api/ref_count.h" #include "api/rtc_error.h" -#include "rtc_base/ref_count.h" #include "rtc_base/system/rtc_export.h" namespace cricket { @@ -219,7 +219,7 @@ std::unique_ptr<SessionDescriptionInterface> CreateSessionDescription( // CreateOffer and CreateAnswer callback interface. class RTC_EXPORT CreateSessionDescriptionObserver - : public rtc::RefCountInterface { + : public webrtc::RefCountInterface { public: // This callback transfers the ownership of the `desc`. // TODO(deadbeef): Make this take an std::unique_ptr<> to avoid confusion @@ -238,7 +238,8 @@ class RTC_EXPORT CreateSessionDescriptionObserver }; // SetLocalDescription and SetRemoteDescription callback interface. -class RTC_EXPORT SetSessionDescriptionObserver : public rtc::RefCountInterface { +class RTC_EXPORT SetSessionDescriptionObserver + : public webrtc::RefCountInterface { public: virtual void OnSuccess() = 0; // See description in CreateSessionDescriptionObserver for OnFailure. diff --git a/third_party/libwebrtc/api/legacy_stats_types.h b/third_party/libwebrtc/api/legacy_stats_types.h index e49cb6d6dd..70f21d4ad9 100644 --- a/third_party/libwebrtc/api/legacy_stats_types.h +++ b/third_party/libwebrtc/api/legacy_stats_types.h @@ -20,9 +20,9 @@ #include <string> #include <vector> +#include "api/ref_count.h" #include "api/scoped_refptr.h" #include "api/sequence_checker.h" -#include "rtc_base/ref_count.h" #include "rtc_base/system/rtc_export.h" namespace webrtc { @@ -240,7 +240,7 @@ class RTC_EXPORT StatsReport { kStatsValueNameLocalCandidateRelayProtocol, }; - class RTC_EXPORT IdBase : public rtc::RefCountInterface { + class RTC_EXPORT IdBase : public webrtc::RefCountInterface { public: ~IdBase() override; StatsType type() const; diff --git a/third_party/libwebrtc/api/libjingle_logging_api_gn/moz.build b/third_party/libwebrtc/api/libjingle_logging_api_gn/moz.build index 3a6a8537c2..b3a3b0ee1b 100644 --- a/third_party/libwebrtc/api/libjingle_logging_api_gn/moz.build +++ b/third_party/libwebrtc/api/libjingle_logging_api_gn/moz.build @@ -176,16 +176,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/libjingle_peerconnection_api_gn/moz.build b/third_party/libwebrtc/api/libjingle_peerconnection_api_gn/moz.build index b4ff24a0b5..fbbb882ebf 100644 --- a/third_party/libwebrtc/api/libjingle_peerconnection_api_gn/moz.build +++ b/third_party/libwebrtc/api/libjingle_peerconnection_api_gn/moz.build @@ -176,16 +176,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/location_gn/moz.build b/third_party/libwebrtc/api/location_gn/moz.build index 5e7de58f06..dcdca04077 100644 --- a/third_party/libwebrtc/api/location_gn/moz.build +++ b/third_party/libwebrtc/api/location_gn/moz.build @@ -176,16 +176,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/make_ref_counted_gn/moz.build b/third_party/libwebrtc/api/make_ref_counted_gn/moz.build index 2eb6226bfb..f90e274916 100644 --- a/third_party/libwebrtc/api/make_ref_counted_gn/moz.build +++ b/third_party/libwebrtc/api/make_ref_counted_gn/moz.build @@ -176,16 +176,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/media_stream_interface.h b/third_party/libwebrtc/api/media_stream_interface.h index 9d336739e4..4f9bffac85 100644 --- a/third_party/libwebrtc/api/media_stream_interface.h +++ b/third_party/libwebrtc/api/media_stream_interface.h @@ -23,6 +23,7 @@ #include "absl/types/optional.h" #include "api/audio_options.h" +#include "api/ref_count.h" #include "api/scoped_refptr.h" #include "api/video/recordable_encoded_frame.h" #include "api/video/video_frame.h" @@ -30,7 +31,6 @@ #include "api/video/video_source_interface.h" #include "api/video_track_source_constraints.h" #include "modules/audio_processing/include/audio_processing_statistics.h" -#include "rtc_base/ref_count.h" #include "rtc_base/system/rtc_export.h" namespace webrtc { @@ -54,7 +54,7 @@ class NotifierInterface { // Base class for sources. A MediaStreamTrack has an underlying source that // provides media. A source can be shared by multiple tracks. -class RTC_EXPORT MediaSourceInterface : public rtc::RefCountInterface, +class RTC_EXPORT MediaSourceInterface : public webrtc::RefCountInterface, public NotifierInterface { public: enum SourceState { kInitializing, kLive, kEnded, kMuted }; @@ -69,7 +69,7 @@ class RTC_EXPORT MediaSourceInterface : public rtc::RefCountInterface, // C++ version of MediaStreamTrack. // See: https://www.w3.org/TR/mediacapture-streams/#mediastreamtrack -class RTC_EXPORT MediaStreamTrackInterface : public rtc::RefCountInterface, +class RTC_EXPORT MediaStreamTrackInterface : public webrtc::RefCountInterface, public NotifierInterface { public: enum TrackState { @@ -267,7 +267,7 @@ class RTC_EXPORT AudioSourceInterface : public MediaSourceInterface { // Interface of the audio processor used by the audio track to collect // statistics. -class AudioProcessorInterface : public rtc::RefCountInterface { +class AudioProcessorInterface : public webrtc::RefCountInterface { public: struct AudioProcessorStatistics { bool typing_noise_detected = false; @@ -321,7 +321,7 @@ typedef std::vector<rtc::scoped_refptr<VideoTrackInterface> > VideoTrackVector; // must be pushed down. // // Thus, this interface acts as simply a container for tracks. -class MediaStreamInterface : public rtc::RefCountInterface, +class MediaStreamInterface : public webrtc::RefCountInterface, public NotifierInterface { public: virtual std::string id() const = 0; diff --git a/third_party/libwebrtc/api/media_stream_interface_gn/moz.build b/third_party/libwebrtc/api/media_stream_interface_gn/moz.build index b066645cd2..759c156fb7 100644 --- a/third_party/libwebrtc/api/media_stream_interface_gn/moz.build +++ b/third_party/libwebrtc/api/media_stream_interface_gn/moz.build @@ -195,7 +195,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -205,10 +204,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/metronome/metronome.cc b/third_party/libwebrtc/api/metronome/metronome.cc deleted file mode 100644 index 8d74f928a0..0000000000 --- a/third_party/libwebrtc/api/metronome/metronome.cc +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2022 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#include "api/metronome/metronome.h" - -namespace webrtc { - -// TODO(crbug.com/1381982): Remove outdated methods. -void Metronome::AddListener(TickListener* listener) {} -void Metronome::RemoveListener(TickListener* listener) {} - -} // namespace webrtc diff --git a/third_party/libwebrtc/api/metronome/metronome_gn/moz.build b/third_party/libwebrtc/api/metronome/metronome_gn/moz.build index d89c86ef4b..ede22e4998 100644 --- a/third_party/libwebrtc/api/metronome/metronome_gn/moz.build +++ b/third_party/libwebrtc/api/metronome/metronome_gn/moz.build @@ -180,16 +180,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/neteq/default_neteq_controller_factory_gn/moz.build b/third_party/libwebrtc/api/neteq/default_neteq_controller_factory_gn/moz.build index 75602ac512..5d18a89d19 100644 --- a/third_party/libwebrtc/api/neteq/default_neteq_controller_factory_gn/moz.build +++ b/third_party/libwebrtc/api/neteq/default_neteq_controller_factory_gn/moz.build @@ -199,7 +199,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -209,10 +208,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/neteq/neteq_api_gn/moz.build b/third_party/libwebrtc/api/neteq/neteq_api_gn/moz.build index 7c4e1c550a..7ed92b8183 100644 --- a/third_party/libwebrtc/api/neteq/neteq_api_gn/moz.build +++ b/third_party/libwebrtc/api/neteq/neteq_api_gn/moz.build @@ -199,7 +199,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -209,10 +208,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/neteq/neteq_controller_api_gn/moz.build b/third_party/libwebrtc/api/neteq/neteq_controller_api_gn/moz.build index 617ffd753e..c08d59e8ac 100644 --- a/third_party/libwebrtc/api/neteq/neteq_controller_api_gn/moz.build +++ b/third_party/libwebrtc/api/neteq/neteq_controller_api_gn/moz.build @@ -191,16 +191,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/neteq/tick_timer_gn/moz.build b/third_party/libwebrtc/api/neteq/tick_timer_gn/moz.build index 8106b395ca..ef3938ecf2 100644 --- a/third_party/libwebrtc/api/neteq/tick_timer_gn/moz.build +++ b/third_party/libwebrtc/api/neteq/tick_timer_gn/moz.build @@ -188,7 +188,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -198,10 +197,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/network_state_predictor_api_gn/moz.build b/third_party/libwebrtc/api/network_state_predictor_api_gn/moz.build index 0ffd6a2406..1cfd2c0837 100644 --- a/third_party/libwebrtc/api/network_state_predictor_api_gn/moz.build +++ b/third_party/libwebrtc/api/network_state_predictor_api_gn/moz.build @@ -176,16 +176,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/packet_socket_factory.h b/third_party/libwebrtc/api/packet_socket_factory.h index e389ccb2ff..78b93b539c 100644 --- a/third_party/libwebrtc/api/packet_socket_factory.h +++ b/third_party/libwebrtc/api/packet_socket_factory.h @@ -16,7 +16,6 @@ #include <vector> #include "api/async_dns_resolver.h" -#include "api/wrapping_async_dns_resolver.h" #include "rtc_base/async_packet_socket.h" #include "rtc_base/proxy_info.h" #include "rtc_base/system/rtc_export.h" @@ -72,26 +71,8 @@ class RTC_EXPORT PacketSocketFactory { const std::string& user_agent, const PacketSocketTcpOptions& tcp_options) = 0; - // The AsyncResolverInterface is deprecated; users are encouraged - // to switch to the AsyncDnsResolverInterface. - // TODO(bugs.webrtc.org/12598): Remove once all downstream users - // are converted. -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [[deprecated]] virtual AsyncResolverInterface* CreateAsyncResolver() { - // Default implementation, so that downstream users can remove this - // immediately after changing to CreateAsyncDnsResolver - RTC_DCHECK_NOTREACHED(); - return nullptr; - } - virtual std::unique_ptr<webrtc::AsyncDnsResolverInterface> - CreateAsyncDnsResolver() { - // Default implementation, to aid in transition to AsyncDnsResolverInterface - return std::make_unique<webrtc::WrappingAsyncDnsResolver>( - CreateAsyncResolver()); - } -#pragma clang diagnostic pop + CreateAsyncDnsResolver() = 0; private: PacketSocketFactory(const PacketSocketFactory&) = delete; diff --git a/third_party/libwebrtc/api/peer_connection_interface.cc b/third_party/libwebrtc/api/peer_connection_interface.cc index 050b61da95..dedfd355d6 100644 --- a/third_party/libwebrtc/api/peer_connection_interface.cc +++ b/third_party/libwebrtc/api/peer_connection_interface.cc @@ -12,6 +12,8 @@ #include <utility> +#include "pc/media_factory.h" + namespace webrtc { PeerConnectionInterface::IceServer::IceServer() = default; diff --git a/third_party/libwebrtc/api/peer_connection_interface.h b/third_party/libwebrtc/api/peer_connection_interface.h index 9243190c10..74c4702cd2 100644 --- a/third_party/libwebrtc/api/peer_connection_interface.h +++ b/third_party/libwebrtc/api/peer_connection_interface.h @@ -80,12 +80,10 @@ #include "absl/types/optional.h" #include "api/adaptation/resource.h" #include "api/async_dns_resolver.h" -#include "api/async_resolver_factory.h" #include "api/audio/audio_mixer.h" #include "api/audio_codecs/audio_decoder_factory.h" #include "api/audio_codecs/audio_encoder_factory.h" #include "api/audio_options.h" -#include "api/call/call_factory_interface.h" #include "api/candidate.h" #include "api/crypto/crypto_options.h" #include "api/data_channel_interface.h" @@ -120,17 +118,19 @@ #include "api/transport/sctp_transport_factory_interface.h" #include "api/turn_customizer.h" #include "api/video/video_bitrate_allocator_factory.h" +#include "api/video_codecs/video_decoder_factory.h" +#include "api/video_codecs/video_encoder_factory.h" #include "call/rtp_transport_controller_send_factory_interface.h" #include "media/base/media_config.h" #include "media/base/media_engine.h" // TODO(bugs.webrtc.org/7447): We plan to provide a way to let applications // inject a PacketSocketFactory and/or NetworkManager, and not expose // PortAllocator in the PeerConnection api. +#include "api/ref_count.h" #include "p2p/base/port_allocator.h" #include "rtc_base/network.h" #include "rtc_base/network_constants.h" #include "rtc_base/network_monitor_factory.h" -#include "rtc_base/ref_count.h" #include "rtc_base/rtc_certificate.h" #include "rtc_base/rtc_certificate_generator.h" #include "rtc_base/socket_address.h" @@ -145,8 +145,11 @@ class Thread; namespace webrtc { +// MediaFactory class definition is not part of the api. +class MediaFactory; + // MediaStream container interface. -class StreamCollectionInterface : public rtc::RefCountInterface { +class StreamCollectionInterface : public webrtc::RefCountInterface { public: // TODO(ronghuawu): Update the function names to c++ style, e.g. find -> Find. virtual size_t count() = 0; @@ -160,7 +163,7 @@ class StreamCollectionInterface : public rtc::RefCountInterface { ~StreamCollectionInterface() override = default; }; -class StatsObserver : public rtc::RefCountInterface { +class StatsObserver : public webrtc::RefCountInterface { public: virtual void OnComplete(const StatsReports& reports) = 0; @@ -175,7 +178,7 @@ enum class SdpSemantics { kUnifiedPlan, }; -class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface { +class RTC_EXPORT PeerConnectionInterface : public webrtc::RefCountInterface { public: // See https://w3c.github.io/webrtc-pc/#dom-rtcsignalingstate enum SignalingState { @@ -683,6 +686,7 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface { PortAllocatorConfig port_allocator_config; // The burst interval of the pacer, see TaskQueuePacedSender constructor. + // TODO(hbos): Deprecated, Remove once Chromium is not setting it. absl::optional<TimeDelta> pacer_burst_interval; // @@ -1382,13 +1386,6 @@ struct RTC_EXPORT PeerConnectionDependencies final { // Factory for creating resolvers that look up hostnames in DNS std::unique_ptr<webrtc::AsyncDnsResolverFactoryInterface> async_dns_resolver_factory; - // Deprecated - use async_dns_resolver_factory -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [[deprecated("Use async_dns_resolver_factory")]] std::unique_ptr< - webrtc::AsyncResolverFactory> - async_resolver_factory; -#pragma clang diagnostic pop std::unique_ptr<webrtc::IceTransportFactory> ice_transport_factory; std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator; std::unique_ptr<rtc::SSLCertificateVerifier> tls_cert_verifier; @@ -1427,8 +1424,6 @@ struct RTC_EXPORT PeerConnectionFactoryDependencies final { // called without a `port_allocator`. std::unique_ptr<rtc::PacketSocketFactory> packet_socket_factory; std::unique_ptr<TaskQueueFactory> task_queue_factory; - std::unique_ptr<cricket::MediaEngineInterface> media_engine; - std::unique_ptr<CallFactoryInterface> call_factory; std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory; std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory; std::unique_ptr<NetworkStatePredictorFactoryInterface> @@ -1447,6 +1442,23 @@ struct RTC_EXPORT PeerConnectionFactoryDependencies final { std::unique_ptr<RtpTransportControllerSendFactoryInterface> transport_controller_send_factory; std::unique_ptr<Metronome> metronome; + + // Media specific dependencies. Unused when `media_factory == nullptr`. + rtc::scoped_refptr<AudioDeviceModule> adm; + rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory; + rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory; + rtc::scoped_refptr<AudioMixer> audio_mixer; + rtc::scoped_refptr<AudioProcessing> audio_processing; + std::unique_ptr<AudioFrameProcessor> audio_frame_processor; + std::unique_ptr<VideoEncoderFactory> video_encoder_factory; + std::unique_ptr<VideoDecoderFactory> video_decoder_factory; + + // The `media_factory` members allows webrtc to be optionally built without + // media support (i.e., if only being used for data channels). + // By default media is disabled. To enable media call + // `EnableMedia(PeerConnectionFactoryDependencies&)`. Definition of the + // `MediaFactory` interface is a webrtc implementation detail. + std::unique_ptr<MediaFactory> media_factory; }; // PeerConnectionFactoryInterface is the factory interface used for creating @@ -1463,7 +1475,7 @@ struct RTC_EXPORT PeerConnectionFactoryDependencies final { // CreatePeerConnectionFactory method which accepts threads as input, and use // the CreatePeerConnection version that takes a PortAllocator as an argument. class RTC_EXPORT PeerConnectionFactoryInterface - : public rtc::RefCountInterface { + : public webrtc::RefCountInterface { public: class Options { public: diff --git a/third_party/libwebrtc/api/priority_gn/moz.build b/third_party/libwebrtc/api/priority_gn/moz.build index 090d23dd76..5cac655d90 100644 --- a/third_party/libwebrtc/api/priority_gn/moz.build +++ b/third_party/libwebrtc/api/priority_gn/moz.build @@ -176,16 +176,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/ref_count.h b/third_party/libwebrtc/api/ref_count.h new file mode 100644 index 0000000000..5209277038 --- /dev/null +++ b/third_party/libwebrtc/api/ref_count.h @@ -0,0 +1,67 @@ +/* + * Copyright 2011 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_REF_COUNT_H_ +#define API_REF_COUNT_H_ + +namespace webrtc { + +// Refcounted objects should implement the following informal interface: +// +// void AddRef() const ; +// RefCountReleaseStatus Release() const; +// +// You may access members of a reference-counted object, including the AddRef() +// and Release() methods, only if you already own a reference to it, or if +// you're borrowing someone else's reference. (A newly created object is a +// special case: the reference count is zero on construction, and the code that +// creates the object should immediately call AddRef(), bringing the reference +// count from zero to one, e.g., by constructing an rtc::scoped_refptr). +// +// AddRef() creates a new reference to the object. +// +// Release() releases a reference to the object; the caller now has one less +// reference than before the call. Returns kDroppedLastRef if the number of +// references dropped to zero because of this (in which case the object destroys +// itself). Otherwise, returns kOtherRefsRemained, to signal that at the precise +// time the caller's reference was dropped, other references still remained (but +// if other threads own references, this may of course have changed by the time +// Release() returns). +// +// The caller of Release() must treat it in the same way as a delete operation: +// Regardless of the return value from Release(), the caller mustn't access the +// object. The object might still be alive, due to references held by other +// users of the object, but the object can go away at any time, e.g., as the +// result of another thread calling Release(). +// +// Calling AddRef() and Release() manually is discouraged. It's recommended to +// use rtc::scoped_refptr to manage all pointers to reference counted objects. +// Note that rtc::scoped_refptr depends on compile-time duck-typing; formally +// implementing the below RefCountInterface is not required. + +enum class RefCountReleaseStatus { kDroppedLastRef, kOtherRefsRemained }; + +// Interfaces where refcounting is part of the public api should +// inherit this abstract interface. The implementation of these +// methods is usually provided by the RefCountedObject template class, +// applied as a leaf in the inheritance tree. +class RefCountInterface { + public: + virtual void AddRef() const = 0; + virtual RefCountReleaseStatus Release() const = 0; + + // Non-public destructor, because Release() has exclusive responsibility for + // destroying the object. + protected: + virtual ~RefCountInterface() {} +}; + +} // namespace webrtc + +#endif // API_REF_COUNT_H_ diff --git a/third_party/libwebrtc/api/ref_count_gn/moz.build b/third_party/libwebrtc/api/ref_count_gn/moz.build new file mode 100644 index 0000000000..0fcde97e6b --- /dev/null +++ b/third_party/libwebrtc/api/ref_count_gn/moz.build @@ -0,0 +1,198 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + + + ### This moz.build was AUTOMATICALLY GENERATED from a GN config, ### + ### DO NOT edit it by hand. ### + +COMPILE_FLAGS["OS_INCLUDES"] = [] +AllowCompilerWarnings() + +DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1" +DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True +DEFINES["RTC_ENABLE_VP9"] = True +DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0" +DEFINES["WEBRTC_LIBRARY_IMPL"] = True +DEFINES["WEBRTC_MOZILLA_BUILD"] = True +DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0" +DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0" + +FINAL_LIBRARY = "webrtc" + + +LOCAL_INCLUDES += [ + "!/ipc/ipdl/_ipdlheaders", + "!/third_party/libwebrtc/gen", + "/ipc/chromium/src", + "/third_party/libwebrtc/", + "/third_party/libwebrtc/third_party/abseil-cpp/", + "/tools/profiler/public" +] + +if not CONFIG["MOZ_DEBUG"]: + + DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "0" + DEFINES["NDEBUG"] = True + DEFINES["NVALGRIND"] = True + +if CONFIG["MOZ_DEBUG"] == "1": + + DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1" + +if CONFIG["OS_TARGET"] == "Android": + + DEFINES["ANDROID"] = True + DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1" + DEFINES["HAVE_SYS_UIO_H"] = True + DEFINES["WEBRTC_ANDROID"] = True + DEFINES["WEBRTC_ANDROID_OPENSLES"] = True + DEFINES["WEBRTC_ENABLE_LIBEVENT"] = True + DEFINES["WEBRTC_LINUX"] = True + DEFINES["WEBRTC_POSIX"] = True + DEFINES["_GNU_SOURCE"] = True + DEFINES["__STDC_CONSTANT_MACROS"] = True + DEFINES["__STDC_FORMAT_MACROS"] = True + +if CONFIG["OS_TARGET"] == "Darwin": + + DEFINES["WEBRTC_MAC"] = True + DEFINES["WEBRTC_POSIX"] = True + DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True + DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0" + DEFINES["__STDC_CONSTANT_MACROS"] = True + DEFINES["__STDC_FORMAT_MACROS"] = True + +if CONFIG["OS_TARGET"] == "Linux": + + DEFINES["USE_AURA"] = "1" + DEFINES["USE_GLIB"] = "1" + DEFINES["USE_NSS_CERTS"] = "1" + DEFINES["USE_OZONE"] = "1" + DEFINES["USE_UDEV"] = True + DEFINES["WEBRTC_ENABLE_LIBEVENT"] = True + DEFINES["WEBRTC_LINUX"] = True + DEFINES["WEBRTC_POSIX"] = True + DEFINES["_FILE_OFFSET_BITS"] = "64" + DEFINES["_LARGEFILE64_SOURCE"] = True + DEFINES["_LARGEFILE_SOURCE"] = True + DEFINES["__STDC_CONSTANT_MACROS"] = True + DEFINES["__STDC_FORMAT_MACROS"] = True + +if CONFIG["OS_TARGET"] == "OpenBSD": + + DEFINES["USE_GLIB"] = "1" + DEFINES["USE_OZONE"] = "1" + DEFINES["USE_X11"] = "1" + DEFINES["WEBRTC_BSD"] = True + DEFINES["WEBRTC_ENABLE_LIBEVENT"] = True + DEFINES["WEBRTC_POSIX"] = True + DEFINES["_FILE_OFFSET_BITS"] = "64" + DEFINES["_LARGEFILE64_SOURCE"] = True + DEFINES["_LARGEFILE_SOURCE"] = True + DEFINES["__STDC_CONSTANT_MACROS"] = True + DEFINES["__STDC_FORMAT_MACROS"] = True + +if CONFIG["OS_TARGET"] == "WINNT": + + DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True + DEFINES["NOMINMAX"] = True + DEFINES["NTDDI_VERSION"] = "0x0A000000" + DEFINES["PSAPI_VERSION"] = "2" + DEFINES["RTC_ENABLE_WIN_WGC"] = True + DEFINES["UNICODE"] = True + DEFINES["USE_AURA"] = "1" + DEFINES["WEBRTC_WIN"] = True + DEFINES["WIN32"] = True + DEFINES["WIN32_LEAN_AND_MEAN"] = True + DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP" + DEFINES["WINVER"] = "0x0A00" + DEFINES["_ATL_NO_OPENGL"] = True + DEFINES["_CRT_RAND_S"] = True + DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True + DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True + DEFINES["_HAS_EXCEPTIONS"] = "0" + DEFINES["_HAS_NODISCARD"] = True + DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True + DEFINES["_SECURE_ATL"] = True + DEFINES["_UNICODE"] = True + DEFINES["_WIN32_WINNT"] = "0x0A00" + DEFINES["_WINDOWS"] = True + DEFINES["__STD_C"] = True + +if CONFIG["TARGET_CPU"] == "aarch64": + + DEFINES["WEBRTC_ARCH_ARM64"] = True + DEFINES["WEBRTC_HAS_NEON"] = True + +if CONFIG["TARGET_CPU"] == "arm": + + DEFINES["WEBRTC_ARCH_ARM"] = True + DEFINES["WEBRTC_ARCH_ARM_V7"] = True + DEFINES["WEBRTC_HAS_NEON"] = True + +if CONFIG["TARGET_CPU"] == "mips32": + + DEFINES["MIPS32_LE"] = True + DEFINES["MIPS_FPU_LE"] = True + DEFINES["_GNU_SOURCE"] = True + +if CONFIG["TARGET_CPU"] == "mips64": + + DEFINES["_GNU_SOURCE"] = True + +if CONFIG["TARGET_CPU"] == "x86": + + DEFINES["WEBRTC_ENABLE_AVX2"] = True + +if CONFIG["TARGET_CPU"] == "x86_64": + + DEFINES["WEBRTC_ENABLE_AVX2"] = True + +if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android": + + DEFINES["_DEBUG"] = True + +if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin": + + DEFINES["_DEBUG"] = True + +if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux": + + DEFINES["_DEBUG"] = True + +if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD": + + DEFINES["_DEBUG"] = True + +if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT": + + DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0" + +if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": + + DEFINES["USE_X11"] = "1" + +if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": + + OS_LIBS += [ + "unwind" + ] + +if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": + + DEFINES["_GNU_SOURCE"] = True + +if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm": + + DEFINES["_GNU_SOURCE"] = True + +if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86": + + DEFINES["_GNU_SOURCE"] = True + +if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64": + + DEFINES["_GNU_SOURCE"] = True + +Library("ref_count_gn") diff --git a/third_party/libwebrtc/api/refcountedbase_gn/moz.build b/third_party/libwebrtc/api/refcountedbase_gn/moz.build index c18c17de99..96c04d1258 100644 --- a/third_party/libwebrtc/api/refcountedbase_gn/moz.build +++ b/third_party/libwebrtc/api/refcountedbase_gn/moz.build @@ -176,16 +176,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/rtc_error_gn/moz.build b/third_party/libwebrtc/api/rtc_error_gn/moz.build index 19bee50072..3c9d5f7f9b 100644 --- a/third_party/libwebrtc/api/rtc_error_gn/moz.build +++ b/third_party/libwebrtc/api/rtc_error_gn/moz.build @@ -195,7 +195,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -205,10 +204,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/rtc_event_log/BUILD.gn b/third_party/libwebrtc/api/rtc_event_log/BUILD.gn index 158dc06a7b..073c91a5e8 100644 --- a/third_party/libwebrtc/api/rtc_event_log/BUILD.gn +++ b/third_party/libwebrtc/api/rtc_event_log/BUILD.gn @@ -22,8 +22,10 @@ rtc_library("rtc_event_log") { "..:libjingle_logging_api", "../../rtc_base:checks", "../../rtc_base:timeutils", + "../environment", "../task_queue", ] + absl_deps = [ "//third_party/abseil-cpp/absl/base:nullability" ] } rtc_library("rtc_event_log_factory") { @@ -35,12 +37,14 @@ rtc_library("rtc_event_log_factory") { deps = [ ":rtc_event_log", - "../../rtc_base:checks", + "..:field_trials_view", "../../rtc_base/system:rtc_export", - "../../system_wrappers:field_trial", + "../environment", "../task_queue", ] + absl_deps = [ "//third_party/abseil-cpp/absl/base:nullability" ] + if (rtc_enable_protobuf) { defines = [ "WEBRTC_ENABLE_RTC_EVENT_LOG" ] deps += [ "../../logging:rtc_event_log_impl" ] diff --git a/third_party/libwebrtc/api/rtc_event_log/rtc_event_log_factory.cc b/third_party/libwebrtc/api/rtc_event_log/rtc_event_log_factory.cc index a3cb68cf54..30fc6f126f 100644 --- a/third_party/libwebrtc/api/rtc_event_log/rtc_event_log_factory.cc +++ b/third_party/libwebrtc/api/rtc_event_log/rtc_event_log_factory.cc @@ -11,10 +11,11 @@ #include "api/rtc_event_log/rtc_event_log_factory.h" #include <memory> -#include <utility> -#include "rtc_base/checks.h" -#include "system_wrappers/include/field_trial.h" +#include "absl/base/nullability.h" +#include "api/environment/environment.h" +#include "api/field_trials_view.h" +#include "api/rtc_event_log/rtc_event_log.h" #ifdef WEBRTC_ENABLE_RTC_EVENT_LOG #include "logging/rtc_event_log/rtc_event_log_impl.h" @@ -22,27 +23,21 @@ namespace webrtc { -RtcEventLogFactory::RtcEventLogFactory(TaskQueueFactory* task_queue_factory) - : task_queue_factory_(task_queue_factory) { - RTC_DCHECK(task_queue_factory_); -} - -std::unique_ptr<RtcEventLog> RtcEventLogFactory::Create( - RtcEventLog::EncodingType encoding_type) const { -#ifdef WEBRTC_ENABLE_RTC_EVENT_LOG - if (field_trial::IsEnabled("WebRTC-RtcEventLogKillSwitch")) { +absl::Nonnull<std::unique_ptr<RtcEventLog>> RtcEventLogFactory::Create( + const Environment& env) const { +#ifndef WEBRTC_ENABLE_RTC_EVENT_LOG + return std::make_unique<RtcEventLogNull>(); +#else + if (env.field_trials().IsEnabled("WebRTC-RtcEventLogKillSwitch")) { return std::make_unique<RtcEventLogNull>(); } + RtcEventLog::EncodingType encoding_type = + env.field_trials().IsDisabled("WebRTC-RtcEventLogNewFormat") + ? RtcEventLog::EncodingType::Legacy + : RtcEventLog::EncodingType::NewFormat; return std::make_unique<RtcEventLogImpl>( - RtcEventLogImpl::CreateEncoder(encoding_type), task_queue_factory_); -#else - return std::make_unique<RtcEventLogNull>(); + RtcEventLogImpl::CreateEncoder(encoding_type), &env.task_queue_factory()); #endif } -std::unique_ptr<RtcEventLog> RtcEventLogFactory::CreateRtcEventLog( - RtcEventLog::EncodingType encoding_type) { - return Create(encoding_type); -} - } // namespace webrtc diff --git a/third_party/libwebrtc/api/rtc_event_log/rtc_event_log_factory.h b/third_party/libwebrtc/api/rtc_event_log/rtc_event_log_factory.h index fd1db3c728..21a670e1a7 100644 --- a/third_party/libwebrtc/api/rtc_event_log/rtc_event_log_factory.h +++ b/third_party/libwebrtc/api/rtc_event_log/rtc_event_log_factory.h @@ -13,6 +13,8 @@ #include <memory> +#include "absl/base/nullability.h" +#include "api/environment/environment.h" #include "api/rtc_event_log/rtc_event_log.h" #include "api/rtc_event_log/rtc_event_log_factory_interface.h" #include "api/task_queue/task_queue_factory.h" @@ -22,16 +24,16 @@ namespace webrtc { class RTC_EXPORT RtcEventLogFactory : public RtcEventLogFactoryInterface { public: - explicit RtcEventLogFactory(TaskQueueFactory* task_queue_factory); - ~RtcEventLogFactory() override {} + RtcEventLogFactory() = default; - std::unique_ptr<RtcEventLog> Create( - RtcEventLog::EncodingType encoding_type) const override; - std::unique_ptr<RtcEventLog> CreateRtcEventLog( - RtcEventLog::EncodingType encoding_type) override; + // TODO(bugs.webrtc.org/15656): deprecate and delete constructor taking + // task queue factory in favor of using task queue factory provided through + // the Environment parameter in Create function. + explicit RtcEventLogFactory(TaskQueueFactory* task_queue_factory) {} + ~RtcEventLogFactory() override = default; - private: - TaskQueueFactory* const task_queue_factory_; + absl::Nonnull<std::unique_ptr<RtcEventLog>> Create( + const Environment& env) const override; }; } // namespace webrtc diff --git a/third_party/libwebrtc/api/rtc_event_log/rtc_event_log_factory_interface.h b/third_party/libwebrtc/api/rtc_event_log/rtc_event_log_factory_interface.h index a6f4dee92f..3135584966 100644 --- a/third_party/libwebrtc/api/rtc_event_log/rtc_event_log_factory_interface.h +++ b/third_party/libwebrtc/api/rtc_event_log/rtc_event_log_factory_interface.h @@ -13,6 +13,8 @@ #include <memory> +#include "absl/base/nullability.h" +#include "api/environment/environment.h" #include "api/rtc_event_log/rtc_event_log.h" namespace webrtc { @@ -24,10 +26,8 @@ class RtcEventLogFactoryInterface { public: virtual ~RtcEventLogFactoryInterface() = default; - virtual std::unique_ptr<RtcEventLog> Create( - RtcEventLog::EncodingType encoding_type) const = 0; - [[deprecated]] virtual std::unique_ptr<RtcEventLog> CreateRtcEventLog( - RtcEventLog::EncodingType encoding_type) = 0; + virtual absl::Nonnull<std::unique_ptr<RtcEventLog>> Create( + const Environment& env) const = 0; }; } // namespace webrtc diff --git a/third_party/libwebrtc/api/rtc_event_log/rtc_event_log_gn/moz.build b/third_party/libwebrtc/api/rtc_event_log/rtc_event_log_gn/moz.build index 1965bc7a12..991c0366b6 100644 --- a/third_party/libwebrtc/api/rtc_event_log/rtc_event_log_gn/moz.build +++ b/third_party/libwebrtc/api/rtc_event_log/rtc_event_log_gn/moz.build @@ -196,7 +196,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -206,10 +205,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/rtp_headers_gn/moz.build b/third_party/libwebrtc/api/rtp_headers_gn/moz.build index 7328eb81c0..24f4f8fb24 100644 --- a/third_party/libwebrtc/api/rtp_headers_gn/moz.build +++ b/third_party/libwebrtc/api/rtp_headers_gn/moz.build @@ -195,7 +195,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -205,10 +204,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/rtp_packet_info_gn/moz.build b/third_party/libwebrtc/api/rtp_packet_info_gn/moz.build index 92eb6cb369..fda93e184e 100644 --- a/third_party/libwebrtc/api/rtp_packet_info_gn/moz.build +++ b/third_party/libwebrtc/api/rtp_packet_info_gn/moz.build @@ -195,7 +195,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -205,10 +204,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/rtp_parameters_gn/moz.build b/third_party/libwebrtc/api/rtp_parameters_gn/moz.build index 480114ad07..09590e547d 100644 --- a/third_party/libwebrtc/api/rtp_parameters_gn/moz.build +++ b/third_party/libwebrtc/api/rtp_parameters_gn/moz.build @@ -189,7 +189,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -199,10 +198,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/rtp_receiver_interface.h b/third_party/libwebrtc/api/rtp_receiver_interface.h index e4ec9b5986..0bf1af972b 100644 --- a/third_party/libwebrtc/api/rtp_receiver_interface.h +++ b/third_party/libwebrtc/api/rtp_receiver_interface.h @@ -22,10 +22,10 @@ #include "api/frame_transformer_interface.h" #include "api/media_stream_interface.h" #include "api/media_types.h" +#include "api/ref_count.h" #include "api/rtp_parameters.h" #include "api/scoped_refptr.h" #include "api/transport/rtp/rtp_source.h" -#include "rtc_base/ref_count.h" #include "rtc_base/system/rtc_export.h" namespace webrtc { @@ -44,7 +44,7 @@ class RtpReceiverObserverInterface { virtual ~RtpReceiverObserverInterface() {} }; -class RTC_EXPORT RtpReceiverInterface : public rtc::RefCountInterface { +class RTC_EXPORT RtpReceiverInterface : public webrtc::RefCountInterface { public: virtual rtc::scoped_refptr<MediaStreamTrackInterface> track() const = 0; diff --git a/third_party/libwebrtc/api/rtp_sender_interface.h b/third_party/libwebrtc/api/rtp_sender_interface.h index 619b601f1f..7090c233cd 100644 --- a/third_party/libwebrtc/api/rtp_sender_interface.h +++ b/third_party/libwebrtc/api/rtp_sender_interface.h @@ -25,18 +25,18 @@ #include "api/frame_transformer_interface.h" #include "api/media_stream_interface.h" #include "api/media_types.h" +#include "api/ref_count.h" #include "api/rtc_error.h" #include "api/rtp_parameters.h" #include "api/scoped_refptr.h" #include "api/video_codecs/video_encoder_factory.h" -#include "rtc_base/ref_count.h" #include "rtc_base/system/rtc_export.h" #include "api/rtp_sender_setparameters_callback.h" namespace webrtc { -class RTC_EXPORT RtpSenderInterface : public rtc::RefCountInterface { +class RTC_EXPORT RtpSenderInterface : public webrtc::RefCountInterface { public: // Returns true if successful in setting the track. // Fails if an audio track is set on a video RtpSender, or vice-versa. diff --git a/third_party/libwebrtc/api/rtp_sender_interface_gn/moz.build b/third_party/libwebrtc/api/rtp_sender_interface_gn/moz.build index 9938ecca35..e7259b40e0 100644 --- a/third_party/libwebrtc/api/rtp_sender_interface_gn/moz.build +++ b/third_party/libwebrtc/api/rtp_sender_interface_gn/moz.build @@ -176,16 +176,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/rtp_sender_setparameters_callback_gn/moz.build b/third_party/libwebrtc/api/rtp_sender_setparameters_callback_gn/moz.build index f8cd38576d..c493f010c8 100644 --- a/third_party/libwebrtc/api/rtp_sender_setparameters_callback_gn/moz.build +++ b/third_party/libwebrtc/api/rtp_sender_setparameters_callback_gn/moz.build @@ -195,7 +195,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -205,10 +204,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/rtp_transceiver_direction_gn/moz.build b/third_party/libwebrtc/api/rtp_transceiver_direction_gn/moz.build index 9f3a7424ae..66b863defb 100644 --- a/third_party/libwebrtc/api/rtp_transceiver_direction_gn/moz.build +++ b/third_party/libwebrtc/api/rtp_transceiver_direction_gn/moz.build @@ -176,16 +176,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/rtp_transceiver_interface.h b/third_party/libwebrtc/api/rtp_transceiver_interface.h index 7d0d1a18bf..940264ef51 100644 --- a/third_party/libwebrtc/api/rtp_transceiver_interface.h +++ b/third_party/libwebrtc/api/rtp_transceiver_interface.h @@ -18,12 +18,12 @@ #include "absl/types/optional.h" #include "api/array_view.h" #include "api/media_types.h" +#include "api/ref_count.h" #include "api/rtp_parameters.h" #include "api/rtp_receiver_interface.h" #include "api/rtp_sender_interface.h" #include "api/rtp_transceiver_direction.h" #include "api/scoped_refptr.h" -#include "rtc_base/ref_count.h" #include "rtc_base/system/rtc_export.h" namespace webrtc { @@ -58,7 +58,7 @@ struct RTC_EXPORT RtpTransceiverInit final { // // WebRTC specification for RTCRtpTransceiver, the JavaScript analog: // https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver -class RTC_EXPORT RtpTransceiverInterface : public rtc::RefCountInterface { +class RTC_EXPORT RtpTransceiverInterface : public webrtc::RefCountInterface { public: // Media type of the transceiver. Any sender(s)/receiver(s) will have this // type as well. diff --git a/third_party/libwebrtc/api/scoped_refptr.h b/third_party/libwebrtc/api/scoped_refptr.h index e145509127..61b2eb1f20 100644 --- a/third_party/libwebrtc/api/scoped_refptr.h +++ b/third_party/libwebrtc/api/scoped_refptr.h @@ -66,7 +66,7 @@ #include <memory> #include <utility> -namespace rtc { +namespace webrtc { template <class T> class scoped_refptr { @@ -162,61 +162,66 @@ class scoped_refptr { }; template <typename T, typename U> -bool operator==(const rtc::scoped_refptr<T>& a, - const rtc::scoped_refptr<U>& b) { +bool operator==(const scoped_refptr<T>& a, const scoped_refptr<U>& b) { return a.get() == b.get(); } template <typename T, typename U> -bool operator!=(const rtc::scoped_refptr<T>& a, - const rtc::scoped_refptr<U>& b) { +bool operator!=(const scoped_refptr<T>& a, const scoped_refptr<U>& b) { return !(a == b); } template <typename T> -bool operator==(const rtc::scoped_refptr<T>& a, std::nullptr_t) { +bool operator==(const scoped_refptr<T>& a, std::nullptr_t) { return a.get() == nullptr; } template <typename T> -bool operator!=(const rtc::scoped_refptr<T>& a, std::nullptr_t) { +bool operator!=(const scoped_refptr<T>& a, std::nullptr_t) { return !(a == nullptr); } template <typename T> -bool operator==(std::nullptr_t, const rtc::scoped_refptr<T>& a) { +bool operator==(std::nullptr_t, const scoped_refptr<T>& a) { return a.get() == nullptr; } template <typename T> -bool operator!=(std::nullptr_t, const rtc::scoped_refptr<T>& a) { +bool operator!=(std::nullptr_t, const scoped_refptr<T>& a) { return !(a == nullptr); } // Comparison with raw pointer. template <typename T, typename U> -bool operator==(const rtc::scoped_refptr<T>& a, const U* b) { +bool operator==(const scoped_refptr<T>& a, const U* b) { return a.get() == b; } template <typename T, typename U> -bool operator!=(const rtc::scoped_refptr<T>& a, const U* b) { +bool operator!=(const scoped_refptr<T>& a, const U* b) { return !(a == b); } template <typename T, typename U> -bool operator==(const T* a, const rtc::scoped_refptr<U>& b) { +bool operator==(const T* a, const scoped_refptr<U>& b) { return a == b.get(); } template <typename T, typename U> -bool operator!=(const T* a, const rtc::scoped_refptr<U>& b) { +bool operator!=(const T* a, const scoped_refptr<U>& b) { return !(a == b); } // Ordered comparison, needed for use as a std::map key. template <typename T, typename U> -bool operator<(const rtc::scoped_refptr<T>& a, const rtc::scoped_refptr<U>& b) { +bool operator<(const scoped_refptr<T>& a, const scoped_refptr<U>& b) { return a.get() < b.get(); } +} // namespace webrtc + +namespace rtc { +// Backwards compatible alias. +// TODO(bugs.webrtc.org/15622): Deprecate and remove. +template <typename T> +using scoped_refptr = webrtc::scoped_refptr<T>; } // namespace rtc #endif // API_SCOPED_REFPTR_H_ diff --git a/third_party/libwebrtc/api/scoped_refptr_gn/moz.build b/third_party/libwebrtc/api/scoped_refptr_gn/moz.build index c2f167533d..6593008ce6 100644 --- a/third_party/libwebrtc/api/scoped_refptr_gn/moz.build +++ b/third_party/libwebrtc/api/scoped_refptr_gn/moz.build @@ -176,16 +176,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/sctp_transport_interface.h b/third_party/libwebrtc/api/sctp_transport_interface.h index 7080889fcf..23169ddb2b 100644 --- a/third_party/libwebrtc/api/sctp_transport_interface.h +++ b/third_party/libwebrtc/api/sctp_transport_interface.h @@ -13,9 +13,9 @@ #include "absl/types/optional.h" #include "api/dtls_transport_interface.h" +#include "api/ref_count.h" #include "api/rtc_error.h" #include "api/scoped_refptr.h" -#include "rtc_base/ref_count.h" namespace webrtc { @@ -75,7 +75,7 @@ class SctpTransportObserverInterface { // accessed on that thread, except for functions explicitly marked otherwise. // References can be held by other threads, and destruction can therefore // be initiated by other threads. -class SctpTransportInterface : public rtc::RefCountInterface { +class SctpTransportInterface : public webrtc::RefCountInterface { public: // This function can be called from other threads. virtual rtc::scoped_refptr<DtlsTransportInterface> dtls_transport() const = 0; diff --git a/third_party/libwebrtc/api/sequence_checker_gn/moz.build b/third_party/libwebrtc/api/sequence_checker_gn/moz.build index a45bc8e9c1..d50c0f4f32 100644 --- a/third_party/libwebrtc/api/sequence_checker_gn/moz.build +++ b/third_party/libwebrtc/api/sequence_checker_gn/moz.build @@ -180,16 +180,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/set_local_description_observer_interface.h b/third_party/libwebrtc/api/set_local_description_observer_interface.h index 8e7b6258d3..40f85b944e 100644 --- a/third_party/libwebrtc/api/set_local_description_observer_interface.h +++ b/third_party/libwebrtc/api/set_local_description_observer_interface.h @@ -11,15 +11,15 @@ #ifndef API_SET_LOCAL_DESCRIPTION_OBSERVER_INTERFACE_H_ #define API_SET_LOCAL_DESCRIPTION_OBSERVER_INTERFACE_H_ +#include "api/ref_count.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 { +class SetLocalDescriptionObserverInterface : public webrtc::RefCountInterface { public: // On success, `error.ok()` is true. virtual void OnSetLocalDescriptionComplete(RTCError error) = 0; diff --git a/third_party/libwebrtc/api/set_remote_description_observer_interface.h b/third_party/libwebrtc/api/set_remote_description_observer_interface.h index d1c075309f..c1625410df 100644 --- a/third_party/libwebrtc/api/set_remote_description_observer_interface.h +++ b/third_party/libwebrtc/api/set_remote_description_observer_interface.h @@ -11,8 +11,8 @@ #ifndef API_SET_REMOTE_DESCRIPTION_OBSERVER_INTERFACE_H_ #define API_SET_REMOTE_DESCRIPTION_OBSERVER_INTERFACE_H_ +#include "api/ref_count.h" #include "api/rtc_error.h" -#include "rtc_base/ref_count.h" namespace webrtc { @@ -20,7 +20,7 @@ namespace webrtc { // callback is invoked such that the state of the peer connection can be // examined to accurately reflect the effects of the SetRemoteDescription // operation. -class SetRemoteDescriptionObserverInterface : public rtc::RefCountInterface { +class SetRemoteDescriptionObserverInterface : public webrtc::RefCountInterface { public: // On success, `error.ok()` is true. virtual void OnSetRemoteDescriptionComplete(RTCError error) = 0; diff --git a/third_party/libwebrtc/api/simulated_network_api_gn/moz.build b/third_party/libwebrtc/api/simulated_network_api_gn/moz.build index b46ec1656b..1f52ba37d7 100644 --- a/third_party/libwebrtc/api/simulated_network_api_gn/moz.build +++ b/third_party/libwebrtc/api/simulated_network_api_gn/moz.build @@ -180,16 +180,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/stats/rtc_stats_report.h b/third_party/libwebrtc/api/stats/rtc_stats_report.h index 1dce4d89b2..632226ef0d 100644 --- a/third_party/libwebrtc/api/stats/rtc_stats_report.h +++ b/third_party/libwebrtc/api/stats/rtc_stats_report.h @@ -124,7 +124,7 @@ class RTC_EXPORT RTCStatsReport final std::string ToJson() const; protected: - friend class rtc::RefCountedNonVirtual<RTCStatsReport>; + friend class RefCountedNonVirtual<RTCStatsReport>; ~RTCStatsReport() = default; private: diff --git a/third_party/libwebrtc/api/task_queue/BUILD.gn b/third_party/libwebrtc/api/task_queue/BUILD.gn index 760ceaa3ef..9b2f747e78 100644 --- a/third_party/libwebrtc/api/task_queue/BUILD.gn +++ b/third_party/libwebrtc/api/task_queue/BUILD.gn @@ -90,7 +90,10 @@ rtc_library("task_queue_test") { rtc_library("default_task_queue_factory") { visibility = [ "*" ] if (!is_ios && !is_android) { - poisonous = [ "default_task_queue" ] + # Internally webrtc shouldn't rely on any specific TaskQueue implementation + # and should create TaskQueue using TaskQueueFactory interface. + # TaskQueueFactory interface can be propagated with Environment. + poisonous = [ "environment_construction" ] } sources = [ "default_task_queue_factory.h" ] deps = [ diff --git a/third_party/libwebrtc/api/task_queue/pending_task_safety_flag_gn/moz.build b/third_party/libwebrtc/api/task_queue/pending_task_safety_flag_gn/moz.build index 52a2e5003b..43229b22ed 100644 --- a/third_party/libwebrtc/api/task_queue/pending_task_safety_flag_gn/moz.build +++ b/third_party/libwebrtc/api/task_queue/pending_task_safety_flag_gn/moz.build @@ -188,7 +188,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -198,10 +197,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/task_queue/task_queue_gn/moz.build b/third_party/libwebrtc/api/task_queue/task_queue_gn/moz.build index 73630a2ad9..8c04d40cf5 100644 --- a/third_party/libwebrtc/api/task_queue/task_queue_gn/moz.build +++ b/third_party/libwebrtc/api/task_queue/task_queue_gn/moz.build @@ -188,7 +188,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -198,10 +197,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/task_queue/task_queue_test.cc b/third_party/libwebrtc/api/task_queue/task_queue_test.cc index b02333ec58..cac7cd77cc 100644 --- a/third_party/libwebrtc/api/task_queue/task_queue_test.cc +++ b/third_party/libwebrtc/api/task_queue/task_queue_test.cc @@ -268,7 +268,7 @@ TEST_P(TaskQueueTest, PostALot) { explicit BlockingCounter(int initial_count) : count_(initial_count) {} void DecrementCount() { - if (count_.DecRef() == rtc::RefCountReleaseStatus::kDroppedLastRef) { + if (count_.DecRef() == webrtc::RefCountReleaseStatus::kDroppedLastRef) { event_.Set(); } } diff --git a/third_party/libwebrtc/api/test/compile_all_headers.cc b/third_party/libwebrtc/api/test/compile_all_headers.cc index 1fcf63e97b..9d375a19f2 100644 --- a/third_party/libwebrtc/api/test/compile_all_headers.cc +++ b/third_party/libwebrtc/api/test/compile_all_headers.cc @@ -43,6 +43,7 @@ #include "api/test/mock_rtpreceiver.h" #include "api/test/mock_rtpsender.h" #include "api/test/mock_session_description_interface.h" +#include "api/test/mock_transformable_frame.h" #include "api/test/mock_transformable_video_frame.h" #include "api/test/mock_video_bitrate_allocator.h" #include "api/test/mock_video_bitrate_allocator_factory.h" diff --git a/third_party/libwebrtc/api/test/create_time_controller.cc b/third_party/libwebrtc/api/test/create_time_controller.cc index 2c356cb887..7523e05208 100644 --- a/third_party/libwebrtc/api/test/create_time_controller.cc +++ b/third_party/libwebrtc/api/test/create_time_controller.cc @@ -11,10 +11,18 @@ #include "api/test/create_time_controller.h" #include <memory> +#include <utility> +#include "absl/base/nullability.h" +#include "api/enable_media_with_defaults.h" +#include "api/environment/environment.h" +#include "api/peer_connection_interface.h" #include "call/call.h" #include "call/rtp_transport_config.h" #include "call/rtp_transport_controller_send_factory_interface.h" +#include "pc/media_factory.h" +#include "rtc_base/checks.h" +#include "system_wrappers/include/clock.h" #include "test/time_controller/external_time_controller.h" #include "test/time_controller/simulated_time_controller.h" @@ -30,24 +38,37 @@ std::unique_ptr<TimeController> CreateSimulatedTimeController() { Timestamp::Seconds(10000)); } -std::unique_ptr<CallFactoryInterface> CreateTimeControllerBasedCallFactory( - TimeController* time_controller) { - class TimeControllerBasedCallFactory : public CallFactoryInterface { +void EnableMediaWithDefaultsAndTimeController( + TimeController& time_controller, + PeerConnectionFactoryDependencies& deps) { + class TimeControllerBasedFactory : public MediaFactory { public: - explicit TimeControllerBasedCallFactory(TimeController* time_controller) - : time_controller_(time_controller) {} - std::unique_ptr<Call> CreateCall(const CallConfig& config) override { - RtpTransportConfig transportConfig = config.ExtractTransportConfig(); + TimeControllerBasedFactory( + absl::Nonnull<Clock*> clock, + absl::Nonnull<std::unique_ptr<MediaFactory>> media_factory) + : clock_(clock), media_factory_(std::move(media_factory)) {} - return Call::Create(config, time_controller_->GetClock(), + std::unique_ptr<Call> CreateCall(const CallConfig& config) override { + return Call::Create(config, clock_, config.rtp_transport_controller_send_factory->Create( - transportConfig, time_controller_->GetClock())); + config.ExtractTransportConfig(), clock_)); + } + + std::unique_ptr<cricket::MediaEngineInterface> CreateMediaEngine( + const Environment& env, + PeerConnectionFactoryDependencies& dependencies) override { + return media_factory_->CreateMediaEngine(env, dependencies); } private: - TimeController* time_controller_; + absl::Nonnull<Clock*> clock_; + absl::Nonnull<std::unique_ptr<MediaFactory>> media_factory_; }; - return std::make_unique<TimeControllerBasedCallFactory>(time_controller); + + EnableMediaWithDefaults(deps); + RTC_CHECK(deps.media_factory); + deps.media_factory = std::make_unique<TimeControllerBasedFactory>( + time_controller.GetClock(), std::move(deps.media_factory)); } } // namespace webrtc diff --git a/third_party/libwebrtc/api/test/create_time_controller.h b/third_party/libwebrtc/api/test/create_time_controller.h index e7bc9cb465..c8257da650 100644 --- a/third_party/libwebrtc/api/test/create_time_controller.h +++ b/third_party/libwebrtc/api/test/create_time_controller.h @@ -12,7 +12,7 @@ #include <memory> -#include "api/call/call_factory_interface.h" +#include "api/peer_connection_interface.h" #include "api/test/time_controller.h" namespace webrtc { @@ -24,10 +24,12 @@ std::unique_ptr<TimeController> CreateTimeController( // Creates a time controller that runs in simulated time. std::unique_ptr<TimeController> CreateSimulatedTimeController(); -// This is creates a call factory that creates Call instances that are backed by -// a time controller. -std::unique_ptr<CallFactoryInterface> CreateTimeControllerBasedCallFactory( - TimeController* time_controller); +// Adjusts media `deps` to use clock `time_controller` provides, fills media +// related dependencies, and enables media support for a PeerConnectionFactory +// created from `deps`. +void EnableMediaWithDefaultsAndTimeController( + TimeController& time_controller, + PeerConnectionFactoryDependencies& deps); } // namespace webrtc diff --git a/third_party/libwebrtc/api/test/create_video_codec_tester.cc b/third_party/libwebrtc/api/test/create_video_codec_tester.cc deleted file mode 100644 index a1efefdb48..0000000000 --- a/third_party/libwebrtc/api/test/create_video_codec_tester.cc +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2022 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#include "api/test/create_video_codec_tester.h" - -#include <memory> -#include <utility> - -#include "api/test/video_codec_tester.h" -#include "modules/video_coding/codecs/test/video_codec_tester_impl.h" - -namespace webrtc { -namespace test { - -std::unique_ptr<VideoCodecTester> CreateVideoCodecTester() { - return std::make_unique<VideoCodecTesterImpl>(); -} - -} // namespace test -} // namespace webrtc diff --git a/third_party/libwebrtc/api/test/create_video_codec_tester.h b/third_party/libwebrtc/api/test/create_video_codec_tester.h deleted file mode 100644 index c68864ce85..0000000000 --- a/third_party/libwebrtc/api/test/create_video_codec_tester.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2022 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef API_TEST_CREATE_VIDEO_CODEC_TESTER_H_ -#define API_TEST_CREATE_VIDEO_CODEC_TESTER_H_ - -#include <memory> - -#include "api/test/video_codec_tester.h" - -namespace webrtc { -namespace test { - -std::unique_ptr<VideoCodecTester> CreateVideoCodecTester(); - -} // namespace test -} // namespace webrtc - -#endif // API_TEST_CREATE_VIDEO_CODEC_TESTER_H_ diff --git a/third_party/libwebrtc/api/test/mock_transformable_audio_frame.h b/third_party/libwebrtc/api/test/mock_transformable_audio_frame.h index be703006ea..584c77fa54 100644 --- a/third_party/libwebrtc/api/test/mock_transformable_audio_frame.h +++ b/third_party/libwebrtc/api/test/mock_transformable_audio_frame.h @@ -11,6 +11,8 @@ #ifndef API_TEST_MOCK_TRANSFORMABLE_AUDIO_FRAME_H_ #define API_TEST_MOCK_TRANSFORMABLE_AUDIO_FRAME_H_ +#include <string> + #include "api/frame_transformer_interface.h" #include "test/gmock.h" @@ -24,6 +26,7 @@ class MockTransformableAudioFrame : public TransformableAudioFrameInterface { MOCK_METHOD(uint8_t, GetPayloadType, (), (const, override)); MOCK_METHOD(uint32_t, GetSsrc, (), (const, override)); MOCK_METHOD(uint32_t, GetTimestamp, (), (const, override)); + MOCK_METHOD(std::string, GetMimeType, (), (const, override)); MOCK_METHOD(rtc::ArrayView<const uint32_t>, GetContributingSources, (), diff --git a/third_party/libwebrtc/api/test/mock_transformable_frame.h b/third_party/libwebrtc/api/test/mock_transformable_frame.h new file mode 100644 index 0000000000..df20b62295 --- /dev/null +++ b/third_party/libwebrtc/api/test/mock_transformable_frame.h @@ -0,0 +1,45 @@ +/* + * Copyright 2023 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef API_TEST_MOCK_TRANSFORMABLE_FRAME_H_ +#define API_TEST_MOCK_TRANSFORMABLE_FRAME_H_ + +#include <stdint.h> + +#include <optional> +#include <string> + +#include "api/array_view.h" +#include "api/frame_transformer_interface.h" +#include "api/units/timestamp.h" +#include "test/gmock.h" + +namespace webrtc { + +class MockTransformableFrame : public webrtc::TransformableFrameInterface { + public: + MOCK_METHOD(rtc::ArrayView<const uint8_t>, GetData, (), (const, override)); + MOCK_METHOD(void, SetData, (rtc::ArrayView<const uint8_t>), (override)); + MOCK_METHOD(uint8_t, GetPayloadType, (), (const, override)); + MOCK_METHOD(uint32_t, GetSsrc, (), (const, override)); + MOCK_METHOD(uint32_t, GetTimestamp, (), (const, override)); + MOCK_METHOD(void, SetRTPTimestamp, (uint32_t), (override)); + MOCK_METHOD(std::optional<webrtc::Timestamp>, + GetCaptureTimeIdentifier, + (), + (const, override)); + MOCK_METHOD(std::string, GetMimeType, (), (const, override)); +}; + +static_assert(!std::is_abstract_v<MockTransformableFrame>, ""); + +} // namespace webrtc + +#endif // API_TEST_MOCK_TRANSFORMABLE_FRAME_H_ diff --git a/third_party/libwebrtc/api/test/pclf/media_configuration.h b/third_party/libwebrtc/api/test/pclf/media_configuration.h index 5bcb308c83..5c3440c293 100644 --- a/third_party/libwebrtc/api/test/pclf/media_configuration.h +++ b/third_party/libwebrtc/api/test/pclf/media_configuration.h @@ -24,7 +24,6 @@ #include "absl/strings/string_view.h" #include "absl/types/optional.h" #include "api/array_view.h" -#include "api/async_resolver_factory.h" #include "api/audio/audio_mixer.h" #include "api/audio_options.h" #include "api/call/call_factory_interface.h" diff --git a/third_party/libwebrtc/api/test/pclf/media_quality_test_params.h b/third_party/libwebrtc/api/test/pclf/media_quality_test_params.h index b2ccdf18c5..aad04c3eb6 100644 --- a/third_party/libwebrtc/api/test/pclf/media_quality_test_params.h +++ b/third_party/libwebrtc/api/test/pclf/media_quality_test_params.h @@ -49,8 +49,6 @@ struct PeerConnectionFactoryComponents { std::unique_ptr<NetworkControllerFactoryInterface> network_controller_factory; std::unique_ptr<NetEqFactory> neteq_factory; - // Will be passed to MediaEngineInterface, that will be used in - // PeerConnectionFactory. std::unique_ptr<VideoEncoderFactory> video_encoder_factory; std::unique_ptr<VideoDecoderFactory> video_decoder_factory; rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory; diff --git a/third_party/libwebrtc/api/test/peerconnection_quality_test_fixture.h b/third_party/libwebrtc/api/test/peerconnection_quality_test_fixture.h index 74470cdf86..034e13ff3b 100644 --- a/third_party/libwebrtc/api/test/peerconnection_quality_test_fixture.h +++ b/third_party/libwebrtc/api/test/peerconnection_quality_test_fixture.h @@ -25,7 +25,6 @@ #include "absl/strings/string_view.h" #include "absl/types/optional.h" #include "api/array_view.h" -#include "api/async_resolver_factory.h" #include "api/audio/audio_mixer.h" #include "api/call/call_factory_interface.h" #include "api/fec_controller.h" diff --git a/third_party/libwebrtc/api/test/video_codec_stats.cc b/third_party/libwebrtc/api/test/video_codec_stats.cc deleted file mode 100644 index fb7226701e..0000000000 --- a/third_party/libwebrtc/api/test/video_codec_stats.cc +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2023 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#include "api/test/video_codec_stats.h" - -namespace webrtc { -namespace test { - -void VideoCodecStats::Stream::LogMetrics( - MetricsLogger* logger, - std::string test_case_name, - std::map<std::string, std::string> metadata) const { - logger->LogMetric("width", test_case_name, width, Unit::kCount, - webrtc::test::ImprovementDirection::kBiggerIsBetter, - metadata); - - logger->LogMetric("height", test_case_name, height, Unit::kCount, - webrtc::test::ImprovementDirection::kBiggerIsBetter, - metadata); - - logger->LogMetric( - "frame_size_bytes", test_case_name, frame_size_bytes, Unit::kBytes, - webrtc::test::ImprovementDirection::kNeitherIsBetter, metadata); - - logger->LogMetric("keyframe", test_case_name, keyframe, Unit::kCount, - webrtc::test::ImprovementDirection::kSmallerIsBetter, - metadata); - - logger->LogMetric("qp", test_case_name, qp, Unit::kUnitless, - webrtc::test::ImprovementDirection::kSmallerIsBetter, - metadata); - - logger->LogMetric( - "encode_time_ms", test_case_name, encode_time_ms, Unit::kMilliseconds, - webrtc::test::ImprovementDirection::kSmallerIsBetter, metadata); - - logger->LogMetric( - "decode_time_ms", test_case_name, decode_time_ms, Unit::kMilliseconds, - webrtc::test::ImprovementDirection::kSmallerIsBetter, metadata); - - logger->LogMetric("target_bitrate_kbps", test_case_name, target_bitrate_kbps, - Unit::kKilobitsPerSecond, - webrtc::test::ImprovementDirection::kBiggerIsBetter, - metadata); - - logger->LogMetric("target_framerate_fps", test_case_name, - target_framerate_fps, Unit::kHertz, - webrtc::test::ImprovementDirection::kBiggerIsBetter, - metadata); - - logger->LogMetric("encoded_bitrate_kbps", test_case_name, - encoded_bitrate_kbps, Unit::kKilobitsPerSecond, - webrtc::test::ImprovementDirection::kBiggerIsBetter, - metadata); - - logger->LogMetric("encoded_framerate_fps", test_case_name, - encoded_framerate_fps, Unit::kHertz, - webrtc::test::ImprovementDirection::kBiggerIsBetter, - metadata); - - logger->LogMetric("bitrate_mismatch_pct", test_case_name, - bitrate_mismatch_pct, Unit::kPercent, - webrtc::test::ImprovementDirection::kSmallerIsBetter, - metadata); - - logger->LogMetric("framerate_mismatch_pct", test_case_name, - framerate_mismatch_pct, Unit::kPercent, - webrtc::test::ImprovementDirection::kSmallerIsBetter, - metadata); - - logger->LogMetric("transmission_time_ms", test_case_name, - transmission_time_ms, Unit::kMilliseconds, - webrtc::test::ImprovementDirection::kSmallerIsBetter, - metadata); - - logger->LogMetric("psnr_y_db", test_case_name, psnr.y, Unit::kUnitless, - webrtc::test::ImprovementDirection::kBiggerIsBetter, - metadata); - - logger->LogMetric("psnr_u_db", test_case_name, psnr.u, Unit::kUnitless, - webrtc::test::ImprovementDirection::kBiggerIsBetter, - metadata); - - logger->LogMetric("psnr_v_db", test_case_name, psnr.v, Unit::kUnitless, - webrtc::test::ImprovementDirection::kBiggerIsBetter, - metadata); -} - -} // namespace test -} // namespace webrtc diff --git a/third_party/libwebrtc/api/test/video_codec_stats.h b/third_party/libwebrtc/api/test/video_codec_stats.h deleted file mode 100644 index 80f8287848..0000000000 --- a/third_party/libwebrtc/api/test/video_codec_stats.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2023 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef API_TEST_VIDEO_CODEC_STATS_H_ -#define API_TEST_VIDEO_CODEC_STATS_H_ - -#include <map> -#include <string> -#include <vector> - -#include "absl/types/optional.h" -#include "api/numerics/samples_stats_counter.h" -#include "api/test/metrics/metric.h" -#include "api/test/metrics/metrics_logger.h" -#include "api/units/data_rate.h" -#include "api/units/data_size.h" -#include "api/units/frequency.h" - -namespace webrtc { -namespace test { - -// Interface for encoded and/or decoded video frame and stream statistics. -class VideoCodecStats { - public: - // Filter for slicing frames. - struct Filter { - absl::optional<int> first_frame; - absl::optional<int> last_frame; - absl::optional<int> spatial_idx; - absl::optional<int> temporal_idx; - }; - - struct Frame { - int frame_num = 0; - uint32_t timestamp_rtp = 0; - - int spatial_idx = 0; - int temporal_idx = 0; - - int width = 0; - int height = 0; - DataSize frame_size = DataSize::Zero(); - bool keyframe = false; - absl::optional<int> qp; - absl::optional<int> base_spatial_idx; - - Timestamp encode_start = Timestamp::Zero(); - TimeDelta encode_time = TimeDelta::Zero(); - Timestamp decode_start = Timestamp::Zero(); - TimeDelta decode_time = TimeDelta::Zero(); - - struct Psnr { - double y = 0.0; - double u = 0.0; - double v = 0.0; - }; - absl::optional<Psnr> psnr; - - absl::optional<DataRate> target_bitrate; - absl::optional<Frequency> target_framerate; - - bool encoded = false; - bool decoded = false; - }; - - struct Stream { - SamplesStatsCounter width; - SamplesStatsCounter height; - SamplesStatsCounter frame_size_bytes; - SamplesStatsCounter keyframe; - SamplesStatsCounter qp; - - SamplesStatsCounter encode_time_ms; - SamplesStatsCounter decode_time_ms; - - SamplesStatsCounter target_bitrate_kbps; - SamplesStatsCounter target_framerate_fps; - - SamplesStatsCounter encoded_bitrate_kbps; - SamplesStatsCounter encoded_framerate_fps; - - SamplesStatsCounter bitrate_mismatch_pct; - SamplesStatsCounter framerate_mismatch_pct; - - SamplesStatsCounter transmission_time_ms; - - struct Psnr { - SamplesStatsCounter y; - SamplesStatsCounter u; - SamplesStatsCounter v; - } psnr; - - // Logs `Stream` metrics to provided `MetricsLogger`. - void LogMetrics(MetricsLogger* logger, - std::string test_case_name, - std::map<std::string, std::string> metadata = {}) const; - }; - - virtual ~VideoCodecStats() = default; - - // Returns frames from interval, spatial and temporal layer specified by given - // `filter`. - virtual std::vector<Frame> Slice( - absl::optional<Filter> filter = absl::nullopt) const = 0; - - // Returns video statistics aggregated for given `frames`. - virtual Stream Aggregate(const std::vector<Frame>& frames) const = 0; -}; - -} // namespace test -} // namespace webrtc - -#endif // API_TEST_VIDEO_CODEC_STATS_H_ diff --git a/third_party/libwebrtc/api/test/video_codec_tester.h b/third_party/libwebrtc/api/test/video_codec_tester.h deleted file mode 100644 index c2fb89e2cb..0000000000 --- a/third_party/libwebrtc/api/test/video_codec_tester.h +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2022 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef API_TEST_VIDEO_CODEC_TESTER_H_ -#define API_TEST_VIDEO_CODEC_TESTER_H_ - -#include <memory> -#include <string> - -#include "absl/functional/any_invocable.h" -#include "absl/types/optional.h" -#include "api/test/video_codec_stats.h" -#include "api/video/encoded_image.h" -#include "api/video/resolution.h" -#include "api/video/video_frame.h" - -namespace webrtc { -namespace test { - -// Interface for a video codec tester. The interface provides minimalistic set -// of data structures that enables implementation of decode-only, encode-only -// and encode-decode tests. -class VideoCodecTester { - public: - // Pacing settings for codec input. - struct PacingSettings { - enum PacingMode { - // Pacing is not used. Frames are sent to codec back-to-back. - kNoPacing, - // Pace with the rate equal to the target video frame rate. Pacing time is - // derived from RTP timestamp. - kRealTime, - // Pace with the explicitly provided rate. - kConstantRate, - }; - PacingMode mode = PacingMode::kNoPacing; - // Pacing rate for `kConstantRate` mode. - Frequency constant_rate = Frequency::Zero(); - }; - - struct DecoderSettings { - PacingSettings pacing; - absl::optional<std::string> decoder_input_base_path; - absl::optional<std::string> decoder_output_base_path; - }; - - struct EncoderSettings { - PacingSettings pacing; - absl::optional<std::string> encoder_input_base_path; - absl::optional<std::string> encoder_output_base_path; - }; - - virtual ~VideoCodecTester() = default; - - // Interface for a raw video frames source. - class RawVideoSource { - public: - virtual ~RawVideoSource() = default; - - // Returns next frame. If no more frames to pull, returns `absl::nullopt`. - // For analysis and pacing purposes, frame must have RTP timestamp set. The - // timestamp must represent the target video frame rate and be unique. - virtual absl::optional<VideoFrame> PullFrame() = 0; - - // Returns early pulled frame with RTP timestamp equal to `timestamp_rtp`. - virtual VideoFrame GetFrame(uint32_t timestamp_rtp, - Resolution resolution) = 0; - }; - - // Interface for a coded video frames source. - class CodedVideoSource { - public: - virtual ~CodedVideoSource() = default; - - // Returns next frame. If no more frames to pull, returns `absl::nullopt`. - // For analysis and pacing purposes, frame must have RTP timestamp set. The - // timestamp must represent the target video frame rate and be unique. - virtual absl::optional<EncodedImage> PullFrame() = 0; - }; - - // Interface for a video encoder. - class Encoder { - public: - using EncodeCallback = - absl::AnyInvocable<void(const EncodedImage& encoded_frame)>; - - virtual ~Encoder() = default; - - virtual void Initialize() = 0; - - virtual void Encode(const VideoFrame& frame, EncodeCallback callback) = 0; - - virtual void Flush() = 0; - }; - - // Interface for a video decoder. - class Decoder { - public: - using DecodeCallback = - absl::AnyInvocable<void(const VideoFrame& decoded_frame)>; - - virtual ~Decoder() = default; - - virtual void Initialize() = 0; - - virtual void Decode(const EncodedImage& frame, DecodeCallback callback) = 0; - - virtual void Flush() = 0; - }; - - // Pulls coded video frames from `video_source` and passes them to `decoder`. - // Returns `VideoCodecTestStats` object that contains collected per-frame - // metrics. - virtual std::unique_ptr<VideoCodecStats> RunDecodeTest( - CodedVideoSource* video_source, - Decoder* decoder, - const DecoderSettings& decoder_settings) = 0; - - // Pulls raw video frames from `video_source` and passes them to `encoder`. - // Returns `VideoCodecTestStats` object that contains collected per-frame - // metrics. - virtual std::unique_ptr<VideoCodecStats> RunEncodeTest( - RawVideoSource* video_source, - Encoder* encoder, - const EncoderSettings& encoder_settings) = 0; - - // Pulls raw video frames from `video_source`, passes them to `encoder` and - // then passes encoded frames to `decoder`. Returns `VideoCodecTestStats` - // object that contains collected per-frame metrics. - virtual std::unique_ptr<VideoCodecStats> RunEncodeDecodeTest( - RawVideoSource* video_source, - Encoder* encoder, - Decoder* decoder, - const EncoderSettings& encoder_settings, - const DecoderSettings& decoder_settings) = 0; -}; - -} // namespace test -} // namespace webrtc - -#endif // API_TEST_VIDEO_CODEC_TESTER_H_ diff --git a/third_party/libwebrtc/api/transport/bitrate_settings_gn/moz.build b/third_party/libwebrtc/api/transport/bitrate_settings_gn/moz.build index d99d149fa3..2b732ca51e 100644 --- a/third_party/libwebrtc/api/transport/bitrate_settings_gn/moz.build +++ b/third_party/libwebrtc/api/transport/bitrate_settings_gn/moz.build @@ -184,7 +184,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -194,10 +193,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/transport/datagram_transport_interface_gn/moz.build b/third_party/libwebrtc/api/transport/datagram_transport_interface_gn/moz.build index 9168cf9156..dba9cee6bd 100644 --- a/third_party/libwebrtc/api/transport/datagram_transport_interface_gn/moz.build +++ b/third_party/libwebrtc/api/transport/datagram_transport_interface_gn/moz.build @@ -187,16 +187,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/transport/field_trial_based_config_gn/moz.build b/third_party/libwebrtc/api/transport/field_trial_based_config_gn/moz.build index fd2b2dd12b..dd3370838d 100644 --- a/third_party/libwebrtc/api/transport/field_trial_based_config_gn/moz.build +++ b/third_party/libwebrtc/api/transport/field_trial_based_config_gn/moz.build @@ -195,7 +195,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -205,10 +204,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/transport/goog_cc_gn/moz.build b/third_party/libwebrtc/api/transport/goog_cc_gn/moz.build index 4a7c84915c..80dee942e0 100644 --- a/third_party/libwebrtc/api/transport/goog_cc_gn/moz.build +++ b/third_party/libwebrtc/api/transport/goog_cc_gn/moz.build @@ -200,7 +200,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -210,10 +209,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/transport/network_control_gn/moz.build b/third_party/libwebrtc/api/transport/network_control_gn/moz.build index 76dd117a86..e11b34ba71 100644 --- a/third_party/libwebrtc/api/transport/network_control_gn/moz.build +++ b/third_party/libwebrtc/api/transport/network_control_gn/moz.build @@ -195,7 +195,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -205,10 +204,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/transport/rtp/dependency_descriptor_gn/moz.build b/third_party/libwebrtc/api/transport/rtp/dependency_descriptor_gn/moz.build index a2fe75e60e..568c7d9768 100644 --- a/third_party/libwebrtc/api/transport/rtp/dependency_descriptor_gn/moz.build +++ b/third_party/libwebrtc/api/transport/rtp/dependency_descriptor_gn/moz.build @@ -188,7 +188,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -198,10 +197,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/transport/rtp/rtp_source_gn/moz.build b/third_party/libwebrtc/api/transport/rtp/rtp_source_gn/moz.build index 9a7b0b69bf..9d993f6f68 100644 --- a/third_party/libwebrtc/api/transport/rtp/rtp_source_gn/moz.build +++ b/third_party/libwebrtc/api/transport/rtp/rtp_source_gn/moz.build @@ -187,16 +187,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/transport/stun.cc b/third_party/libwebrtc/api/transport/stun.cc index 35a65fd8e8..7ef6852260 100644 --- a/third_party/libwebrtc/api/transport/stun.cc +++ b/third_party/libwebrtc/api/transport/stun.cc @@ -41,7 +41,9 @@ uint32_t ReduceTransactionId(absl::string_view transaction_id) { RTC_DCHECK(transaction_id.length() == cricket::kStunTransactionIdLength || transaction_id.length() == cricket::kStunLegacyTransactionIdLength) << transaction_id.length(); - ByteBufferReader reader(transaction_id.data(), transaction_id.size()); + ByteBufferReader reader(rtc::MakeArrayView( + reinterpret_cast<const uint8_t*>(transaction_id.data()), + transaction_id.size())); uint32_t result = 0; uint32_t next; while (reader.ReadUInt32(&next)) { @@ -912,7 +914,8 @@ bool StunAddressAttribute::Read(ByteBufferReader* buf) { if (length() != SIZE_IP4) { return false; } - if (!buf->ReadBytes(reinterpret_cast<char*>(&v4addr), sizeof(v4addr))) { + if (!buf->ReadBytes(rtc::MakeArrayView(reinterpret_cast<uint8_t*>(&v4addr), + sizeof(v4addr)))) { return false; } rtc::IPAddress ipaddr(v4addr); @@ -922,7 +925,8 @@ bool StunAddressAttribute::Read(ByteBufferReader* buf) { if (length() != SIZE_IP6) { return false; } - if (!buf->ReadBytes(reinterpret_cast<char*>(&v6addr), sizeof(v6addr))) { + if (!buf->ReadBytes(rtc::MakeArrayView(reinterpret_cast<uint8_t*>(&v6addr), + sizeof(v6addr)))) { return false; } rtc::IPAddress ipaddr(v6addr); @@ -1128,13 +1132,13 @@ StunAttributeValueType StunByteStringAttribute::value_type() const { } void StunByteStringAttribute::CopyBytes(absl::string_view bytes) { - char* new_bytes = new char[bytes.size()]; + uint8_t* new_bytes = new uint8_t[bytes.size()]; memcpy(new_bytes, bytes.data(), bytes.size()); SetBytes(new_bytes, bytes.size()); } void StunByteStringAttribute::CopyBytes(const void* bytes, size_t length) { - char* new_bytes = new char[length]; + uint8_t* new_bytes = new uint8_t[length]; memcpy(new_bytes, bytes, length); SetBytes(new_bytes, length); } @@ -1142,7 +1146,7 @@ void StunByteStringAttribute::CopyBytes(const void* bytes, size_t length) { uint8_t StunByteStringAttribute::GetByte(size_t index) const { RTC_DCHECK(bytes_ != NULL); RTC_DCHECK(index < length()); - return static_cast<uint8_t>(bytes_[index]); + return bytes_[index]; } void StunByteStringAttribute::SetByte(size_t index, uint8_t value) { @@ -1152,8 +1156,8 @@ void StunByteStringAttribute::SetByte(size_t index, uint8_t value) { } bool StunByteStringAttribute::Read(ByteBufferReader* buf) { - bytes_ = new char[length()]; - if (!buf->ReadBytes(bytes_, length())) { + bytes_ = new uint8_t[length()]; + if (!buf->ReadBytes(rtc::ArrayView<uint8_t>(bytes_, length()))) { return false; } @@ -1166,12 +1170,12 @@ bool StunByteStringAttribute::Write(ByteBufferWriter* buf) const { if (!LengthValid(type(), length())) { return false; } - buf->WriteBytes(bytes_, length()); + buf->WriteBytes(reinterpret_cast<const char*>(bytes_), length()); WritePadding(buf); return true; } -void StunByteStringAttribute::SetBytes(char* bytes, size_t length) { +void StunByteStringAttribute::SetBytes(uint8_t* bytes, size_t length) { delete[] bytes_; bytes_ = bytes; SetLength(static_cast<uint16_t>(length)); diff --git a/third_party/libwebrtc/api/transport/stun.h b/third_party/libwebrtc/api/transport/stun.h index 4a04db33cf..62d98f71e0 100644 --- a/third_party/libwebrtc/api/transport/stun.h +++ b/third_party/libwebrtc/api/transport/stun.h @@ -519,13 +519,22 @@ class StunByteStringAttribute : public StunAttribute { StunAttributeValueType value_type() const override; - const char* bytes() const { return bytes_; } + [[deprecated("Use array_view")]] const char* bytes() const { + return reinterpret_cast<const char*>(bytes_); + } + // Returns the attribute value as a string. + // Use this for attributes that are text or text-compatible. absl::string_view string_view() const { - return absl::string_view(bytes_, length()); + return absl::string_view(reinterpret_cast<const char*>(bytes_), length()); + } + // Returns the attribute value as an uint8_t view. + // Use this function for values that are not text. + rtc::ArrayView<uint8_t> array_view() const { + return rtc::MakeArrayView(bytes_, length()); } [[deprecated]] std::string GetString() const { - return std::string(bytes_, length()); + return std::string(reinterpret_cast<const char*>(bytes_), length()); } void CopyBytes(const void* bytes, size_t length); @@ -538,9 +547,9 @@ class StunByteStringAttribute : public StunAttribute { bool Write(rtc::ByteBufferWriter* buf) const override; private: - void SetBytes(char* bytes, size_t length); + void SetBytes(uint8_t* bytes, size_t length); - char* bytes_; + uint8_t* bytes_; }; // Implements STUN attributes that record an error code. diff --git a/third_party/libwebrtc/api/transport/stun_types_gn/moz.build b/third_party/libwebrtc/api/transport/stun_types_gn/moz.build index 36750a2f18..ad873a1796 100644 --- a/third_party/libwebrtc/api/transport/stun_types_gn/moz.build +++ b/third_party/libwebrtc/api/transport/stun_types_gn/moz.build @@ -176,16 +176,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/transport/stun_unittest.cc b/third_party/libwebrtc/api/transport/stun_unittest.cc index 96ad45843b..9ad4da9a4c 100644 --- a/third_party/libwebrtc/api/transport/stun_unittest.cc +++ b/third_party/libwebrtc/api/transport/stun_unittest.cc @@ -35,7 +35,7 @@ class StunTest : public ::testing::Test { } void CheckStunTransactionID(const StunMessage& msg, - const unsigned char* expectedID, + const uint8_t* expectedID, size_t length) { ASSERT_EQ(length, msg.transaction_id().size()); ASSERT_EQ(length == kStunTransactionIdLength + 4, msg.IsLegacy()); @@ -65,10 +65,9 @@ class StunTest : public ::testing::Test { } size_t ReadStunMessageTestCase(StunMessage* msg, - const unsigned char* testcase, + const uint8_t* testcase, size_t size) { - const char* input = reinterpret_cast<const char*>(testcase); - rtc::ByteBufferReader buf(input, size); + rtc::ByteBufferReader buf(rtc::MakeArrayView(testcase, size)); if (msg->Read(&buf)) { // Returns the size the stun message should report itself as being return (size - 20); @@ -85,7 +84,7 @@ class StunTest : public ::testing::Test { // clang-format off // clang formatting doesn't respect inline comments. -static const unsigned char kStunMessageWithIPv6MappedAddress[] = { +static const uint8_t kStunMessageWithIPv6MappedAddress[] = { 0x00, 0x01, 0x00, 0x18, // message header 0x21, 0x12, 0xa4, 0x42, // transaction id 0x29, 0x1f, 0xcd, 0x7c, @@ -99,7 +98,7 @@ static const unsigned char kStunMessageWithIPv6MappedAddress[] = { 0xfe, 0xe5, 0x00, 0xc3 }; -static const unsigned char kStunMessageWithIPv4MappedAddress[] = { +static const uint8_t kStunMessageWithIPv4MappedAddress[] = { 0x01, 0x01, 0x00, 0x0c, // binding response, length 12 0x21, 0x12, 0xa4, 0x42, // magic cookie 0x29, 0x1f, 0xcd, 0x7c, // transaction ID @@ -111,7 +110,7 @@ static const unsigned char kStunMessageWithIPv4MappedAddress[] = { }; // Test XOR-mapped IP addresses: -static const unsigned char kStunMessageWithIPv6XorMappedAddress[] = { +static const uint8_t kStunMessageWithIPv6XorMappedAddress[] = { 0x01, 0x01, 0x00, 0x18, // message header (binding response) 0x21, 0x12, 0xa4, 0x42, // magic cookie (rfc5389) 0xe3, 0xa9, 0x46, 0xe1, // transaction ID @@ -125,7 +124,7 @@ static const unsigned char kStunMessageWithIPv6XorMappedAddress[] = { 0xaa, 0xed, 0x01, 0xc3 }; -static const unsigned char kStunMessageWithIPv4XorMappedAddress[] = { +static const uint8_t kStunMessageWithIPv4XorMappedAddress[] = { 0x01, 0x01, 0x00, 0x0c, // message header (binding response) 0x21, 0x12, 0xa4, 0x42, // magic cookie 0x29, 0x1f, 0xcd, 0x7c, // transaction ID @@ -137,7 +136,7 @@ static const unsigned char kStunMessageWithIPv4XorMappedAddress[] = { }; // ByteString Attribute (username) -static const unsigned char kStunMessageWithByteStringAttribute[] = { +static const uint8_t kStunMessageWithByteStringAttribute[] = { 0x00, 0x01, 0x00, 0x0c, 0x21, 0x12, 0xa4, 0x42, 0xe3, 0xa9, 0x46, 0xe1, @@ -150,7 +149,7 @@ static const unsigned char kStunMessageWithByteStringAttribute[] = { // Message with an unknown but comprehensible optional attribute. // Parsing should succeed despite this unknown attribute. -static const unsigned char kStunMessageWithUnknownAttribute[] = { +static const uint8_t kStunMessageWithUnknownAttribute[] = { 0x00, 0x01, 0x00, 0x14, 0x21, 0x12, 0xa4, 0x42, 0xe3, 0xa9, 0x46, 0xe1, @@ -164,7 +163,7 @@ static const unsigned char kStunMessageWithUnknownAttribute[] = { }; // ByteString Attribute (username) with padding byte -static const unsigned char kStunMessageWithPaddedByteStringAttribute[] = { +static const uint8_t kStunMessageWithPaddedByteStringAttribute[] = { 0x00, 0x01, 0x00, 0x08, 0x21, 0x12, 0xa4, 0x42, 0xe3, 0xa9, 0x46, 0xe1, @@ -175,7 +174,7 @@ static const unsigned char kStunMessageWithPaddedByteStringAttribute[] = { }; // Message with an Unknown Attributes (uint16_t list) attribute. -static const unsigned char kStunMessageWithUInt16ListAttribute[] = { +static const uint8_t kStunMessageWithUInt16ListAttribute[] = { 0x00, 0x01, 0x00, 0x0c, 0x21, 0x12, 0xa4, 0x42, 0xe3, 0xa9, 0x46, 0xe1, @@ -187,7 +186,7 @@ static const unsigned char kStunMessageWithUInt16ListAttribute[] = { }; // Error response message (unauthorized) -static const unsigned char kStunMessageWithErrorAttribute[] = { +static const uint8_t kStunMessageWithErrorAttribute[] = { 0x01, 0x11, 0x00, 0x14, 0x21, 0x12, 0xa4, 0x42, 0x29, 0x1f, 0xcd, 0x7c, @@ -205,7 +204,7 @@ static const unsigned char kStunMessageWithErrorAttribute[] = { // The actual length in bytes of the invalid messages (including STUN header) static const int kRealLengthOfInvalidLengthTestCases = 32; -static const unsigned char kStunMessageWithZeroLength[] = { +static const uint8_t kStunMessageWithZeroLength[] = { 0x00, 0x01, 0x00, 0x00, // length of 0 (last 2 bytes) 0x21, 0x12, 0xA4, 0x42, // magic cookie '0', '1', '2', '3', // transaction id @@ -216,7 +215,7 @@ static const unsigned char kStunMessageWithZeroLength[] = { 0x21, 0x12, 0xA4, 0x53, }; -static const unsigned char kStunMessageWithExcessLength[] = { +static const uint8_t kStunMessageWithExcessLength[] = { 0x00, 0x01, 0x00, 0x55, // length of 85 0x21, 0x12, 0xA4, 0x42, // magic cookie '0', '1', '2', '3', // transaction id @@ -227,7 +226,7 @@ static const unsigned char kStunMessageWithExcessLength[] = { 0x21, 0x12, 0xA4, 0x53, }; -static const unsigned char kStunMessageWithSmallLength[] = { +static const uint8_t kStunMessageWithSmallLength[] = { 0x00, 0x01, 0x00, 0x03, // length of 3 0x21, 0x12, 0xA4, 0x42, // magic cookie '0', '1', '2', '3', // transaction id @@ -238,7 +237,7 @@ static const unsigned char kStunMessageWithSmallLength[] = { 0x21, 0x12, 0xA4, 0x53, }; -static const unsigned char kStunMessageWithBadHmacAtEnd[] = { +static const uint8_t kStunMessageWithBadHmacAtEnd[] = { 0x00, 0x01, 0x00, 0x14, // message length exactly 20 0x21, 0x12, 0xA4, 0x42, // magic cookie '0', '1', '2', '3', // transaction ID @@ -253,7 +252,7 @@ static const unsigned char kStunMessageWithBadHmacAtEnd[] = { // RTCP packet, for testing we correctly ignore non stun packet types. // V=2, P=false, RC=0, Type=200, Len=6, Sender-SSRC=85, etc -static const unsigned char kRtcpPacket[] = { +static const uint8_t kRtcpPacket[] = { 0x80, 0xc8, 0x00, 0x06, 0x00, 0x00, 0x00, 0x55, 0xce, 0xa5, 0x18, 0x3a, 0x39, 0xcc, 0x7d, 0x09, 0x23, 0xed, 0x19, 0x07, 0x00, 0x00, 0x01, 0x56, @@ -266,7 +265,7 @@ static const unsigned char kRtcpPacket[] = { // Software name (response): "test vector" (without quotes) // Username: "evtj:h6vY" (without quotes) // Password: "VOkJxbRl1RmTxUk/WvJxBt" (without quotes) -static const unsigned char kRfc5769SampleMsgTransactionId[] = { +static const uint8_t kRfc5769SampleMsgTransactionId[] = { 0xb7, 0xe7, 0xa7, 0x01, 0xbc, 0x34, 0xd6, 0x86, 0xfa, 0x87, 0xdf, 0xae }; static const char kRfc5769SampleMsgClientSoftware[] = "STUN test client"; @@ -278,7 +277,7 @@ static const rtc::SocketAddress kRfc5769SampleMsgMappedAddress( static const rtc::SocketAddress kRfc5769SampleMsgIPv6MappedAddress( "2001:db8:1234:5678:11:2233:4455:6677", 32853); -static const unsigned char kRfc5769SampleMsgWithAuthTransactionId[] = { +static const uint8_t kRfc5769SampleMsgWithAuthTransactionId[] = { 0x78, 0xad, 0x34, 0x33, 0xc6, 0xad, 0x72, 0xc0, 0x29, 0xda, 0x41, 0x2e }; static const char kRfc5769SampleMsgWithAuthUsername[] = @@ -289,7 +288,7 @@ static const char kRfc5769SampleMsgWithAuthNonce[] = static const char kRfc5769SampleMsgWithAuthRealm[] = "example.org"; // 2.1. Sample Request -static const unsigned char kRfc5769SampleRequest[] = { +static const uint8_t kRfc5769SampleRequest[] = { 0x00, 0x01, 0x00, 0x58, // Request type and message length 0x21, 0x12, 0xa4, 0x42, // Magic cookie 0xb7, 0xe7, 0xa7, 0x01, // } @@ -320,7 +319,7 @@ static const unsigned char kRfc5769SampleRequest[] = { }; // 2.1. Sample Request -static const unsigned char kSampleRequestMI32[] = { +static const uint8_t kSampleRequestMI32[] = { 0x00, 0x01, 0x00, 0x48, // Request type and message length 0x21, 0x12, 0xa4, 0x42, // Magic cookie 0xb7, 0xe7, 0xa7, 0x01, // } @@ -347,7 +346,7 @@ static const unsigned char kSampleRequestMI32[] = { }; // 2.2. Sample IPv4 Response -static const unsigned char kRfc5769SampleResponse[] = { +static const uint8_t kRfc5769SampleResponse[] = { 0x01, 0x01, 0x00, 0x3c, // Response type and message length 0x21, 0x12, 0xa4, 0x42, // Magic cookie 0xb7, 0xe7, 0xa7, 0x01, // } @@ -371,7 +370,7 @@ static const unsigned char kRfc5769SampleResponse[] = { }; // 2.3. Sample IPv6 Response -static const unsigned char kRfc5769SampleResponseIPv6[] = { +static const uint8_t kRfc5769SampleResponseIPv6[] = { 0x01, 0x01, 0x00, 0x48, // Response type and message length 0x21, 0x12, 0xa4, 0x42, // Magic cookie 0xb7, 0xe7, 0xa7, 0x01, // } @@ -398,7 +397,7 @@ static const unsigned char kRfc5769SampleResponseIPv6[] = { }; // 2.4. Sample Request with Long-Term Authentication -static const unsigned char kRfc5769SampleRequestLongTermAuth[] = { +static const uint8_t kRfc5769SampleRequestLongTermAuth[] = { 0x00, 0x01, 0x00, 0x60, // Request type and message length 0x21, 0x12, 0xa4, 0x42, // Magic cookie 0x78, 0xad, 0x34, 0x33, // } @@ -433,7 +432,7 @@ static const unsigned char kRfc5769SampleRequestLongTermAuth[] = { // Length parameter is changed to 0x38 from 0x58. // AddMessageIntegrity will add MI information and update the length param // accordingly. -static const unsigned char kRfc5769SampleRequestWithoutMI[] = { +static const uint8_t kRfc5769SampleRequestWithoutMI[] = { 0x00, 0x01, 0x00, 0x38, // Request type and message length 0x21, 0x12, 0xa4, 0x42, // Magic cookie 0xb7, 0xe7, 0xa7, 0x01, // } @@ -457,7 +456,7 @@ static const unsigned char kRfc5769SampleRequestWithoutMI[] = { // This HMAC differs from the RFC 5769 SampleRequest message. This differs // because spec uses 0x20 for the padding where as our implementation uses 0. -static const unsigned char kCalculatedHmac1[] = { +static const uint8_t kCalculatedHmac1[] = { 0x79, 0x07, 0xc2, 0xd2, // } 0xed, 0xbf, 0xea, 0x48, // } 0x0e, 0x4c, 0x76, 0xd8, // } HMAC-SHA1 fingerprint @@ -469,14 +468,14 @@ static const unsigned char kCalculatedHmac1[] = { // above since the sum is computed including header // and the header is different since the message is shorter // than when MESSAGE-INTEGRITY is used. -static const unsigned char kCalculatedHmac1_32[] = { +static const uint8_t kCalculatedHmac1_32[] = { 0xda, 0x39, 0xde, 0x5d, // } }; // Length parameter is changed to 0x1c from 0x3c. // AddMessageIntegrity will add MI information and update the length param // accordingly. -static const unsigned char kRfc5769SampleResponseWithoutMI[] = { +static const uint8_t kRfc5769SampleResponseWithoutMI[] = { 0x01, 0x01, 0x00, 0x1c, // Response type and message length 0x21, 0x12, 0xa4, 0x42, // Magic cookie 0xb7, 0xe7, 0xa7, 0x01, // } @@ -493,7 +492,7 @@ static const unsigned char kRfc5769SampleResponseWithoutMI[] = { // This HMAC differs from the RFC 5769 SampleResponse message. This differs // because spec uses 0x20 for the padding where as our implementation uses 0. -static const unsigned char kCalculatedHmac2[] = { +static const uint8_t kCalculatedHmac2[] = { 0x5d, 0x6b, 0x58, 0xbe, // } 0xad, 0x94, 0xe0, 0x7e, // } 0xef, 0x0d, 0xfc, 0x12, // } HMAC-SHA1 fingerprint @@ -505,7 +504,7 @@ static const unsigned char kCalculatedHmac2[] = { // above since the sum is computed including header // and the header is different since the message is shorter // than when MESSAGE-INTEGRITY is used. -static const unsigned char kCalculatedHmac2_32[] = { +static const uint8_t kCalculatedHmac2_32[] = { 0xe7, 0x5c, 0xd3, 0x16, // } }; @@ -513,14 +512,14 @@ static const unsigned char kCalculatedHmac2_32[] = { // A transaction ID without the 'magic cookie' portion // pjnat's test programs use this transaction ID a lot. -const unsigned char kTestTransactionId1[] = {0x029, 0x01f, 0x0cd, 0x07c, - 0x0ba, 0x058, 0x0ab, 0x0d7, - 0x0f2, 0x041, 0x001, 0x000}; +const uint8_t kTestTransactionId1[] = {0x029, 0x01f, 0x0cd, 0x07c, + 0x0ba, 0x058, 0x0ab, 0x0d7, + 0x0f2, 0x041, 0x001, 0x000}; // They use this one sometimes too. -const unsigned char kTestTransactionId2[] = {0x0e3, 0x0a9, 0x046, 0x0e1, - 0x07c, 0x000, 0x0c2, 0x062, - 0x054, 0x008, 0x001, 0x000}; +const uint8_t kTestTransactionId2[] = {0x0e3, 0x0a9, 0x046, 0x0e1, + 0x07c, 0x000, 0x0c2, 0x062, + 0x054, 0x008, 0x001, 0x000}; const in6_addr kIPv6TestAddress1 = { {{0x24, 0x01, 0xfa, 0x00, 0x00, 0x04, 0x10, 0x00, 0xbe, 0x30, 0x5b, 0xff, @@ -743,7 +742,7 @@ TEST_F(StunTest, ReadRfc5769RequestMessageLongTermAuth) { // kStunMessageWithIPv4MappedAddress, but with a different value where the // magic cookie was. TEST_F(StunTest, ReadLegacyMessage) { - unsigned char rfc3489_packet[sizeof(kStunMessageWithIPv4MappedAddress)]; + uint8_t rfc3489_packet[sizeof(kStunMessageWithIPv4MappedAddress)]; memcpy(rfc3489_packet, kStunMessageWithIPv4MappedAddress, sizeof(kStunMessageWithIPv4MappedAddress)); // Overwrite the magic cookie here. @@ -1122,10 +1121,9 @@ TEST_F(StunTest, WriteMessageWithAUInt16ListAttribute) { } // Test that we fail to read messages with invalid lengths. -void CheckFailureToRead(const unsigned char* testcase, size_t length) { +void CheckFailureToRead(const uint8_t* testcase, size_t length) { StunMessage msg; - const char* input = reinterpret_cast<const char*>(testcase); - rtc::ByteBufferReader buf(input, length); + rtc::ByteBufferReader buf(rtc::MakeArrayView(testcase, length)); ASSERT_FALSE(msg.Read(&buf)); } @@ -1228,16 +1226,14 @@ TEST_F(StunTest, ValidateMessageIntegrity) { // the RFC5769 test messages used include attributes not found in basic STUN. TEST_F(StunTest, AddMessageIntegrity) { IceMessage msg; - rtc::ByteBufferReader buf( - reinterpret_cast<const char*>(kRfc5769SampleRequestWithoutMI), - sizeof(kRfc5769SampleRequestWithoutMI)); + rtc::ByteBufferReader buf(kRfc5769SampleRequestWithoutMI); EXPECT_TRUE(msg.Read(&buf)); EXPECT_TRUE(msg.AddMessageIntegrity(kRfc5769SampleMsgPassword)); const StunByteStringAttribute* mi_attr = msg.GetByteString(STUN_ATTR_MESSAGE_INTEGRITY); EXPECT_EQ(20U, mi_attr->length()); - EXPECT_EQ( - 0, memcmp(mi_attr->bytes(), kCalculatedHmac1, sizeof(kCalculatedHmac1))); + EXPECT_EQ(0, memcmp(mi_attr->array_view().data(), kCalculatedHmac1, + sizeof(kCalculatedHmac1))); rtc::ByteBufferWriter buf1; EXPECT_TRUE(msg.Write(&buf1)); @@ -1246,16 +1242,14 @@ TEST_F(StunTest, AddMessageIntegrity) { kRfc5769SampleMsgPassword)); IceMessage msg2; - rtc::ByteBufferReader buf2( - reinterpret_cast<const char*>(kRfc5769SampleResponseWithoutMI), - sizeof(kRfc5769SampleResponseWithoutMI)); + rtc::ByteBufferReader buf2(kRfc5769SampleResponseWithoutMI); EXPECT_TRUE(msg2.Read(&buf2)); EXPECT_TRUE(msg2.AddMessageIntegrity(kRfc5769SampleMsgPassword)); const StunByteStringAttribute* mi_attr2 = msg2.GetByteString(STUN_ATTR_MESSAGE_INTEGRITY); EXPECT_EQ(20U, mi_attr2->length()); - EXPECT_EQ( - 0, memcmp(mi_attr2->bytes(), kCalculatedHmac2, sizeof(kCalculatedHmac2))); + EXPECT_EQ(0, memcmp(mi_attr2->array_view().data(), kCalculatedHmac2, + sizeof(kCalculatedHmac2))); rtc::ByteBufferWriter buf3; EXPECT_TRUE(msg2.Write(&buf3)); @@ -1321,15 +1315,13 @@ TEST_F(StunTest, ValidateMessageIntegrity32) { // Validate that we generate correct MESSAGE-INTEGRITY-32 attributes. TEST_F(StunTest, AddMessageIntegrity32) { IceMessage msg; - rtc::ByteBufferReader buf( - reinterpret_cast<const char*>(kRfc5769SampleRequestWithoutMI), - sizeof(kRfc5769SampleRequestWithoutMI)); + rtc::ByteBufferReader buf(kRfc5769SampleRequestWithoutMI); EXPECT_TRUE(msg.Read(&buf)); EXPECT_TRUE(msg.AddMessageIntegrity32(kRfc5769SampleMsgPassword)); const StunByteStringAttribute* mi_attr = msg.GetByteString(STUN_ATTR_GOOG_MESSAGE_INTEGRITY_32); EXPECT_EQ(4U, mi_attr->length()); - EXPECT_EQ(0, memcmp(mi_attr->bytes(), kCalculatedHmac1_32, + EXPECT_EQ(0, memcmp(mi_attr->array_view().data(), kCalculatedHmac1_32, sizeof(kCalculatedHmac1_32))); rtc::ByteBufferWriter buf1; @@ -1339,15 +1331,13 @@ TEST_F(StunTest, AddMessageIntegrity32) { kRfc5769SampleMsgPassword)); IceMessage msg2; - rtc::ByteBufferReader buf2( - reinterpret_cast<const char*>(kRfc5769SampleResponseWithoutMI), - sizeof(kRfc5769SampleResponseWithoutMI)); + rtc::ByteBufferReader buf2(kRfc5769SampleResponseWithoutMI); EXPECT_TRUE(msg2.Read(&buf2)); EXPECT_TRUE(msg2.AddMessageIntegrity32(kRfc5769SampleMsgPassword)); const StunByteStringAttribute* mi_attr2 = msg2.GetByteString(STUN_ATTR_GOOG_MESSAGE_INTEGRITY_32); EXPECT_EQ(4U, mi_attr2->length()); - EXPECT_EQ(0, memcmp(mi_attr2->bytes(), kCalculatedHmac2_32, + EXPECT_EQ(0, memcmp(mi_attr2->array_view().data(), kCalculatedHmac2_32, sizeof(kCalculatedHmac2_32))); rtc::ByteBufferWriter buf3; @@ -1420,9 +1410,7 @@ TEST_F(StunTest, ValidateFingerprint) { TEST_F(StunTest, AddFingerprint) { IceMessage msg; - rtc::ByteBufferReader buf( - reinterpret_cast<const char*>(kRfc5769SampleRequestWithoutMI), - sizeof(kRfc5769SampleRequestWithoutMI)); + rtc::ByteBufferReader buf(kRfc5769SampleRequestWithoutMI); EXPECT_TRUE(msg.Read(&buf)); EXPECT_TRUE(msg.AddFingerprint()); @@ -1435,7 +1423,7 @@ TEST_F(StunTest, AddFingerprint) { // Sample "GTURN" relay message. // clang-format off // clang formatting doesn't respect inline comments. -static const unsigned char kRelayMessage[] = { +static const uint8_t kRelayMessage[] = { 0x00, 0x01, 0x00, 88, // message header 0x21, 0x12, 0xA4, 0x42, // magic cookie '0', '1', '2', '3', // transaction id @@ -1470,13 +1458,11 @@ static const unsigned char kRelayMessage[] = { TEST_F(StunTest, ReadRelayMessage) { RelayMessage msg; - const char* input = reinterpret_cast<const char*>(kRelayMessage); - size_t size = sizeof(kRelayMessage); - rtc::ByteBufferReader buf(input, size); + rtc::ByteBufferReader buf(kRelayMessage); EXPECT_TRUE(msg.Read(&buf)); EXPECT_EQ(STUN_BINDING_REQUEST, msg.type()); - EXPECT_EQ(size - 20, msg.length()); + EXPECT_EQ(sizeof(kRelayMessage) - 20, msg.length()); EXPECT_EQ("0123456789ab", msg.transaction_id()); RelayMessage msg2(STUN_BINDING_REQUEST, "0123456789ab"); @@ -1516,7 +1502,7 @@ TEST_F(StunTest, ReadRelayMessage) { bytes = msg.GetByteString(STUN_ATTR_MAGIC_COOKIE); ASSERT_TRUE(bytes != NULL); EXPECT_EQ(4U, bytes->length()); - EXPECT_EQ(0, memcmp(bytes->bytes(), TURN_MAGIC_COOKIE_VALUE, + EXPECT_EQ(0, memcmp(bytes->array_view().data(), TURN_MAGIC_COOKIE_VALUE, sizeof(TURN_MAGIC_COOKIE_VALUE))); bytes2 = StunAttribute::CreateByteString(STUN_ATTR_MAGIC_COOKIE); @@ -1565,21 +1551,21 @@ TEST_F(StunTest, ReadRelayMessage) { rtc::ByteBufferWriter out; EXPECT_TRUE(msg.Write(&out)); - EXPECT_EQ(size, out.Length()); + EXPECT_EQ(sizeof(kRelayMessage), out.Length()); size_t len1 = out.Length(); rtc::ByteBufferReader read_buf(out); std::string outstring; read_buf.ReadString(&outstring, len1); - EXPECT_EQ(0, memcmp(outstring.c_str(), input, len1)); + EXPECT_EQ(0, memcmp(outstring.c_str(), kRelayMessage, len1)); rtc::ByteBufferWriter out2; EXPECT_TRUE(msg2.Write(&out2)); - EXPECT_EQ(size, out2.Length()); + EXPECT_EQ(sizeof(kRelayMessage), out2.Length()); size_t len2 = out2.Length(); rtc::ByteBufferReader read_buf2(out2); std::string outstring2; read_buf2.ReadString(&outstring2, len2); - EXPECT_EQ(0, memcmp(outstring2.c_str(), input, len2)); + EXPECT_EQ(0, memcmp(outstring2.c_str(), kRelayMessage, len2)); } // Test that we can remove attribute from a message. @@ -1600,8 +1586,9 @@ TEST_F(StunTest, RemoveAttribute) { auto attr = msg.RemoveAttribute(STUN_ATTR_USERNAME); ASSERT_NE(attr, nullptr); EXPECT_EQ(attr->type(), STUN_ATTR_USERNAME); - EXPECT_STREQ("kes", - static_cast<StunByteStringAttribute*>(attr.get())->bytes()); + EXPECT_STREQ("kes", static_cast<StunByteStringAttribute*>(attr.get()) + ->string_view() + .data()); EXPECT_LT(msg.length(), len); } @@ -1623,8 +1610,9 @@ TEST_F(StunTest, RemoveAttribute) { auto attr = msg.RemoveAttribute(STUN_ATTR_USERNAME); ASSERT_NE(attr, nullptr); EXPECT_EQ(attr->type(), STUN_ATTR_USERNAME); - EXPECT_STREQ("kenta", - static_cast<StunByteStringAttribute*>(attr.get())->bytes()); + EXPECT_STREQ("kenta", static_cast<StunByteStringAttribute*>(attr.get()) + ->string_view() + .data()); } // Remove should remove the last added occurrence. @@ -1632,8 +1620,9 @@ TEST_F(StunTest, RemoveAttribute) { auto attr = msg.RemoveAttribute(STUN_ATTR_USERNAME); ASSERT_NE(attr, nullptr); EXPECT_EQ(attr->type(), STUN_ATTR_USERNAME); - EXPECT_STREQ("kes", - static_cast<StunByteStringAttribute*>(attr.get())->bytes()); + EXPECT_STREQ("kes", static_cast<StunByteStringAttribute*>(attr.get()) + ->string_view() + .data()); } // Removing something that does exist should return nullptr. @@ -1666,8 +1655,9 @@ TEST_F(StunTest, CopyAttribute) { auto copy = CopyStunAttribute(*attr.get(), buffer_ptr); ASSERT_EQ(copy->value_type(), STUN_VALUE_BYTE_STRING); - EXPECT_STREQ("kes", - static_cast<StunByteStringAttribute*>(copy.get())->bytes()); + EXPECT_STREQ("kes", static_cast<StunByteStringAttribute*>(copy.get()) + ->string_view() + .data()); } { // Test StunAddressAttribute. @@ -1826,7 +1816,7 @@ TEST_F(StunTest, GoogMiscInfo) { ASSERT_EQ(size, out.Length()); size_t read_size = ReadStunMessageTestCase( - &msg, reinterpret_cast<const unsigned char*>(out.Data()), out.Length()); + &msg, reinterpret_cast<const uint8_t*>(out.Data()), out.Length()); ASSERT_EQ(read_size + 20, size); CheckStunHeader(msg, STUN_BINDING_REQUEST, read_size); const StunUInt16ListAttribute* types = @@ -1860,9 +1850,7 @@ TEST_F(StunTest, ValidateMessageIntegrityWithParser) { webrtc::metrics::Reset(); // Ensure counters start from zero. // Try the messages from RFC 5769. StunMessage message; - rtc::ByteBufferReader reader( - reinterpret_cast<const char*>(kRfc5769SampleRequest), - sizeof(kRfc5769SampleRequest)); + rtc::ByteBufferReader reader(kRfc5769SampleRequest); EXPECT_TRUE(message.Read(&reader)); EXPECT_EQ(message.ValidateMessageIntegrity(kRfc5769SampleMsgPassword), StunMessage::IntegrityStatus::kIntegrityOk); diff --git a/third_party/libwebrtc/api/transport_api_gn/moz.build b/third_party/libwebrtc/api/transport_api_gn/moz.build index af080bee0b..506cb2f24d 100644 --- a/third_party/libwebrtc/api/transport_api_gn/moz.build +++ b/third_party/libwebrtc/api/transport_api_gn/moz.build @@ -188,7 +188,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -198,10 +197,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/units/data_rate_gn/moz.build b/third_party/libwebrtc/api/units/data_rate_gn/moz.build index 4964c3e05f..b2bb9b7c5f 100644 --- a/third_party/libwebrtc/api/units/data_rate_gn/moz.build +++ b/third_party/libwebrtc/api/units/data_rate_gn/moz.build @@ -188,7 +188,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -198,10 +197,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/units/data_size_gn/moz.build b/third_party/libwebrtc/api/units/data_size_gn/moz.build index 0fe0bc100b..ceaa9da9a2 100644 --- a/third_party/libwebrtc/api/units/data_size_gn/moz.build +++ b/third_party/libwebrtc/api/units/data_size_gn/moz.build @@ -188,7 +188,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -198,10 +197,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/units/frequency_gn/moz.build b/third_party/libwebrtc/api/units/frequency_gn/moz.build index 413a57a8f3..8b0607cf75 100644 --- a/third_party/libwebrtc/api/units/frequency_gn/moz.build +++ b/third_party/libwebrtc/api/units/frequency_gn/moz.build @@ -188,7 +188,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -198,10 +197,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/units/time_delta_gn/moz.build b/third_party/libwebrtc/api/units/time_delta_gn/moz.build index 39355ed588..6220551614 100644 --- a/third_party/libwebrtc/api/units/time_delta_gn/moz.build +++ b/third_party/libwebrtc/api/units/time_delta_gn/moz.build @@ -188,7 +188,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -198,10 +197,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/units/timestamp_gn/moz.build b/third_party/libwebrtc/api/units/timestamp_gn/moz.build index da68eea160..083b864ff0 100644 --- a/third_party/libwebrtc/api/units/timestamp_gn/moz.build +++ b/third_party/libwebrtc/api/units/timestamp_gn/moz.build @@ -188,7 +188,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -198,10 +197,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/video/BUILD.gn b/third_party/libwebrtc/api/video/BUILD.gn index 807fdcc3a9..5ec689c096 100644 --- a/third_party/libwebrtc/api/video/BUILD.gn +++ b/third_party/libwebrtc/api/video/BUILD.gn @@ -67,6 +67,7 @@ rtc_library("video_frame") { ":video_rtp_headers", "..:array_view", "..:make_ref_counted", + "..:ref_count", "..:rtp_packet_info", "..:scoped_refptr", "..:video_track_source_constraints", diff --git a/third_party/libwebrtc/api/video/builtin_video_bitrate_allocator_factory_gn/moz.build b/third_party/libwebrtc/api/video/builtin_video_bitrate_allocator_factory_gn/moz.build index cb32b05fa6..620fba65aa 100644 --- a/third_party/libwebrtc/api/video/builtin_video_bitrate_allocator_factory_gn/moz.build +++ b/third_party/libwebrtc/api/video/builtin_video_bitrate_allocator_factory_gn/moz.build @@ -200,7 +200,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -210,10 +209,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/video/encoded_frame_gn/moz.build b/third_party/libwebrtc/api/video/encoded_frame_gn/moz.build index fdb34bf903..4c92d824ae 100644 --- a/third_party/libwebrtc/api/video/encoded_frame_gn/moz.build +++ b/third_party/libwebrtc/api/video/encoded_frame_gn/moz.build @@ -195,7 +195,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -205,10 +204,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/video/encoded_image_gn/moz.build b/third_party/libwebrtc/api/video/encoded_image_gn/moz.build index 3bc012ad28..25d2d0998e 100644 --- a/third_party/libwebrtc/api/video/encoded_image_gn/moz.build +++ b/third_party/libwebrtc/api/video/encoded_image_gn/moz.build @@ -195,7 +195,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -205,10 +204,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/video/frame_buffer_gn/moz.build b/third_party/libwebrtc/api/video/frame_buffer_gn/moz.build index 2614e67133..048097ce50 100644 --- a/third_party/libwebrtc/api/video/frame_buffer_gn/moz.build +++ b/third_party/libwebrtc/api/video/frame_buffer_gn/moz.build @@ -200,7 +200,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -210,10 +209,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/video/recordable_encoded_frame_gn/moz.build b/third_party/libwebrtc/api/video/recordable_encoded_frame_gn/moz.build index ace02623f7..a5b4399e4a 100644 --- a/third_party/libwebrtc/api/video/recordable_encoded_frame_gn/moz.build +++ b/third_party/libwebrtc/api/video/recordable_encoded_frame_gn/moz.build @@ -187,16 +187,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/video/render_resolution_gn/moz.build b/third_party/libwebrtc/api/video/render_resolution_gn/moz.build index f27e4cc944..6ee89b6451 100644 --- a/third_party/libwebrtc/api/video/render_resolution_gn/moz.build +++ b/third_party/libwebrtc/api/video/render_resolution_gn/moz.build @@ -176,16 +176,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/video/resolution_gn/moz.build b/third_party/libwebrtc/api/video/resolution_gn/moz.build index 673bb4f1c9..de79a64a66 100644 --- a/third_party/libwebrtc/api/video/resolution_gn/moz.build +++ b/third_party/libwebrtc/api/video/resolution_gn/moz.build @@ -176,16 +176,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/video/video_adaptation_gn/moz.build b/third_party/libwebrtc/api/video/video_adaptation_gn/moz.build index ffff5639ee..4483b3eaef 100644 --- a/third_party/libwebrtc/api/video/video_adaptation_gn/moz.build +++ b/third_party/libwebrtc/api/video/video_adaptation_gn/moz.build @@ -188,7 +188,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -198,10 +197,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/video/video_bitrate_allocation_gn/moz.build b/third_party/libwebrtc/api/video/video_bitrate_allocation_gn/moz.build index be63dc8252..1196221e63 100644 --- a/third_party/libwebrtc/api/video/video_bitrate_allocation_gn/moz.build +++ b/third_party/libwebrtc/api/video/video_bitrate_allocation_gn/moz.build @@ -188,7 +188,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -198,10 +197,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/video/video_bitrate_allocator_factory_gn/moz.build b/third_party/libwebrtc/api/video/video_bitrate_allocator_factory_gn/moz.build index 222bcaf251..ff4934b7b5 100644 --- a/third_party/libwebrtc/api/video/video_bitrate_allocator_factory_gn/moz.build +++ b/third_party/libwebrtc/api/video/video_bitrate_allocator_factory_gn/moz.build @@ -187,16 +187,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/video/video_bitrate_allocator_gn/moz.build b/third_party/libwebrtc/api/video/video_bitrate_allocator_gn/moz.build index e7f3f5a4de..758cbb7521 100644 --- a/third_party/libwebrtc/api/video/video_bitrate_allocator_gn/moz.build +++ b/third_party/libwebrtc/api/video/video_bitrate_allocator_gn/moz.build @@ -188,7 +188,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -198,10 +197,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/video/video_codec_constants_gn/moz.build b/third_party/libwebrtc/api/video/video_codec_constants_gn/moz.build index 403c521a1f..2275aa4aa1 100644 --- a/third_party/libwebrtc/api/video/video_codec_constants_gn/moz.build +++ b/third_party/libwebrtc/api/video/video_codec_constants_gn/moz.build @@ -176,16 +176,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/video/video_frame.h b/third_party/libwebrtc/api/video/video_frame.h index 2608f9aa42..5b77bcca23 100644 --- a/third_party/libwebrtc/api/video/video_frame.h +++ b/third_party/libwebrtc/api/video/video_frame.h @@ -33,10 +33,10 @@ class RTC_EXPORT VideoFrame { static constexpr uint16_t kNotSetId = 0; struct RTC_EXPORT UpdateRect { - int offset_x; - int offset_y; - int width; - int height; + int offset_x = 0; + int offset_y = 0; + int width = 0; + int height = 0; // Makes this UpdateRect a bounding box of this and other rect. void Union(const UpdateRect& other); diff --git a/third_party/libwebrtc/api/video/video_frame_buffer.h b/third_party/libwebrtc/api/video/video_frame_buffer.h index aaf786699f..ca6e9067db 100644 --- a/third_party/libwebrtc/api/video/video_frame_buffer.h +++ b/third_party/libwebrtc/api/video/video_frame_buffer.h @@ -14,8 +14,8 @@ #include <stdint.h> #include "api/array_view.h" +#include "api/ref_count.h" #include "api/scoped_refptr.h" -#include "rtc_base/ref_count.h" #include "rtc_base/system/rtc_export.h" namespace webrtc { @@ -44,7 +44,7 @@ class NV12BufferInterface; // performance by providing an optimized path without intermediate conversions. // Frame metadata such as rotation and timestamp are stored in // webrtc::VideoFrame, and not here. -class RTC_EXPORT VideoFrameBuffer : public rtc::RefCountInterface { +class RTC_EXPORT VideoFrameBuffer : public webrtc::RefCountInterface { public: // New frame buffer types will be added conservatively when there is an // opportunity to optimize the path between some pair of video source and diff --git a/third_party/libwebrtc/api/video/video_frame_gn/moz.build b/third_party/libwebrtc/api/video/video_frame_gn/moz.build index b0fc90582b..203b03a0a3 100644 --- a/third_party/libwebrtc/api/video/video_frame_gn/moz.build +++ b/third_party/libwebrtc/api/video/video_frame_gn/moz.build @@ -206,7 +206,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -216,10 +215,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/video/video_frame_i010_gn/moz.build b/third_party/libwebrtc/api/video/video_frame_i010_gn/moz.build index 7fe6e4df95..1243513335 100644 --- a/third_party/libwebrtc/api/video/video_frame_i010_gn/moz.build +++ b/third_party/libwebrtc/api/video/video_frame_i010_gn/moz.build @@ -202,7 +202,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -212,10 +211,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/video/video_frame_metadata_gn/moz.build b/third_party/libwebrtc/api/video/video_frame_metadata_gn/moz.build index d80dda9178..6616ea0dd6 100644 --- a/third_party/libwebrtc/api/video/video_frame_metadata_gn/moz.build +++ b/third_party/libwebrtc/api/video/video_frame_metadata_gn/moz.build @@ -195,7 +195,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -205,10 +204,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/video/video_frame_type_gn/moz.build b/third_party/libwebrtc/api/video/video_frame_type_gn/moz.build index 8fcbef76e8..ab7548fe8d 100644 --- a/third_party/libwebrtc/api/video/video_frame_type_gn/moz.build +++ b/third_party/libwebrtc/api/video/video_frame_type_gn/moz.build @@ -180,16 +180,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/video/video_layers_allocation_gn/moz.build b/third_party/libwebrtc/api/video/video_layers_allocation_gn/moz.build index b8ba6ec54b..7f88b15c07 100644 --- a/third_party/libwebrtc/api/video/video_layers_allocation_gn/moz.build +++ b/third_party/libwebrtc/api/video/video_layers_allocation_gn/moz.build @@ -180,16 +180,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/video/video_rtp_headers_gn/moz.build b/third_party/libwebrtc/api/video/video_rtp_headers_gn/moz.build index f65965f80b..2f02f285f2 100644 --- a/third_party/libwebrtc/api/video/video_rtp_headers_gn/moz.build +++ b/third_party/libwebrtc/api/video/video_rtp_headers_gn/moz.build @@ -198,7 +198,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -208,10 +207,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/video/video_stream_encoder_gn/moz.build b/third_party/libwebrtc/api/video/video_stream_encoder_gn/moz.build index 7b8a329463..f75eac803f 100644 --- a/third_party/libwebrtc/api/video/video_stream_encoder_gn/moz.build +++ b/third_party/libwebrtc/api/video/video_stream_encoder_gn/moz.build @@ -187,16 +187,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/video_codecs/bitstream_parser_api_gn/moz.build b/third_party/libwebrtc/api/video_codecs/bitstream_parser_api_gn/moz.build index c3642c46d0..866df39c97 100644 --- a/third_party/libwebrtc/api/video_codecs/bitstream_parser_api_gn/moz.build +++ b/third_party/libwebrtc/api/video_codecs/bitstream_parser_api_gn/moz.build @@ -180,16 +180,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/video_codecs/rtc_software_fallback_wrappers_gn/moz.build b/third_party/libwebrtc/api/video_codecs/rtc_software_fallback_wrappers_gn/moz.build index 4e928c91a4..e8139cb6f2 100644 --- a/third_party/libwebrtc/api/video_codecs/rtc_software_fallback_wrappers_gn/moz.build +++ b/third_party/libwebrtc/api/video_codecs/rtc_software_fallback_wrappers_gn/moz.build @@ -201,7 +201,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -211,10 +210,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/video_codecs/scalability_mode_gn/moz.build b/third_party/libwebrtc/api/video_codecs/scalability_mode_gn/moz.build index d63795ed94..491c4880cc 100644 --- a/third_party/libwebrtc/api/video_codecs/scalability_mode_gn/moz.build +++ b/third_party/libwebrtc/api/video_codecs/scalability_mode_gn/moz.build @@ -188,7 +188,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -198,10 +197,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/video_codecs/video_codecs_api_gn/moz.build b/third_party/libwebrtc/api/video_codecs/video_codecs_api_gn/moz.build index 89cce4215b..c6c127e5b6 100644 --- a/third_party/libwebrtc/api/video_codecs/video_codecs_api_gn/moz.build +++ b/third_party/libwebrtc/api/video_codecs/video_codecs_api_gn/moz.build @@ -205,7 +205,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -215,10 +214,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/video_codecs/vp8_temporal_layers_factory_gn/moz.build b/third_party/libwebrtc/api/video_codecs/vp8_temporal_layers_factory_gn/moz.build index e757e9ed51..7131057c2f 100644 --- a/third_party/libwebrtc/api/video_codecs/vp8_temporal_layers_factory_gn/moz.build +++ b/third_party/libwebrtc/api/video_codecs/vp8_temporal_layers_factory_gn/moz.build @@ -200,7 +200,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -210,10 +209,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/video_track_source_constraints_gn/moz.build b/third_party/libwebrtc/api/video_track_source_constraints_gn/moz.build index 8213e3088f..9e9852b71f 100644 --- a/third_party/libwebrtc/api/video_track_source_constraints_gn/moz.build +++ b/third_party/libwebrtc/api/video_track_source_constraints_gn/moz.build @@ -176,16 +176,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/api/wrapping_async_dns_resolver.h b/third_party/libwebrtc/api/wrapping_async_dns_resolver.h deleted file mode 100644 index b384f97652..0000000000 --- a/third_party/libwebrtc/api/wrapping_async_dns_resolver.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright 2021 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef API_WRAPPING_ASYNC_DNS_RESOLVER_H_ -#define API_WRAPPING_ASYNC_DNS_RESOLVER_H_ - -#include <functional> -#include <memory> -#include <utility> - -#include "absl/memory/memory.h" -#include "api/async_dns_resolver.h" -#include "api/sequence_checker.h" -#include "rtc_base/async_resolver.h" -#include "rtc_base/async_resolver_interface.h" -#include "rtc_base/checks.h" -#include "rtc_base/socket_address.h" -#include "rtc_base/third_party/sigslot/sigslot.h" -#include "rtc_base/thread_annotations.h" - -// This file defines a DNS resolver that wraps an old-style -// AsyncResolver. -// It is part of the conversion to the newer interface, and will go away -// once conversion is finished. -// TODO(bugs.webrtc.org/12598): Delete this API. - -namespace webrtc { - -class [[deprecated("Use AsyncDnsResolver directly")]] WrappingAsyncDnsResolver; - -class [[deprecated( - "Use AsyncDnsResolver directly")]] RTC_EXPORT WrappingAsyncDnsResolverResult - : public AsyncDnsResolverResult { - public: - explicit WrappingAsyncDnsResolverResult(WrappingAsyncDnsResolver* owner) - : owner_(owner) {} - ~WrappingAsyncDnsResolverResult() {} - - // Note: Inline declaration not possible, since it refers to - // WrappingAsyncDnsResolver. - bool GetResolvedAddress(int family, rtc::SocketAddress* addr) const override; - int GetError() const override; - - private: - WrappingAsyncDnsResolver* const owner_; -}; - -class RTC_EXPORT WrappingAsyncDnsResolver : public AsyncDnsResolverInterface, - public sigslot::has_slots<> { - public: -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - explicit WrappingAsyncDnsResolver(rtc::AsyncResolverInterface* wrapped) - : wrapped_(absl::WrapUnique(wrapped)), result_(this) {} - - ~WrappingAsyncDnsResolver() override { - // Workaround to get around the fact that sigslot-using objects can't be - // destroyed from within their callback: Alert class users early. - // TODO(bugs.webrtc.org/12651): Delete this class once the sigslot users are - // gone. - RTC_CHECK(!within_resolve_result_); - wrapped_.release()->Destroy(false); - } - - void Start(const rtc::SocketAddress& addr, - absl::AnyInvocable<void()> callback) override { - RTC_DCHECK_RUN_ON(&sequence_checker_); - PrepareToResolve(std::move(callback)); - wrapped_->Start(addr); - } - - void Start(const rtc::SocketAddress& addr, - int family, - absl::AnyInvocable<void()> callback) override { - RTC_DCHECK_RUN_ON(&sequence_checker_); - PrepareToResolve(std::move(callback)); - wrapped_->Start(addr, family); - } - - const AsyncDnsResolverResult& result() const override { - RTC_DCHECK_RUN_ON(&sequence_checker_); - RTC_DCHECK_EQ(State::kResolved, state_); - return result_; - } - - private: - enum class State { kNotStarted, kStarted, kResolved }; - - friend class WrappingAsyncDnsResolverResult; - // For use by WrappingAsyncDnsResolverResult - rtc::AsyncResolverInterface* wrapped() const { - RTC_DCHECK_RUN_ON(&sequence_checker_); - return wrapped_.get(); - } - - void PrepareToResolve(absl::AnyInvocable<void()> callback) { - RTC_DCHECK_RUN_ON(&sequence_checker_); - RTC_DCHECK_EQ(State::kNotStarted, state_); - state_ = State::kStarted; - callback_ = std::move(callback); - wrapped_->SignalDone.connect(this, - &WrappingAsyncDnsResolver::OnResolveResult); - } - - void OnResolveResult(rtc::AsyncResolverInterface* ref) { - RTC_DCHECK_RUN_ON(&sequence_checker_); - RTC_DCHECK(state_ == State::kStarted); - RTC_DCHECK_EQ(ref, wrapped_.get()); - state_ = State::kResolved; - within_resolve_result_ = true; - callback_(); - within_resolve_result_ = false; - } - - // The class variables need to be accessed on a single thread. - SequenceChecker sequence_checker_; - absl::AnyInvocable<void()> callback_ RTC_GUARDED_BY(sequence_checker_); - std::unique_ptr<rtc::AsyncResolverInterface> wrapped_ - RTC_GUARDED_BY(sequence_checker_); - State state_ RTC_GUARDED_BY(sequence_checker_) = State::kNotStarted; - WrappingAsyncDnsResolverResult result_ RTC_GUARDED_BY(sequence_checker_); - bool within_resolve_result_ RTC_GUARDED_BY(sequence_checker_) = false; -#pragma clang diagnostic pop -}; - -} // namespace webrtc - -#endif // API_WRAPPING_ASYNC_DNS_RESOLVER_H_ |