Home | History | Annotate | Download | only in audio_device
      1 # Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
      2 #
      3 # Use of this source code is governed by a BSD-style license
      4 # that can be found in the LICENSE file in the root of the source
      5 # tree. An additional intellectual property rights grant can be found
      6 # in the file PATENTS.  All contributing project authors may
      7 # be found in the AUTHORS file in the root of the source tree.
      8 
      9 import("../../build/webrtc.gni")
     10 
     11 config("audio_device_config") {
     12   include_dirs = [
     13     "../include",
     14     "include",
     15     "dummy",  # Contains dummy audio device implementations.
     16   ]
     17 }
     18 
     19 source_set("audio_device") {
     20   sources = [
     21     "audio_device_buffer.cc",
     22     "audio_device_buffer.h",
     23     "audio_device_config.h",
     24     "audio_device_generic.cc",
     25     "audio_device_generic.h",
     26     "dummy/audio_device_dummy.cc",
     27     "dummy/audio_device_dummy.h",
     28     "dummy/file_audio_device.cc",
     29     "dummy/file_audio_device.h",
     30     "fine_audio_buffer.cc",
     31     "fine_audio_buffer.h",
     32     "include/audio_device.h",
     33     "include/audio_device_defines.h",
     34   ]
     35 
     36   include_dirs = []
     37   if (is_linux) {
     38     include_dirs += [ "linux" ]
     39   }
     40   if (is_ios) {
     41     include_dirs += [ "ios" ]
     42   }
     43   if (is_mac) {
     44     include_dirs += [ "mac" ]
     45   }
     46   if (is_win) {
     47     include_dirs += [ "win" ]
     48   }
     49   if (is_android) {
     50     include_dirs += [ "android" ]
     51   }
     52   defines = []
     53   cflags = []
     54   if (rtc_include_internal_audio_device) {
     55     defines += [ "WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE" ]
     56     sources += [
     57       "audio_device_impl.cc",
     58       "audio_device_impl.h",
     59     ]
     60     if (is_android) {
     61       sources += [
     62         "android/audio_device_template.h",
     63         "android/audio_manager.cc",
     64         "android/audio_manager.h",
     65         "android/audio_record_jni.cc",
     66         "android/audio_record_jni.h",
     67         "android/audio_track_jni.cc",
     68         "android/audio_track_jni.h",
     69         "android/build_info.cc",
     70         "android/build_info.h",
     71         "android/opensles_common.cc",
     72         "android/opensles_common.h",
     73         "android/opensles_player.cc",
     74         "android/opensles_player.h",
     75       ]
     76       libs = [
     77         "log",
     78         "OpenSLES",
     79       ]
     80     }
     81     if (is_linux) {
     82       sources += [
     83         "linux/alsasymboltable_linux.cc",
     84         "linux/alsasymboltable_linux.h",
     85         "linux/audio_device_alsa_linux.cc",
     86         "linux/audio_device_alsa_linux.h",
     87         "linux/audio_mixer_manager_alsa_linux.cc",
     88         "linux/audio_mixer_manager_alsa_linux.h",
     89         "linux/latebindingsymboltable_linux.cc",
     90         "linux/latebindingsymboltable_linux.h",
     91       ]
     92       defines += [ "LINUX_ALSA" ]
     93       libs = [
     94         "dl",
     95         "X11",
     96       ]
     97       if (rtc_include_pulse_audio) {
     98         sources += [
     99           "linux/audio_device_pulse_linux.cc",
    100           "linux/audio_device_pulse_linux.h",
    101           "linux/audio_mixer_manager_pulse_linux.cc",
    102           "linux/audio_mixer_manager_pulse_linux.h",
    103           "linux/pulseaudiosymboltable_linux.cc",
    104           "linux/pulseaudiosymboltable_linux.h",
    105         ]
    106         defines += [ "LINUX_PULSE" ]
    107       }
    108     }
    109     if (is_mac) {
    110       sources += [
    111         "mac/audio_device_mac.cc",
    112         "mac/audio_device_mac.h",
    113         "mac/audio_mixer_manager_mac.cc",
    114         "mac/audio_mixer_manager_mac.h",
    115         "mac/portaudio/pa_memorybarrier.h",
    116         "mac/portaudio/pa_ringbuffer.c",
    117         "mac/portaudio/pa_ringbuffer.h",
    118       ]
    119       libs = [
    120         "AudioToolbox.framework",
    121         "CoreAudio.framework",
    122       ]
    123     }
    124     if (is_ios) {
    125       sources += [
    126         "ios/audio_device_ios.h",
    127         "ios/audio_device_ios.mm",
    128         "ios/audio_device_not_implemented_ios.mm",
    129       ]
    130       cflags += [ "-fobjc-arc" ]  # CLANG_ENABLE_OBJC_ARC = YES.
    131       libs = [
    132         "AudioToolbox.framework",
    133         "AVFoundation.framework",
    134         "Foundation.framework",
    135         "UIKit.framework",
    136       ]
    137     }
    138     if (is_win) {
    139       sources += [
    140         "win/audio_device_core_win.cc",
    141         "win/audio_device_core_win.h",
    142         "win/audio_device_wave_win.cc",
    143         "win/audio_device_wave_win.h",
    144         "win/audio_mixer_manager_win.cc",
    145         "win/audio_mixer_manager_win.h",
    146       ]
    147       libs = [
    148         # Required for the built-in WASAPI AEC.
    149         "dmoguids.lib",
    150         "wmcodecdspuuid.lib",
    151         "amstrmid.lib",
    152         "msdmo.lib",
    153       ]
    154     }
    155   } else {
    156     defines = [ "WEBRTC_DUMMY_AUDIO_BUILD" ]
    157   }
    158 
    159   if (!build_with_chromium) {
    160     sources += [
    161       # Do not link these into Chrome since they contain static data.
    162       "dummy/file_audio_device_factory.cc",
    163       "dummy/file_audio_device_factory.h",
    164     ]
    165   }
    166 
    167   configs += [ "../..:common_config" ]
    168   public_configs = [
    169     "../..:common_inherited_config",
    170     ":audio_device_config",
    171   ]
    172 
    173   if (is_clang) {
    174     # Suppress warnings from Chrome's Clang plugins.
    175     # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
    176     configs -= [ "//build/config/clang:find_bad_constructs" ]
    177   }
    178 
    179   deps = [
    180     "../..:webrtc_common",
    181     "../../base:rtc_base_approved",
    182     "../../common_audio",
    183     "../../system_wrappers",
    184     "../utility",
    185   ]
    186 }
    187