| # 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-delete-non-virtual-dtor", |
| "-Wno-microsoft-goto", |
| ] |
| } |
| } |
| |
| 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", |
| ] |
| } |
| |
| if (rtc_include_internal_audio_device && is_ios) { |
| rtc_source_set("audio_device_ios_objc") { |
| visibility = [ |
| ":audio_device_impl", |
| ":audio_device_ios_objc_unittests", |
| ] |
| sources = [ |
| "ios/audio_device_ios.h", |
| "ios/audio_device_ios.mm", |
| "ios/audio_device_not_implemented_ios.mm", |
| "ios/audio_session_observer.h", |
| "ios/objc/RTCAudioSession.h", |
| "ios/objc/RTCAudioSessionConfiguration.h", |
| "ios/objc/RTCAudioSessionDelegateAdapter.h", |
| "ios/objc/RTCAudioSessionDelegateAdapter.mm", |
| "ios/voice_processing_audio_unit.h", |
| "ios/voice_processing_audio_unit.mm", |
| ] |
| libs = [ |
| "AudioToolbox.framework", |
| "AVFoundation.framework", |
| "Foundation.framework", |
| "UIKit.framework", |
| ] |
| deps = [ |
| ":audio_device_api", |
| ":audio_device_buffer", |
| ":audio_device_generic", |
| "../../api:array_view", |
| "../../rtc_base:checks", |
| "../../rtc_base:gtest_prod", |
| "../../rtc_base:rtc_base", |
| "../../rtc_base/system:fallthrough", |
| "../../sdk:audio_objc", |
| "../../sdk:common_objc", |
| "../../system_wrappers:metrics_api", |
| ] |
| if (!build_with_chromium && is_clang) { |
| # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). |
| suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] |
| } |
| } |
| } |
| |
| rtc_source_set("audio_device_api") { |
| visibility = [ "*" ] |
| sources = [ |
| "include/audio_device.h", |
| "include/audio_device_defines.h", |
| ] |
| deps = [ |
| "../../rtc_base:checks", |
| "../../rtc_base:deprecation", |
| "../../rtc_base:rtc_base_approved", |
| "../../rtc_base:stringutils", |
| ] |
| if (!build_with_chromium && is_clang) { |
| # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). |
| suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] |
| } |
| } |
| |
| rtc_source_set("audio_device_buffer") { |
| sources = [ |
| "audio_device_buffer.cc", |
| "audio_device_buffer.h", |
| "audio_device_config.h", |
| "fine_audio_buffer.cc", |
| "fine_audio_buffer.h", |
| ] |
| deps = [ |
| ":audio_device_api", |
| "../../api:array_view", |
| "../../common_audio:common_audio_c", |
| "../../rtc_base:checks", |
| "../../rtc_base:rtc_base_approved", |
| "../../rtc_base:rtc_task_queue", |
| "../../system_wrappers", |
| "../../system_wrappers:metrics_api", |
| ] |
| if (!build_with_chromium && is_clang) { |
| # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). |
| suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] |
| } |
| } |
| |
| rtc_source_set("audio_device_generic") { |
| sources = [ |
| "audio_device_generic.cc", |
| "audio_device_generic.h", |
| ] |
| deps = [ |
| ":audio_device_api", |
| ":audio_device_buffer", |
| "../../rtc_base:rtc_base_approved", |
| ] |
| if (!build_with_chromium && is_clang) { |
| # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). |
| suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] |
| } |
| } |
| |
| rtc_source_set("audio_device_name") { |
| sources = [ |
| "audio_device_name.cc", |
| "audio_device_name.h", |
| ] |
| } |
| |
| 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:rtc_base_approved", |
| ] |
| } |
| } |
| |
| # 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", |
| "../../rtc_base:checks", |
| "../../rtc_base:rtc_base_approved", |
| "//third_party/abseil-cpp/absl/memory", |
| "//third_party/abseil-cpp/absl/types:optional", |
| ] |
| } |
| } |
| |
| # Contains default implementations of webrtc::AudioDeviceModule for Windows, |
| # Linux, Mac, iOS and Android. |
| rtc_source_set("audio_device_impl") { |
| visibility = [ "*" ] |
| deps = [ |
| ":audio_device_api", |
| ":audio_device_buffer", |
| ":audio_device_generic", |
| "../..:webrtc_common", |
| "../../api:array_view", |
| "../../common_audio", |
| "../../common_audio:common_audio_c", |
| "../../rtc_base:checks", |
| "../../rtc_base:deprecation", |
| "../../rtc_base:rtc_base_approved", |
| "../../rtc_base:rtc_task_queue", |
| "../../rtc_base/system:file_wrapper", |
| "../../system_wrappers", |
| "../../system_wrappers:metrics_api", |
| "../utility", |
| ] |
| if (rtc_include_internal_audio_device && is_ios) { |
| deps += [ ":audio_device_ios_objc" ] |
| } |
| |
| sources = [ |
| "dummy/audio_device_dummy.cc", |
| "dummy/audio_device_dummy.h", |
| "dummy/file_audio_device.cc", |
| "dummy/file_audio_device.h", |
| "include/fake_audio_device.h", |
| "include/test_audio_device.cc", |
| "include/test_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 += [ "AUDIO_DEVICE_INCLUDE_ANDROID_AAUDIO" ] |
| } |
| if (rtc_include_internal_audio_device) { |
| # TODO(bugs.webrtc.org/8850): remove this when the circular dependency will be fixed. |
| check_includes = false |
| sources += [ |
| "audio_device_data_observer.cc", |
| "audio_device_impl.cc", |
| "audio_device_impl.h", |
| "include/audio_device_data_observer.h", |
| ] |
| if (is_android) { |
| sources += [ |
| "android/audio_common.h", |
| "android/audio_device_template.h", |
| "android/audio_manager.cc", |
| "android/audio_manager.h", |
| "android/audio_record_jni.cc", |
| "android/audio_record_jni.h", |
| "android/audio_track_jni.cc", |
| "android/audio_track_jni.h", |
| "android/build_info.cc", |
| "android/build_info.h", |
| "android/opensles_common.cc", |
| "android/opensles_common.h", |
| "android/opensles_player.cc", |
| "android/opensles_player.h", |
| "android/opensles_recorder.cc", |
| "android/opensles_recorder.h", |
| ] |
| libs = [ |
| "log", |
| "OpenSLES", |
| ] |
| if (rtc_enable_android_aaudio) { |
| sources += [ |
| "android/aaudio_player.cc", |
| "android/aaudio_player.h", |
| "android/aaudio_recorder.cc", |
| "android/aaudio_recorder.h", |
| "android/aaudio_wrapper.cc", |
| "android/aaudio_wrapper.h", |
| ] |
| libs += [ "aaudio" ] |
| } |
| |
| 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) { |
| 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 += [ "LINUX_ALSA" ] |
| libs = [ "dl" ] |
| if (rtc_use_x11) { |
| libs += [ "X11" ] |
| defines += [ "WEBRTC_USE_X11" ] |
| } |
| if (rtc_include_pulse_audio) { |
| 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", |
| ] |
| defines += [ "LINUX_PULSE" ] |
| } |
| } |
| 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 += [ "../third_party/portaudio:mac_portaudio" ] |
| libs = [ |
| # Needed for CoreGraphics: |
| "ApplicationServices.framework", |
| |
| "AudioToolbox.framework", |
| "CoreAudio.framework", |
| |
| # Needed for CGEventSourceKeyState in audio_device_mac.cc: |
| "CoreGraphics.framework", |
| ] |
| } |
| 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", |
| ] |
| } |
| configs += [ ":audio_device_warnings_config" ] |
| } |
| } else { |
| defines = [ "WEBRTC_DUMMY_AUDIO_BUILD" ] |
| } |
| |
| if (!build_with_chromium) { |
| sources += [ |
| # Do not link these into Chrome since they contain static data. |
| "dummy/file_audio_device_factory.cc", |
| "dummy/file_audio_device_factory.h", |
| ] |
| } |
| |
| if (!build_with_chromium && is_clang) { |
| # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). |
| suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] |
| } |
| } |
| |
| rtc_source_set("mock_audio_device") { |
| 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", |
| "../../test:test_support", |
| ] |
| } |
| |
| if (rtc_include_tests) { |
| # TODO(kthelgason): Reenable these tests on simulator. |
| # See bugs.webrtc.org/7812 |
| if (is_ios && !use_ios_simulator) { |
| rtc_source_set("audio_device_ios_objc_unittests") { |
| testonly = true |
| visibility = [ ":*" ] |
| sources = [ |
| "ios/audio_device_unittest_ios.mm", |
| ] |
| deps = [ |
| ":audio_device", |
| ":audio_device_buffer", |
| ":audio_device_impl", |
| ":audio_device_ios_objc", |
| ":mock_audio_device", |
| "../../rtc_base:rtc_base_approved", |
| "../../sdk:audio_objc", |
| "../../system_wrappers", |
| "../../test:fileutils", |
| "../../test:test_support", |
| "//third_party/ocmock", |
| ] |
| if (!build_with_chromium && is_clang) { |
| # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). |
| suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] |
| } |
| } |
| } |
| |
| rtc_source_set("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", |
| "../../api:array_view", |
| "../../common_audio", |
| "../../rtc_base:checks", |
| "../../rtc_base:rtc_base_approved", |
| "../../system_wrappers", |
| "../../test:fileutils", |
| "../../test:test_support", |
| "../utility:utility", |
| "//third_party/abseil-cpp/absl/types:optional", |
| ] |
| if (is_linux || 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", |
| ] |
| } |
| if (is_android) { |
| # Need to disable error due to the line in |
| # base/android/jni_android.h triggering it: |
| # const BASE_EXPORT jobject GetApplicationContext() |
| # error: type qualifiers ignored on function return type |
| cflags = [ "-Wno-ignored-qualifiers" ] |
| sources += [ |
| "android/audio_device_unittest.cc", |
| "android/audio_manager_unittest.cc", |
| "android/ensure_initialized.cc", |
| "android/ensure_initialized.h", |
| ] |
| deps += [ |
| "../../base", |
| "../../sdk/android:libjingle_peerconnection_java", |
| ] |
| } |
| if (!build_with_chromium && is_clang) { |
| # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). |
| suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] |
| } |
| if (!rtc_include_internal_audio_device) { |
| defines = [ "WEBRTC_DUMMY_AUDIO_BUILD" ] |
| } |
| } |
| } |
| |
| if (!build_with_chromium && is_android) { |
| rtc_android_library("audio_device_java") { |
| java_files = [ |
| "android/java/src/org/webrtc/voiceengine/BuildInfo.java", |
| "android/java/src/org/webrtc/voiceengine/WebRtcAudioEffects.java", |
| "android/java/src/org/webrtc/voiceengine/WebRtcAudioManager.java", |
| "android/java/src/org/webrtc/voiceengine/WebRtcAudioRecord.java", |
| "android/java/src/org/webrtc/voiceengine/WebRtcAudioTrack.java", |
| "android/java/src/org/webrtc/voiceengine/WebRtcAudioUtils.java", |
| ] |
| deps = [ |
| "../../rtc_base:base_java", |
| ] |
| } |
| } |