# 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.

import("../../webrtc.gni")

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

config("audio_device_warnings_config") {
  if (is_win && is_clang) {
    cflags = [
      # Disable warnings failing when compiling with Clang on Windows.
      # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366
      "-Wno-microsoft-goto",
    ]
  }
}

rtc_source_set("audio_device_default") {
  visibility = [ "*" ]
  sources = [ "include/audio_device_default.h" ]
  deps = [ ":audio_device_api" ]
}

rtc_source_set("audio_device") {
  visibility = [ "*" ]
  public_deps = [
    ":audio_device_api",

    # Deprecated.
    # TODO(webrtc:7452): Remove this public dep. audio_device_impl should
    # be depended on directly if needed.
    ":audio_device_impl",
  ]
}

rtc_source_set("audio_device_api") {
  visibility = [ "*" ]
  sources = [
    "include/audio_device.h",
    "include/audio_device_defines.h",
  ]
  deps = [
    "../../api:scoped_refptr",
    "../../api/task_queue",
    "../../rtc_base:checks",
    "../../rtc_base:refcount",
    "../../rtc_base:stringutils",
  ]
  absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
}

rtc_library("audio_device_config") {
  sources = [ "audio_device_config.h" ]
}

rtc_library("audio_device_buffer") {
  sources = [
    "audio_device_buffer.cc",
    "audio_device_buffer.h",
    "fine_audio_buffer.cc",
    "fine_audio_buffer.h",
  ]
  deps = [
    ":audio_device_api",
    "../../api:array_view",
    "../../api:sequence_checker",
    "../../api/task_queue",
    "../../common_audio:common_audio_c",
    "../../rtc_base:buffer",
    "../../rtc_base:checks",
    "../../rtc_base:event_tracer",
    "../../rtc_base:logging",
    "../../rtc_base:macromagic",
    "../../rtc_base:rtc_task_queue",
    "../../rtc_base:safe_conversions",
    "../../rtc_base:timestamp_aligner",
    "../../rtc_base:timeutils",
    "../../rtc_base/synchronization:mutex",
    "../../system_wrappers",
    "../../system_wrappers:metrics",
  ]
}

rtc_library("audio_device_generic") {
  sources = [
    "audio_device_generic.cc",
    "audio_device_generic.h",
  ]
  deps = [
    ":audio_device_api",
    ":audio_device_buffer",
    "../../rtc_base:logging",
  ]
}

rtc_library("audio_device_name") {
  sources = [
    "audio_device_name.cc",
    "audio_device_name.h",
  ]
  absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
}

rtc_source_set("windows_core_audio_utility") {
  if (is_win && !build_with_chromium) {
    sources = [
      "win/core_audio_utility_win.cc",
      "win/core_audio_utility_win.h",
    ]

    deps = [
      ":audio_device_api",
      ":audio_device_name",
      "../../api/units:time_delta",
      "../../rtc_base:checks",
      "../../rtc_base:logging",
      "../../rtc_base:macromagic",
      "../../rtc_base:platform_thread_types",
      "../../rtc_base:stringutils",
      "../../rtc_base/win:windows_version",
    ]
    absl_deps = [ "//third_party/abseil-cpp/absl/strings:strings" ]

    libs = [ "oleaut32.lib" ]
  }
}

# An ADM with a dedicated factory method which does not depend on the
# audio_device_impl target. The goal is to use this new structure and
# gradually phase out the old design.
# TODO(henrika): currently only supported on Windows.
rtc_source_set("audio_device_module_from_input_and_output") {
  visibility = [ "*" ]
  if (is_win && !build_with_chromium) {
    sources = [
      "include/audio_device_factory.cc",
      "include/audio_device_factory.h",
    ]
    sources += [
      "win/audio_device_module_win.cc",
      "win/audio_device_module_win.h",
      "win/core_audio_base_win.cc",
      "win/core_audio_base_win.h",
      "win/core_audio_input_win.cc",
      "win/core_audio_input_win.h",
      "win/core_audio_output_win.cc",
      "win/core_audio_output_win.h",
    ]

    deps = [
      ":audio_device_api",
      ":audio_device_buffer",
      ":windows_core_audio_utility",
      "../../api:make_ref_counted",
      "../../api:scoped_refptr",
      "../../api:sequence_checker",
      "../../api/task_queue",
      "../../rtc_base:checks",
      "../../rtc_base:logging",
      "../../rtc_base:macromagic",
      "../../rtc_base:platform_thread",
      "../../rtc_base:safe_conversions",
      "../../rtc_base:stringutils",
      "../../rtc_base:timeutils",
      "../../rtc_base/win:scoped_com_initializer",
      "../../rtc_base/win:windows_version",
    ]
    absl_deps = [
      "//third_party/abseil-cpp/absl/strings:strings",
      "//third_party/abseil-cpp/absl/types:optional",
    ]
  }
}

if (!build_with_chromium) {
  rtc_library("test_audio_device_module") {
    visibility = [ "*" ]
    sources = [
      "include/test_audio_device.cc",
      "include/test_audio_device.h",
    ]
    deps = [
      ":audio_device_api",
      ":audio_device_default",
      "../../api:array_view",
      "../../api:make_ref_counted",
      "../../api:scoped_refptr",
      "../../api/task_queue",
      "../../common_audio",
      "../../rtc_base:buffer",
      "../../rtc_base:checks",
      "../../rtc_base:logging",
      "../../rtc_base:macromagic",
      "../../rtc_base:platform_thread",
      "../../rtc_base:random",
      "../../rtc_base:rtc_event",
      "../../rtc_base:rtc_task_queue",
      "../../rtc_base:safe_conversions",
      "../../rtc_base:timeutils",
      "../../rtc_base/synchronization:mutex",
      "../../rtc_base/task_utils:repeating_task",
    ]
    absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
  }
}

rtc_library("audio_device_dummy") {
  visibility = [ "*" ]
  sources = [
    "dummy/audio_device_dummy.cc",
    "dummy/audio_device_dummy.h",
  ]
  deps = [
    ":audio_device_api",
    ":audio_device_buffer",
    ":audio_device_generic",
  ]
}

if (!build_with_chromium) {
  rtc_library("file_audio_device") {
    visibility = [ "*" ]
    sources = [
      "dummy/file_audio_device.cc",
      "dummy/file_audio_device.h",
      "dummy/file_audio_device_factory.cc",
      "dummy/file_audio_device_factory.h",
    ]
    defines = []
    if (rtc_use_dummy_audio_file_devices) {
      defines += [ "WEBRTC_DUMMY_FILE_DEVICES" ]
    }
    deps = [
      ":audio_device_generic",
      "../../rtc_base:checks",
      "../../rtc_base:logging",
      "../../rtc_base:platform_thread",
      "../../rtc_base:stringutils",
      "../../rtc_base:timeutils",
      "../../rtc_base/synchronization:mutex",
      "../../rtc_base/system:file_wrapper",
      "../../system_wrappers",
    ]
    absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
  }
}

# Contains default implementations of webrtc::AudioDeviceModule for Windows,
# Linux, Mac, iOS and Android.
rtc_library("audio_device_impl") {
  visibility = [ "*" ]
  deps = [
    ":audio_device_api",
    ":audio_device_buffer",
    ":audio_device_config",
    ":audio_device_default",
    ":audio_device_dummy",
    ":audio_device_generic",
    "../../api:array_view",
    "../../api:make_ref_counted",
    "../../api:refcountedbase",
    "../../api:scoped_refptr",
    "../../api:sequence_checker",
    "../../api/task_queue",
    "../../common_audio",
    "../../common_audio:common_audio_c",
    "../../rtc_base:buffer",
    "../../rtc_base:checks",
    "../../rtc_base:logging",
    "../../rtc_base:macromagic",
    "../../rtc_base:platform_thread",
    "../../rtc_base:random",
    "../../rtc_base:rtc_event",
    "../../rtc_base:rtc_task_queue",
    "../../rtc_base:safe_conversions",
    "../../rtc_base:stringutils",
    "../../rtc_base:timeutils",
    "../../rtc_base/synchronization:mutex",
    "../../rtc_base/system:arch",
    "../../rtc_base/system:file_wrapper",
    "../../rtc_base/task_utils:repeating_task",
    "../../system_wrappers",
    "../../system_wrappers:field_trial",
    "../../system_wrappers:metrics",
    "../utility",
  ]
  absl_deps = [
    "//third_party/abseil-cpp/absl/base:core_headers",
    "//third_party/abseil-cpp/absl/strings:strings",
  ]
  if (rtc_include_internal_audio_device && is_ios) {
    deps += [ "../../sdk:audio_device" ]
  }

  sources = [ "include/fake_audio_device.h" ]

  if (build_with_mozilla) {
    sources += [
      "opensl/single_rw_fifo.cc",
      "opensl/single_rw_fifo.h",
    ]
  }

  defines = []
  cflags = []
  if (rtc_audio_device_plays_sinus_tone) {
    defines += [ "AUDIO_DEVICE_PLAYS_SINUS_TONE" ]
  }
  if (rtc_enable_android_aaudio) {
    defines += [ "WEBRTC_AUDIO_DEVICE_INCLUDE_ANDROID_AAUDIO" ]
  }
  if (rtc_include_internal_audio_device) {
    sources += [
      "audio_device_data_observer.cc",
      "audio_device_impl.cc",
      "audio_device_impl.h",
      "include/audio_device_data_observer.h",
    ]
    if (is_android) {
      deps += [ "../../sdk/android:native_api_audio_device_module" ]

      if (build_with_mozilla) {
        include_dirs += [
          "/config/external/nspr",
          "/nsprpub/lib/ds",
          "/nsprpub/pr/include",
        ]
      }
    }
    if (rtc_use_dummy_audio_file_devices) {
      defines += [ "WEBRTC_DUMMY_FILE_DEVICES" ]
    } else {
      if (is_linux || is_chromeos) {
        sources += [
          "linux/alsasymboltable_linux.cc",
          "linux/alsasymboltable_linux.h",
          "linux/audio_device_alsa_linux.cc",
          "linux/audio_device_alsa_linux.h",
          "linux/audio_mixer_manager_alsa_linux.cc",
          "linux/audio_mixer_manager_alsa_linux.h",
          "linux/latebindingsymboltable_linux.cc",
          "linux/latebindingsymboltable_linux.h",
        ]
        defines += [ "WEBRTC_ENABLE_LINUX_ALSA" ]
        libs = [ "dl" ]
        if (rtc_use_x11) {
          libs += [ "X11" ]
          defines += [ "WEBRTC_USE_X11" ]
        }
        if (rtc_include_pulse_audio) {
          defines += [ "WEBRTC_ENABLE_LINUX_PULSE" ]
        }
        sources += [
          "linux/audio_device_pulse_linux.cc",
          "linux/audio_device_pulse_linux.h",
          "linux/audio_mixer_manager_pulse_linux.cc",
          "linux/audio_mixer_manager_pulse_linux.h",
          "linux/pulseaudiosymboltable_linux.cc",
          "linux/pulseaudiosymboltable_linux.h",
        ]
      }
      if (is_mac) {
        sources += [
          "mac/audio_device_mac.cc",
          "mac/audio_device_mac.h",
          "mac/audio_mixer_manager_mac.cc",
          "mac/audio_mixer_manager_mac.h",
        ]
        deps += [
          ":audio_device_impl_frameworks",
          "../third_party/portaudio:mac_portaudio",
        ]
      }
      if (is_win) {
        sources += [
          "win/audio_device_core_win.cc",
          "win/audio_device_core_win.h",
        ]
        libs = [
          # Required for the built-in WASAPI AEC.
          "dmoguids.lib",
          "wmcodecdspuuid.lib",
          "amstrmid.lib",
          "msdmo.lib",
          "oleaut32.lib",
        ]
        deps += [
          "../../rtc_base:win32",
          "../../rtc_base/win:scoped_com_initializer",
        ]
      }
      configs += [ ":audio_device_warnings_config" ]
    }
  } else {
    defines = [ "WEBRTC_DUMMY_AUDIO_BUILD" ]
  }

  if (!build_with_chromium) {
    deps += [ ":file_audio_device" ]

    # TODO(titovartem): remove after downstream is fixed
    sources += [ "dummy/file_audio_device_factory.h" ]
  }
}

if (is_mac) {
  rtc_source_set("audio_device_impl_frameworks") {
    visibility = [ ":*" ]
    frameworks = [
      # Needed for CoreGraphics:
      "ApplicationServices.framework",

      "AudioToolbox.framework",
      "CoreAudio.framework",

      # Needed for CGEventSourceKeyState in audio_device_mac.cc:
      "CoreGraphics.framework",
    ]
  }
}

rtc_source_set("mock_audio_device") {
  visibility = [ "*" ]
  testonly = true
  sources = [
    "include/mock_audio_device.h",
    "include/mock_audio_transport.h",
    "mock_audio_device_buffer.h",
  ]
  deps = [
    ":audio_device",
    ":audio_device_buffer",
    ":audio_device_impl",
    "../../api:make_ref_counted",
    "../../test:test_support",
  ]
}

if (rtc_include_tests && !build_with_chromium) {
  rtc_library("audio_device_unittests") {
    testonly = true

    sources = [
      "fine_audio_buffer_unittest.cc",
      "include/test_audio_device_unittest.cc",
    ]
    deps = [
      ":audio_device",
      ":audio_device_buffer",
      ":audio_device_impl",
      ":mock_audio_device",
      ":test_audio_device_module",
      "../../api:array_view",
      "../../api:scoped_refptr",
      "../../api:sequence_checker",
      "../../api/task_queue",
      "../../api/task_queue:default_task_queue_factory",
      "../../common_audio",
      "../../rtc_base:buffer",
      "../../rtc_base:checks",
      "../../rtc_base:ignore_wundef",
      "../../rtc_base:logging",
      "../../rtc_base:macromagic",
      "../../rtc_base:race_checker",
      "../../rtc_base:rtc_event",
      "../../rtc_base:safe_conversions",
      "../../rtc_base:timeutils",
      "../../rtc_base/synchronization:mutex",
      "../../system_wrappers",
      "../../test:fileutils",
      "../../test:test_support",
    ]
    absl_deps = [
      "//third_party/abseil-cpp/absl/strings",
      "//third_party/abseil-cpp/absl/types:optional",
    ]
    if (is_linux || is_chromeos || is_mac || is_win) {
      sources += [ "audio_device_unittest.cc" ]
    }
    if (is_win) {
      sources += [ "win/core_audio_utility_win_unittest.cc" ]
      deps += [
        ":audio_device_module_from_input_and_output",
        ":windows_core_audio_utility",
        "../../rtc_base/win:scoped_com_initializer",
        "../../rtc_base/win:windows_version",
      ]
    }
    if (is_android) {
      deps += [
        "../../sdk/android:internal_jni",
        "../../sdk/android:libjingle_peerconnection_java",
        "../../sdk/android:native_api_jni",
        "../../sdk/android:native_test_jni_onload",
        "../utility",
      ]
    }
    if (!rtc_include_internal_audio_device) {
      defines = [ "WEBRTC_DUMMY_AUDIO_BUILD" ]
    }
  }
}
