# 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")
}

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_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_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 && optimize_for_fuzzing) {
    # 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_rtc_json") {
}

group("poison_software_video_codecs") {
}
