# Copyright (c) 2014 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 is the root build file for GN. GN will start processing by loading this
# file, and recursively load all dependencies until all dependencies are either
# resolved or known not to exist (which will cause the build to fail). So if
# you add a new build file, there must be some path of dependencies from this
# file to your new one or GN won't know about it.

# Use of visibility = clauses:
# The default visibility for all rtc_ targets is equivalent to "//*", or
# "all targets in webrtc can depend on this, nothing outside can".
#
# When overriding, the choices are:
# - visibility = [ "*" ] - public. Stuff outside webrtc can use this.
# - visibility = [ ":*" ] - directory private.
# As a general guideline, only targets in api/ should have public visibility.

import("//build/config/linux/pkg_config.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("webrtc.gni")
if (rtc_enable_protobuf) {
  import("//third_party/protobuf/proto_library.gni")
}
if (is_android) {
  import("//build/config/android/config.gni")
  import("//build/config/android/rules.gni")
  import("//third_party/jni_zero/jni_zero.gni")
}

if (!build_with_chromium) {
  # This target should (transitively) cause everything to be built; if you run
  # 'ninja default' and then 'ninja all', the second build should do no work.
  group("default") {
    testonly = true
    deps = [ ":webrtc" ]
    if (rtc_build_examples) {
      deps += [ "examples" ]
    }
    if (rtc_build_tools) {
      deps += [ "rtc_tools" ]
    }
    if (rtc_include_tests) {
      deps += [
        ":rtc_unittests",
        ":video_engine_tests",
        ":voip_unittests",
        ":webrtc_nonparallel_tests",
        ":webrtc_perf_tests",
        "common_audio:common_audio_unittests",
        "common_video:common_video_unittests",
        "examples:examples_unittests",
        "media:rtc_media_unittests",
        "modules:modules_tests",
        "modules:modules_unittests",
        "modules/audio_coding:audio_coding_tests",
        "modules/audio_processing:audio_processing_tests",
        "modules/remote_bitrate_estimator:rtp_to_text",
        "modules/rtp_rtcp:test_packet_masks_metrics",
        "modules/video_capture:video_capture_internal_impl",
        "modules/video_coding:video_codec_perf_tests",
        "net/dcsctp:dcsctp_unittests",
        "pc:peerconnection_unittests",
        "pc:rtc_pc_unittests",
        "pc:slow_peer_connection_unittests",
        "pc:svc_tests",
        "rtc_tools:rtp_generator",
        "rtc_tools:video_encoder",
        "rtc_tools:video_replay",
        "stats:rtc_stats_unittests",
        "system_wrappers:system_wrappers_unittests",
        "test",
        "video:screenshare_loopback",
        "video:sv_loopback",
        "video:video_loopback",
      ]
      if (!is_asan) {
        # Do not build :webrtc_lib_link_test because lld complains on some OS
        # (e.g. when target_os = "mac") when is_asan=true. For more details,
        # see bugs.webrtc.org/11027#c5.
        deps += [ ":webrtc_lib_link_test" ]
      }
      if (is_ios) {
        deps += [
          "examples:apprtcmobile_tests",
          "sdk:sdk_framework_unittests",
          "sdk:sdk_unittests",
        ]
      }
      if (is_android) {
        deps += [
          "examples:android_examples_junit_tests",
          "sdk/android:android_instrumentation_test_apk",
          "sdk/android:android_sdk_junit_tests",
        ]
      } else {
        deps += [ "modules/video_capture:video_capture_tests" ]
      }
      if (rtc_enable_protobuf) {
        deps += [
          "logging:rtc_event_log_rtp_dump",
          "tools_webrtc/perf:webrtc_dashboard_upload",
        ]
      }
      if ((is_linux || is_chromeos) && rtc_use_pipewire) {
        deps += [ "modules/desktop_capture:shared_screencast_stream_test" ]
      }
    }
    if (target_os == "android") {
      deps += [ "tools_webrtc:binary_version_check" ]
    }
  }
}

# Abseil Flags by default doesn't register command line flags on mobile
# platforms, WebRTC tests requires them (e.g. on simualtors) so this
# config will be applied to testonly targets globally (see webrtc.gni).
config("absl_flags_configs") {
  defines = [ "ABSL_FLAGS_STRIP_NAMES=0" ]
}

config("library_impl_config") {
  # Build targets that contain WebRTC implementation need this macro to
  # be defined in order to correctly export symbols when is_component_build
  # is true.
  # For more info see: rtc_base/build/rtc_export.h.
  defines = [ "WEBRTC_LIBRARY_IMPL" ]
}

# Contains the defines and includes in common.gypi that are duplicated both as
# target_defaults and direct_dependent_settings.
config("common_inherited_config") {
  defines = []
  cflags = []
  ldflags = []

  if (rtc_jni_generator_legacy_symbols) {
    defines += [ "RTC_JNI_GENERATOR_LEGACY_SYMBOLS" ]
  }

  if (rtc_objc_prefix != "") {
    defines += [ "RTC_OBJC_TYPE_PREFIX=${rtc_objc_prefix}" ]
  }

  if (rtc_dlog_always_on) {
    defines += [ "DLOG_ALWAYS_ON" ]
  }

  if (rtc_enable_symbol_export || is_component_build) {
    defines += [ "WEBRTC_ENABLE_SYMBOL_EXPORT" ]
  }
  if (rtc_enable_objc_symbol_export) {
    defines += [ "WEBRTC_ENABLE_OBJC_SYMBOL_EXPORT" ]
  }

  if (!rtc_builtin_ssl_root_certificates) {
    defines += [ "WEBRTC_EXCLUDE_BUILT_IN_SSL_ROOT_CERTS" ]
  }

  if (rtc_disable_check_msg) {
    defines += [ "RTC_DISABLE_CHECK_MSG" ]
  }

  if (rtc_enable_avx2) {
    defines += [ "WEBRTC_ENABLE_AVX2" ]
  }

  if (rtc_enable_win_wgc) {
    defines += [ "RTC_ENABLE_WIN_WGC" ]
  }

  # Some tests need to declare their own trace event handlers. If this define is
  # not set, the first time TRACE_EVENT_* is called it will store the return
  # value for the current handler in an static variable, so that subsequent
  # changes to the handler for that TRACE_EVENT_* will be ignored.
  # So when tests are included, we set this define, making it possible to use
  # different event handlers in different tests.
  if (rtc_include_tests) {
    defines += [ "WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=1" ]
  } else {
    defines += [ "WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=0" ]
  }
  if (build_with_chromium) {
    defines += [ "WEBRTC_CHROMIUM_BUILD" ]
    include_dirs = [
      # The overrides must be included first as that is the mechanism for
      # selecting the override headers in Chromium.
      "../webrtc_overrides",

      # Allow includes to be prefixed with webrtc/ in case it is not an
      # immediate subdirectory of the top-level.
      ".",

      # Just like the root WebRTC directory is added to include path, the
      # corresponding directory tree with generated files needs to be added too.
      # Note: this path does not change depending on the current target, e.g.
      # it is always "//gen/third_party/webrtc" when building with Chromium.
      # See also: http://cs.chromium.org/?q=%5C"default_include_dirs
      # https://gn.googlesource.com/gn/+/master/docs/reference.md#target_gen_dir
      target_gen_dir,
    ]
  }
  if (is_posix || is_fuchsia) {
    defines += [ "WEBRTC_POSIX" ]
  }
  if (is_ios) {
    defines += [
      "WEBRTC_MAC",
      "WEBRTC_IOS",
    ]
  }
  if (is_linux || is_chromeos) {
    defines += [ "WEBRTC_LINUX" ]
  }
  if (is_mac) {
    defines += [ "WEBRTC_MAC" ]
  }
  if (is_fuchsia) {
    defines += [ "WEBRTC_FUCHSIA" ]
  }
  if (is_win) {
    defines += [ "WEBRTC_WIN" ]
  }
  if (is_android) {
    defines += [
      "WEBRTC_LINUX",
      "WEBRTC_ANDROID",
    ]

    if (build_with_mozilla) {
      defines += [ "WEBRTC_ANDROID_OPENSLES" ]
    }
  }
  if (is_chromeos) {
    defines += [ "CHROMEOS" ]
  }

  if (rtc_sanitize_coverage != "") {
    assert(is_clang, "sanitizer coverage requires clang")
    cflags += [ "-fsanitize-coverage=${rtc_sanitize_coverage}" ]
    ldflags += [ "-fsanitize-coverage=${rtc_sanitize_coverage}" ]
  }

  if (is_ubsan) {
    cflags += [ "-fsanitize=float-cast-overflow" ]
  }
}

# TODO(bugs.webrtc.org/9693): Remove the possibility to suppress this warning
# as soon as WebRTC compiles without it.
config("no_global_constructors") {
  if (is_clang) {
    cflags = [ "-Wno-global-constructors" ]
  }
}

config("rtc_prod_config") {
  # Ideally, WebRTC production code (but not test code) should have these flags.
  if (is_clang) {
    cflags = [
      "-Wexit-time-destructors",
      "-Wglobal-constructors",
    ]
  }
}

config("common_config") {
  cflags = []
  cflags_c = []
  cflags_cc = []
  cflags_objc = []
  defines = []

  if (rtc_enable_protobuf) {
    defines += [ "WEBRTC_ENABLE_PROTOBUF=1" ]
  } else {
    defines += [ "WEBRTC_ENABLE_PROTOBUF=0" ]
  }

  if (rtc_strict_field_trials == "") {
    defines += [ "WEBRTC_STRICT_FIELD_TRIALS=0" ]
  } else if (rtc_strict_field_trials == "dcheck") {
    defines += [ "WEBRTC_STRICT_FIELD_TRIALS=1" ]
  } else if (rtc_strict_field_trials == "warn") {
    defines += [ "WEBRTC_STRICT_FIELD_TRIALS=2" ]
  } else {
    assert(false,
           "Unsupported value for rtc_strict_field_trials: " +
               "$rtc_strict_field_trials")
  }

  if (rtc_include_internal_audio_device) {
    defines += [ "WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE" ]
  }

  if (rtc_libvpx_build_vp9) {
    defines += [ "RTC_ENABLE_VP9" ]
  }

  if (rtc_use_h265) {
    defines += [ "RTC_ENABLE_H265" ]
  }

  if (rtc_include_dav1d_in_internal_decoder_factory) {
    defines += [ "RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY" ]
  }

  if (rtc_enable_sctp) {
    defines += [ "WEBRTC_HAVE_SCTP" ]
  }

  if (rtc_enable_external_auth) {
    defines += [ "ENABLE_EXTERNAL_AUTH" ]
  }

  if (rtc_use_h264) {
    defines += [ "WEBRTC_USE_H264" ]
  }

  if (rtc_use_absl_mutex) {
    defines += [ "WEBRTC_ABSL_MUTEX" ]
  }

  if (rtc_enable_libevent) {
    defines += [ "WEBRTC_ENABLE_LIBEVENT" ]
  }

  if (rtc_disable_logging) {
    defines += [ "RTC_DISABLE_LOGGING" ]
  }

  if (rtc_disable_trace_events) {
    defines += [ "RTC_DISABLE_TRACE_EVENTS" ]
  }

  if (rtc_disable_metrics) {
    defines += [ "RTC_DISABLE_METRICS" ]
  }

  if (rtc_exclude_transient_suppressor) {
    defines += [ "WEBRTC_EXCLUDE_TRANSIENT_SUPPRESSOR" ]
  }

  if (rtc_exclude_audio_processing_module) {
    defines += [ "WEBRTC_EXCLUDE_AUDIO_PROCESSING_MODULE" ]
  }

  if (is_clang) {
    cflags += [
      # TODO(webrtc:13219): Fix -Wshadow instances and enable.
      "-Wno-shadow",

      # See https://reviews.llvm.org/D56731 for details about this
      # warning.
      "-Wctad-maybe-unsupported",
    ]
  }

  if (build_with_chromium) {
    defines += [
      # NOTICE: Since common_inherited_config is used in public_configs for our
      # targets, there's no point including the defines in that config here.
      # TODO(kjellander): Cleanup unused ones and move defines closer to the
      # source when webrtc:4256 is completed.
      "HAVE_WEBRTC_VIDEO",
      "LOGGING_INSIDE_WEBRTC",
    ]
  } else {
    if (is_posix || is_fuchsia) {
      cflags_c += [
        # TODO(bugs.webrtc.org/9029): enable commented compiler flags.
        # Some of these flags should also be added to cflags_objc.

        # "-Wextra",  (used when building C++ but not when building C)
        # "-Wmissing-prototypes",  (C/Obj-C only)
        # "-Wmissing-declarations",  (ensure this is always used C/C++, etc..)
        "-Wstrict-prototypes",

        # "-Wpointer-arith",  (ensure this is always used C/C++, etc..)
        # "-Wbad-function-cast",  (C/Obj-C only)
        # "-Wnested-externs",  (C/Obj-C only)
      ]
      cflags_objc += [ "-Wstrict-prototypes" ]
      cflags_cc = [
        "-Wnon-virtual-dtor",

        # This is enabled for clang; enable for gcc as well.
        "-Woverloaded-virtual",
      ]
    }

    if (is_clang) {
      cflags += [ "-Wc++11-narrowing" ]

      if (!is_fuchsia) {
        # Compiling with the Fuchsia SDK results in Wundef errors
        # TODO(bugs.fuchsia.dev/100722): Remove from (!is_fuchsia) branch when
        # Fuchsia build errors are fixed.
        cflags += [ "-Wundef" ]
      }

      if (!is_nacl) {
        # Flags NaCl (Clang 3.7) do not recognize.
        cflags += [ "-Wunused-lambda-capture" ]
      }
    }

    if (is_win && !is_clang) {
      # MSVC warning suppressions (needed to use Abseil).
      # TODO(bugs.webrtc.org/9274): Remove these warnings as soon as MSVC allows
      # external headers warning suppression (or fix them upstream).
      cflags += [ "/wd4702" ]  # unreachable code

      # MSVC 2019 warning suppressions for C++17 compiling
      cflags +=
          [ "/wd5041" ]  # out-of-line definition for constexpr static data
                         # member is not needed and is deprecated in C++17
    }
  }

  if (current_cpu == "arm64") {
    defines += [ "WEBRTC_ARCH_ARM64" ]
    defines += [ "WEBRTC_HAS_NEON" ]
  }

  if (current_cpu == "arm") {
    defines += [ "WEBRTC_ARCH_ARM" ]
    if (arm_version >= 7) {
      defines += [ "WEBRTC_ARCH_ARM_V7" ]
      if (arm_use_neon) {
        defines += [ "WEBRTC_HAS_NEON" ]
      }
    }
  }

  if (current_cpu == "mipsel") {
    defines += [ "MIPS32_LE" ]
    if (mips_float_abi == "hard") {
      defines += [ "MIPS_FPU_LE" ]
    }
    if (mips_arch_variant == "r2") {
      defines += [ "MIPS32_R2_LE" ]
    }
    if (mips_dsp_rev == 1) {
      defines += [ "MIPS_DSP_R1_LE" ]
    } else if (mips_dsp_rev == 2) {
      defines += [
        "MIPS_DSP_R1_LE",
        "MIPS_DSP_R2_LE",
      ]
    }
  }

  if (is_android && !is_clang) {
    # The Android NDK doesn"t provide optimized versions of these
    # functions. Ensure they are disabled for all compilers.
    cflags += [
      "-fno-builtin-cos",
      "-fno-builtin-sin",
      "-fno-builtin-cosf",
      "-fno-builtin-sinf",
    ]
  }

  if (use_fuzzing_engine) {
    # Used in Chromium's overrides to disable logging
    defines += [ "WEBRTC_UNSAFE_FUZZER_MODE" ]
  }

  if (!build_with_chromium && rtc_win_undef_unicode) {
    cflags += [
      "/UUNICODE",
      "/U_UNICODE",
    ]
  }
}

config("common_objc") {
  frameworks = [ "Foundation.framework" ]
}

if (!build_with_chromium) {
  # Target to build all the WebRTC production code.
  rtc_static_library("webrtc") {
    # Only the root target and the test should depend on this.
    visibility = [
      "//:default",
      "//:webrtc_lib_link_test",
    ]

    sources = []
    complete_static_lib = true
    suppressed_configs += [ "//build/config/compiler:thin_archive" ]
    defines = []

    deps = [
      "api:create_peerconnection_factory",
      "api:libjingle_peerconnection_api",
      "api:rtc_error",
      "api:transport_api",
      "api/crypto",
      "api/rtc_event_log:rtc_event_log_factory",
      "api/task_queue",
      "api/task_queue:default_task_queue_factory",
      "api/test/metrics",
      "api/video_codecs:video_decoder_factory_template",
      "api/video_codecs:video_decoder_factory_template_dav1d_adapter",
      "api/video_codecs:video_decoder_factory_template_libvpx_vp8_adapter",
      "api/video_codecs:video_decoder_factory_template_libvpx_vp9_adapter",
      "api/video_codecs:video_decoder_factory_template_open_h264_adapter",
      "api/video_codecs:video_encoder_factory_template",
      "api/video_codecs:video_encoder_factory_template_libaom_av1_adapter",
      "api/video_codecs:video_encoder_factory_template_libvpx_vp8_adapter",
      "api/video_codecs:video_encoder_factory_template_libvpx_vp9_adapter",
      "api/video_codecs:video_encoder_factory_template_open_h264_adapter",
      "audio",
      "call",
      "common_audio",
      "common_video",
      "logging:rtc_event_log_api",
      "media",
      "modules",
      "modules/video_capture:video_capture_internal_impl",
      "p2p:rtc_p2p",
      "pc:libjingle_peerconnection",
      "pc:rtc_pc",
      "sdk",
      "video",
    ]

    if (rtc_include_builtin_audio_codecs) {
      deps += [
        "api/audio_codecs:builtin_audio_decoder_factory",
        "api/audio_codecs:builtin_audio_encoder_factory",
      ]
    }

    if (build_with_mozilla) {
      deps += [
        "api/video:video_frame",
        "api/video:video_rtp_headers",
      ]
    } else {
      deps += [
        "api",
        "logging",
        "p2p",
        "pc",
        "stats",
      ]
    }

    if (rtc_enable_protobuf) {
      deps += [ "logging:rtc_event_log_proto" ]
    }
  }

  if (rtc_include_tests && !is_asan) {
    rtc_executable("webrtc_lib_link_test") {
      testonly = true

      # This target is used for checking to link, so do not check dependencies
      # on gn check.
      check_includes = false  # no-presubmit-check TODO(bugs.webrtc.org/12785)

      sources = [ "webrtc_lib_link_test.cc" ]
      deps = [
        # NOTE: Don't add deps here. If this test fails to link, it means you
        # need to add stuff to the webrtc static lib target above.
        ":webrtc",
      ]
    }
  }
}

if (use_libfuzzer || use_afl) {
  # This target is only here for gn to discover fuzzer build targets under
  # webrtc/test/fuzzers/.
  group("webrtc_fuzzers_dummy") {
    testonly = true
    deps = [ "test/fuzzers:webrtc_fuzzer_main" ]
  }
}

if (rtc_include_tests && !build_with_chromium) {
  rtc_test("rtc_unittests") {
    testonly = true

    deps = [
      "api:compile_all_headers",
      "api:rtc_api_unittests",
      "api/audio/test:audio_api_unittests",
      "api/audio_codecs/test:audio_codecs_api_unittests",
      "api/numerics:numerics_unittests",
      "api/task_queue:pending_task_safety_flag_unittests",
      "api/test/metrics:metrics_unittests",
      "api/transport:stun_unittest",
      "api/video/test:rtc_api_video_unittests",
      "api/video_codecs/test:video_codecs_api_unittests",
      "api/voip:compile_all_headers",
      "call:fake_network_pipe_unittests",
      "p2p:libstunprober_unittests",
      "p2p:rtc_p2p_unittests",
      "rtc_base:async_dns_resolver_unittests",
      "rtc_base:callback_list_unittests",
      "rtc_base:rtc_base_approved_unittests",
      "rtc_base:rtc_base_unittests",
      "rtc_base:rtc_json_unittests",
      "rtc_base:rtc_numerics_unittests",
      "rtc_base:rtc_operations_chain_unittests",
      "rtc_base:rtc_task_queue_unittests",
      "rtc_base:sigslot_unittest",
      "rtc_base:task_queue_stdlib_unittest",
      "rtc_base:untyped_function_unittest",
      "rtc_base:weak_ptr_unittests",
      "rtc_base/experiments:experiments_unittests",
      "rtc_base/system:file_wrapper_unittests",
      "rtc_base/task_utils:repeating_task_unittests",
      "rtc_base/units:units_unittests",
      "sdk:sdk_tests",
      "test:rtp_test_utils",
      "test:test_main",
      "test/network:network_emulation_unittests",
    ]

    if (rtc_enable_protobuf) {
      deps += [ "logging:rtc_event_log_tests" ]
    }

    if (is_android) {
      # Do not use Chromium's launcher. native_unittests defines its own JNI_OnLoad.
      use_default_launcher = false

      deps += [
        "sdk/android:native_unittests",
        "sdk/android:native_unittests_java",
        "//testing/android/native_test:native_test_support",
      ]
      shard_timeout = 900
    }
  }

  if (rtc_enable_google_benchmarks) {
    rtc_test("benchmarks") {
      testonly = true
      deps = [
        "rtc_base/synchronization:mutex_benchmark",
        "test:benchmark_main",
      ]
    }
  }

  # TODO(pbos): Rename test suite, this is no longer "just" for video targets.
  video_engine_tests_resources = [
    "resources/foreman_cif_short.yuv",
    "resources/voice_engine/audio_long16.pcm",
  ]

  if (is_ios) {
    bundle_data("video_engine_tests_bundle_data") {
      testonly = true
      sources = video_engine_tests_resources
      outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
    }
  }

  rtc_test("video_engine_tests") {
    testonly = true
    deps = [
      "audio:audio_tests",

      # TODO(eladalon): call_tests aren't actually video-specific, so we
      # should move them to a more appropriate test suite.
      "call:call_tests",
      "call/adaptation:resource_adaptation_tests",
      "test:test_common",
      "test:test_main",
      "test:video_test_common",
      "video:video_tests",
      "video/adaptation:video_adaptation_tests",
    ]
    data = video_engine_tests_resources
    if (is_android) {
      use_default_launcher = false
      deps += [
        "//build/android/gtest_apk:native_test_instrumentation_test_runner_java",
        "//testing/android/native_test:native_test_java",
        "//testing/android/native_test:native_test_support",
      ]
      shard_timeout = 900
    }
    if (is_ios) {
      deps += [ ":video_engine_tests_bundle_data" ]
    }
  }

  webrtc_perf_tests_resources = [
    "resources/ConferenceMotion_1280_720_50.yuv",
    "resources/audio_coding/speech_mono_16kHz.pcm",
    "resources/audio_coding/speech_mono_32_48kHz.pcm",
    "resources/audio_coding/testfile32kHz.pcm",
    "resources/difficult_photo_1850_1110.yuv",
    "resources/foreman_cif.yuv",
    "resources/paris_qcif.yuv",
    "resources/photo_1850_1110.yuv",
    "resources/presentation_1850_1110.yuv",
    "resources/voice_engine/audio_long16.pcm",
    "resources/web_screenshot_1850_1110.yuv",
  ]

  if (is_ios) {
    bundle_data("webrtc_perf_tests_bundle_data") {
      testonly = true
      sources = webrtc_perf_tests_resources
      outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
    }
  }

  rtc_test("webrtc_perf_tests") {
    testonly = true
    deps = [
      "call:call_perf_tests",
      "modules/audio_coding:audio_coding_perf_tests",
      "modules/audio_processing:audio_processing_perf_tests",
      "pc:peerconnection_perf_tests",
      "test:test_main",
      "video:video_full_stack_tests",
      "video:video_pc_full_stack_tests",
    ]

    data = webrtc_perf_tests_resources
    if (is_android) {
      use_default_launcher = false
      deps += [
        "//build/android/gtest_apk:native_test_instrumentation_test_runner_java",
        "//testing/android/native_test:native_test_java",
        "//testing/android/native_test:native_test_support",
      ]
      shard_timeout = 4500
    }
    if (is_ios) {
      deps += [ ":webrtc_perf_tests_bundle_data" ]
    }
  }

  rtc_test("webrtc_nonparallel_tests") {
    testonly = true
    deps = [ "rtc_base:rtc_base_nonparallel_tests" ]
    if (is_android) {
      deps += [ "//testing/android/native_test:native_test_support" ]
      shard_timeout = 900
    }
  }

  rtc_test("voip_unittests") {
    testonly = true
    deps = [
      "api/voip:compile_all_headers",
      "api/voip:voip_engine_factory_unittests",
      "audio/voip/test:audio_channel_unittests",
      "audio/voip/test:audio_egress_unittests",
      "audio/voip/test:audio_ingress_unittests",
      "audio/voip/test:voip_core_unittests",
      "test:test_main",
    ]
  }
}

# Build target for standalone dcsctp
rtc_static_library("dcsctp") {
  # Only the root target should depend on this.
  visibility = [ "//:default" ]
  sources = []
  complete_static_lib = true
  suppressed_configs += [ "//build/config/compiler:thin_archive" ]
  defines = []
  deps = [
    "net/dcsctp/public:factory",
    "net/dcsctp/public:socket",
    "net/dcsctp/public:types",
    "net/dcsctp/socket:dcsctp_socket",
    "net/dcsctp/timer:task_queue_timeout",
  ]
}

# ---- Poisons ----
#
# Here is one empty dummy target for each poison type (needed because
# "being poisonous with poison type foo" is implemented as "depends on
# //:poison_foo").
#
# The set of poison_* targets needs to be kept in sync with the
# `all_poison_types` list in webrtc.gni.
#
group("poison_audio_codecs") {
}

group("poison_default_task_queue") {
}

group("poison_default_echo_detector") {
}

group("poison_software_video_codecs") {
}
