chromium/third_party/webrtc_overrides/BUILD.gn

# Copyright 2017 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/cast.gni")
import("//third_party/webrtc/webrtc.gni")

if (is_android) {
  import("//build/config/android/rules.gni")
}

webrtc_configs = [ "//third_party/webrtc:common_config" ]

webrtc_public_configs = [ "//third_party/webrtc:common_inherited_config" ]

webrtc_public_deps = [
  ":bridge_ice_controller",
  ":init_webrtc",
  ":metrics",
  ":task_queue_factory",
  "//third_party/webrtc/api:array_view",
  "//third_party/webrtc/api:async_dns_resolver",
  "//third_party/webrtc/api:candidate",
  "//third_party/webrtc/api:dtls_transport_interface",
  "//third_party/webrtc/api:enable_media",
  "//third_party/webrtc/api:field_trials_view",
  "//third_party/webrtc/api:frame_transformer_factory",
  "//third_party/webrtc/api:frame_transformer_interface",
  "//third_party/webrtc/api:ice_transport_factory",
  "//third_party/webrtc/api:ice_transport_interface",
  "//third_party/webrtc/api:libjingle_logging_api",
  "//third_party/webrtc/api:libjingle_peerconnection_api",
  "//third_party/webrtc/api:location",
  "//third_party/webrtc/api:make_ref_counted",
  "//third_party/webrtc/api:media_stream_interface",
  "//third_party/webrtc/api:packet_socket_factory",
  "//third_party/webrtc/api:priority",
  "//third_party/webrtc/api:rtc_error",
  "//third_party/webrtc/api:rtc_stats_api",
  "//third_party/webrtc/api:rtp_headers",
  "//third_party/webrtc/api:rtp_packet_info",
  "//third_party/webrtc/api:rtp_parameters",
  "//third_party/webrtc/api:scoped_refptr",
  "//third_party/webrtc/api:simulated_network_api",
  "//third_party/webrtc/api:transport_api",
  "//third_party/webrtc/api:turn_customizer",
  "//third_party/webrtc/api/adaptation:resource_adaptation_api",
  "//third_party/webrtc/api/audio:aec3_config",
  "//third_party/webrtc/api/audio:aec3_factory",
  "//third_party/webrtc/api/audio_codecs:audio_codecs_api",
  "//third_party/webrtc/api/audio_codecs/L16:audio_decoder_L16",
  "//third_party/webrtc/api/audio_codecs/L16:audio_encoder_L16",
  "//third_party/webrtc/api/audio_codecs/g711:audio_decoder_g711",
  "//third_party/webrtc/api/audio_codecs/g711:audio_encoder_g711",
  "//third_party/webrtc/api/audio_codecs/g722:audio_decoder_g722",
  "//third_party/webrtc/api/audio_codecs/g722:audio_encoder_g722",
  "//third_party/webrtc/api/audio_codecs/opus:audio_decoder_multiopus",
  "//third_party/webrtc/api/audio_codecs/opus:audio_decoder_opus",
  "//third_party/webrtc/api/audio_codecs/opus:audio_encoder_multiopus",
  "//third_party/webrtc/api/audio_codecs/opus:audio_encoder_opus",
  "//third_party/webrtc/api/environment:environment_factory",
  "//third_party/webrtc/api/metronome",
  "//third_party/webrtc/api/rtc_event_log:rtc_event_log_factory",
  "//third_party/webrtc/api/task_queue:task_queue",
  "//third_party/webrtc/api/transport:enums",
  "//third_party/webrtc/api/transport:field_trial_based_config",
  "//third_party/webrtc/api/transport:goog_cc",
  "//third_party/webrtc/api/transport:network_control",
  "//third_party/webrtc/api/transport/rtp:rtp_source",
  "//third_party/webrtc/api/units:data_rate",
  "//third_party/webrtc/api/units:time_delta",
  "//third_party/webrtc/api/units:timestamp",
  "//third_party/webrtc/api/video:encoded_image",
  "//third_party/webrtc/api/video:recordable_encoded_frame",
  "//third_party/webrtc/api/video:resolution",
  "//third_party/webrtc/api/video:video_bitrate_allocation",
  "//third_party/webrtc/api/video:video_frame",
  "//third_party/webrtc/api/video:video_frame_metadata",
  "//third_party/webrtc/api/video:video_frame_type",
  "//third_party/webrtc/api/video:video_rtp_headers",
  "//third_party/webrtc/api/video_codecs:builtin_video_decoder_factory",
  "//third_party/webrtc/api/video_codecs:rtc_software_fallback_wrappers",
  "//third_party/webrtc/api/video_codecs:video_codecs_api",
  "//third_party/webrtc/call:simulated_network",
  "//third_party/webrtc/common_video",
  "//third_party/webrtc/common_video:common_video",
  "//third_party/webrtc/media:codec",
  "//third_party/webrtc/media:media_channel",
  "//third_party/webrtc/media:media_constants",
  "//third_party/webrtc/media:rtc_audio_video",
  "//third_party/webrtc/media:rtc_internal_video_codecs",
  "//third_party/webrtc/media:rtc_media",
  "//third_party/webrtc/media:rtc_media_base",
  "//third_party/webrtc/media:rtc_simulcast_encoder_adapter",
  "//third_party/webrtc/media:rtp_utils",
  "//third_party/webrtc/media:turn_utils",
  "//third_party/webrtc/modules/audio_device",
  "//third_party/webrtc/modules/audio_device:audio_device_api",
  "//third_party/webrtc/modules/audio_processing",
  "//third_party/webrtc/modules/audio_processing:api",
  "//third_party/webrtc/modules/audio_processing:audio_processing_statistics",
  "//third_party/webrtc/modules/audio_processing/aec_dump",
  "//third_party/webrtc/modules/audio_processing/aec_dump:aec_dump",
  "//third_party/webrtc/modules/desktop_capture",
  "//third_party/webrtc/modules/desktop_capture:primitives",
  "//third_party/webrtc/modules/video_coding:video_codec_interface",
  "//third_party/webrtc/modules/video_coding:webrtc_h264",
  "//third_party/webrtc/modules/video_coding/svc:scalability_mode_util",
  "//third_party/webrtc/p2p:libstunprober",
  "//third_party/webrtc/p2p:rtc_p2p",
  "//third_party/webrtc/pc:ice_server_parsing",
  "//third_party/webrtc/pc:libjingle_peerconnection",
  "//third_party/webrtc/pc:media_session",
  "//third_party/webrtc/pc:rtc_pc",
  "//third_party/webrtc/pc:session_description",
  "//third_party/webrtc/pc:webrtc_sdp",
  "//third_party/webrtc/rtc_base:async_dns_resolver",
  "//third_party/webrtc/rtc_base:async_packet_socket",
  "//third_party/webrtc/rtc_base:byte_order",
  "//third_party/webrtc/rtc_base:crypto_random",
  "//third_party/webrtc/rtc_base:data_rate_limiter",
  "//third_party/webrtc/rtc_base:event_tracer",
  "//third_party/webrtc/rtc_base:ip_address",
  "//third_party/webrtc/rtc_base:logging",
  "//third_party/webrtc/rtc_base:mdns_responder_interface",
  "//third_party/webrtc/rtc_base:net_helpers",
  "//third_party/webrtc/rtc_base:net_test_helpers",
  "//third_party/webrtc/rtc_base:network",
  "//third_party/webrtc/rtc_base:refcount",
  "//third_party/webrtc/rtc_base:rtc_certificate_generator",
  "//third_party/webrtc/rtc_base:socket",
  "//third_party/webrtc/rtc_base:socket_address",
  "//third_party/webrtc/rtc_base:socket_factory",
  "//third_party/webrtc/rtc_base:socket_server",
  "//third_party/webrtc/rtc_base:ssl",
  "//third_party/webrtc/rtc_base:ssl_adapter",
  "//third_party/webrtc/rtc_base:threading",
  "//third_party/webrtc/rtc_base:timestamp_aligner",
  "//third_party/webrtc/rtc_base:timeutils",
  "//third_party/webrtc/rtc_base/network:ecn_marking",
  "//third_party/webrtc/rtc_base/network:received_packet",
  "//third_party/webrtc/rtc_base/system:rtc_export",
  "//third_party/webrtc/rtc_base/third_party/base64",
  "//third_party/webrtc/rtc_base/third_party/sigslot",
  "//third_party/webrtc/rtc_base/third_party/sigslot:sigslot",
  "//third_party/webrtc/stats",
  "//third_party/webrtc/stats:rtc_stats",
  "//third_party/webrtc/stats:rtc_stats_test_utils",
  "//third_party/webrtc/system_wrappers",
]
if (defined(rtc_exclude_system_time) && rtc_exclude_system_time) {
  webrtc_public_deps += [ ":system_time" ]
}
if (is_castos || is_cast_android) {
  webrtc_public_deps += [
    "//third_party/webrtc/api:enable_media_with_defaults",
    "//third_party/webrtc/api:network_state_predictor_api",
    "//third_party/webrtc/api/audio:audio_frame_api",
    "//third_party/webrtc/api/transport:goog_cc",
    "//third_party/webrtc/api/transport:network_control",
    "//third_party/webrtc/call:call_interfaces",
    "//third_party/webrtc/modules/audio_device:audio_device_default",
    "//third_party/webrtc/modules/audio_mixer:audio_mixer_impl",
    "//third_party/webrtc/modules/video_coding:codec_globals_headers",
  ]
}
if (is_castos || is_cast_android || is_nacl) {
  # For chromecast and NaCL, provide a default field trial implementation.
  webrtc_public_deps += [ "//third_party/webrtc/system_wrappers:field_trial" ]
} else {
  # Other Chromium flavors get a custom implementation.
  # See the default value of "rtc_exclude_field_trial_default"
  # in https://cs.chromium.org/chromium/src/third_party/webrtc/webrtc.gni
  # for how that is done.
  webrtc_public_deps += [ ":field_trial" ]
}
if ((is_linux || is_chromeos) && rtc_use_pipewire) {
  webrtc_public_deps += [
    "//third_party/webrtc/modules/portal",
    "//third_party/webrtc/modules/video_capture:video_capture_internal_impl",
    "//third_party/webrtc/modules/video_capture:video_capture_module",
  ]
}

component("webrtc_component") {
  configs += webrtc_configs
  public_configs = webrtc_public_configs
  public_deps = webrtc_public_deps
}

source_set("init_webrtc") {
  visibility = [ ":*" ]
  sources = [
    "init_webrtc.cc",
    "init_webrtc.h",
  ]
  configs += [
    "//third_party/webrtc:common_config",
    "//third_party/webrtc:library_impl_config",
  ]
  public_configs = [
    "//third_party/webrtc:common_inherited_config",

    # TODO(mbonadei): Abseil config propagation is needed because
    # WebRTC's BUILD.gn files don't use `public_deps`, there are
    # good reasons for this, but they may disappear in the future.
    # In that case it is ok to remove these two lines.
    "//third_party/abseil-cpp:absl_include_config",
    "//third_party/abseil-cpp:absl_define_config",
  ]
  deps = [
    "//base",
    "//third_party/webrtc/rtc_base:event_tracer",
    "//third_party/webrtc/rtc_base:logging",
    "//third_party/webrtc/rtc_base/system:rtc_export",
    "//third_party/webrtc/system_wrappers",
  ]
}

source_set("metrics") {
  # TODO(mbonadei): Migrate WebRTC deps to webrtc_component and uncomment.
  # visibility = [ ":*" ]
  sources = [ "metrics.cc" ]
  deps = [ "//base" ]
}

source_set("field_trial") {
  # TODO(mbonadei): Migrate WebRTC deps to webrtc_component and uncomment.
  # visibility = [ ":*" ]
  sources = [ "field_trial.cc" ]
  deps = [ "//base" ]
}

# If you want to depend on this target you should depend on :webrtc_component
# instead (which has a public dependency on this target).
source_set("task_queue_factory") {
  visibility = [ ":*" ]
  sources = [
    # Tested in
    # third_party/blink/renderer/platform/peerconnection/coalesced_tasks_test.cc
    "coalesced_tasks.cc",
    "coalesced_tasks.h",

    # Tested in
    # third_party/blink/renderer/platform/peerconnection/metronome_source_test.cc
    "metronome_source.cc",
    "metronome_source.h",
    "timer_based_tick_provider.cc",
    "timer_based_tick_provider.h",

    # Tested in
    # third_party/blink/renderer/platform/peerconnection/task_queue_factory_test.cc
    "task_queue_factory.cc",
    "task_queue_factory.h",

    # Tested in
    # third_party/blink/renderer/platform/peerconnection/low_precision_timer_test.cc
    "low_precision_timer.cc",
    "low_precision_timer.h",
  ]
  configs += [ "//third_party/webrtc:library_impl_config" ]
  deps = [
    "//base",
    "//third_party/webrtc/api:location",
    "//third_party/webrtc/api/metronome",
    "//third_party/webrtc/api/task_queue",
    "//third_party/webrtc/api/task_queue:pending_task_safety_flag",
    "//third_party/webrtc/api/units:time_delta",
    "//third_party/webrtc/rtc_base/system:rtc_export",
  ]
}

source_set("metronome_like_task_queue_test") {
  configs += webrtc_configs
  public_configs = webrtc_public_configs

  testonly = true

  sources = [
    "test/metronome_like_task_queue_test.cc",
    "test/metronome_like_task_queue_test.h",
  ]
  deps = [
    ":webrtc_component",
    "//base",
    "//base/test:test_support",
    "//testing/gtest:gtest",
  ]
}

source_set("system_time") {
  # TODO(mbonadei): Migrate WebRTC deps to webrtc_component and uncomment.
  # visibility = [ ":*" ]
  sources = [ "rtc_base/system_time.cc" ]
  deps = [ "//base" ]
}

source_set("bridge_ice_controller") {
  visibility = [ ":*" ]
  sources = [
    # Tested in
    # third_party/blink/renderer/platform/peerconnection/bridge_ice_controller_test.cc
    "p2p/base/bridge_ice_controller.cc",
    "p2p/base/bridge_ice_controller.h",
    "p2p/base/bridge_ice_transport_factory.cc",
    "p2p/base/bridge_ice_transport_factory.h",
    "p2p/base/ice_connection.cc",
    "p2p/base/ice_connection.h",
    "p2p/base/ice_controller_observer.h",
    "p2p/base/ice_interaction_interface.h",
    "p2p/base/ice_ping_proposal.cc",
    "p2p/base/ice_ping_proposal.h",
    "p2p/base/ice_proposal.h",
    "p2p/base/ice_prune_proposal.cc",
    "p2p/base/ice_prune_proposal.h",
    "p2p/base/ice_switch_proposal.cc",
    "p2p/base/ice_switch_proposal.h",
  ]
  configs += [ "//third_party/webrtc:library_impl_config" ]
  deps = [
    "//base",
    "//third_party/abseil-cpp:absl",
    "//third_party/webrtc/api:array_view",
    "//third_party/webrtc/api:candidate",
    "//third_party/webrtc/api:ice_transport_interface",
    "//third_party/webrtc/api:make_ref_counted",
    "//third_party/webrtc/api:rtc_error",
    "//third_party/webrtc/api:scoped_refptr",
    "//third_party/webrtc/p2p:rtc_p2p",
    "//third_party/webrtc/rtc_base:logging",
    "//third_party/webrtc/rtc_base:stringutils",
    "//third_party/webrtc/rtc_base/system:rtc_export",
  ]
}

source_set("ice_controller_test_utils") {
  testonly = true

  sources = [
    "p2p/base/fake_connection_factory.cc",
    "p2p/base/fake_connection_factory.h",
    "rtc_base/fake_socket_factory.cc",
    "rtc_base/fake_socket_factory.h",
  ]
  deps = [
    ":webrtc_component",
    "//base",
  ]
}