From bf5d2ba8fbb4790eba18b0e2b73e0aa9b218a7d7 Mon Sep 17 00:00:00 2001 From: "xians@google.com" Date: Tue, 16 Aug 2011 07:44:19 +0000 Subject: [PATCH] This CL will exclude the built-in ADM when building with chromium. When building with chromium, we use dummy ADM for all the platforms. Review URL: http://webrtc-codereview.appspot.com/108001 git-svn-id: http://webrtc.googlecode.com/svn/trunk@373 4adac7df-926f-26a2-2b94-8c16560cd09d --- src/build/common.gypi | 4 +- .../audio_device/main/source/audio_device.gyp | 147 ++++++++++-------- .../main/source/audio_device_impl.cc | 18 ++- 3 files changed, 98 insertions(+), 71 deletions(-) diff --git a/src/build/common.gypi b/src/build/common.gypi index 7899f3675..a2ac7de16 100644 --- a/src/build/common.gypi +++ b/src/build/common.gypi @@ -39,9 +39,11 @@ # Exclude pulse audio on Chromium since its prerequisites don't # include pulse audio. 'include_pulse_audio%': 0, + # Exclude internal ADM since chrome uses its own IO handling. + 'include_internal_audio_device%': 0, }, { 'include_pulse_audio%': 1, - + 'include_internal_audio_device%': 1, # The Chromium common.gypi we use treats all gyp files without # chromium_code==1 as third party code. This disables many of the # preferred warning settings. diff --git a/src/modules/audio_device/main/source/audio_device.gyp b/src/modules/audio_device/main/source/audio_device.gyp index a5b0f8c4c..a80f1515d 100644 --- a/src/modules/audio_device/main/source/audio_device.gyp +++ b/src/modules/audio_device/main/source/audio_device.gyp @@ -49,87 +49,102 @@ 'dummy/audio_device_dummy.h', 'dummy/audio_device_utility_dummy.cc', 'dummy/audio_device_utility_dummy.h', - 'linux/alsasymboltable_linux.cc', - 'linux/alsasymboltable_linux.h', - 'linux/audio_device_alsa_linux.cc', - 'linux/audio_device_alsa_linux.h', - 'linux/audio_device_utility_linux.cc', - 'linux/audio_device_utility_linux.h', - 'linux/audio_mixer_manager_alsa_linux.cc', - 'linux/audio_mixer_manager_alsa_linux.h', - 'linux/latebindingsymboltable_linux.cc', - 'linux/latebindingsymboltable_linux.h', - 'mac/audio_device_mac.cc', - 'mac/audio_device_mac.h', - 'mac/audio_device_utility_mac.cc', - 'mac/audio_device_utility_mac.h', - 'mac/audio_mixer_manager_mac.cc', - 'mac/audio_mixer_manager_mac.h', - 'mac/portaudio/pa_memorybarrier.h', - 'mac/portaudio/pa_ringbuffer.c', - 'mac/portaudio/pa_ringbuffer.h', - 'win/audio_device_utility_win.cc', - 'win/audio_device_utility_win.h', - 'win/audio_device_core_win.cc', - 'win/audio_device_core_win.h', - 'win/audio_device_wave_win.cc', - 'win/audio_device_wave_win.h', - 'win/audio_mixer_manager_win.cc', - 'win/audio_mixer_manager_win.h', ], 'conditions': [ ['OS=="linux"', { - 'defines': [ - 'LINUX_ALSA', - ], 'include_dirs': [ 'linux', ], - 'link_settings': { - 'libraries': [ - '-ldl', - '-lasound', + }], # OS==linux + ['OS=="mac"', { + 'include_dirs': [ + 'mac', ], - }, + }], # OS==mac + ['OS=="win"', { + 'include_dirs': [ + 'win', + '../../../../../..', + ], + }], + ['include_internal_audio_device==0', { + 'defines': [ + 'WEBRTC_DUMMY_AUDIO_BUILD', + ], + }], + ['include_internal_audio_device==1', { + 'sources': [ + 'linux/alsasymboltable_linux.cc', + 'linux/alsasymboltable_linux.h', + 'linux/audio_device_alsa_linux.cc', + 'linux/audio_device_alsa_linux.h', + 'linux/audio_device_utility_linux.cc', + 'linux/audio_device_utility_linux.h', + 'linux/audio_mixer_manager_alsa_linux.cc', + 'linux/audio_mixer_manager_alsa_linux.h', + 'linux/latebindingsymboltable_linux.cc', + 'linux/latebindingsymboltable_linux.h', + 'mac/audio_device_mac.cc', + 'mac/audio_device_mac.h', + 'mac/audio_device_utility_mac.cc', + 'mac/audio_device_utility_mac.h', + 'mac/audio_mixer_manager_mac.cc', + 'mac/audio_mixer_manager_mac.h', + 'mac/portaudio/pa_memorybarrier.h', + 'mac/portaudio/pa_ringbuffer.c', + 'mac/portaudio/pa_ringbuffer.h', + 'win/audio_device_core_win.cc', + 'win/audio_device_core_win.h', + 'win/audio_device_wave_win.cc', + 'win/audio_device_wave_win.h', + 'win/audio_device_utility_win.cc', + 'win/audio_device_utility_win.h', + 'win/audio_mixer_manager_win.cc', + 'win/audio_mixer_manager_win.h', + ], 'conditions': [ - ['include_pulse_audio==1', { + ['OS=="linux"', { 'defines': [ - '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', + 'LINUX_ALSA', ], 'link_settings': { 'libraries': [ - '-lpulse', + '-ldl', + '-lasound', + ], + }, + 'conditions': [ + ['include_pulse_audio==1', { + 'defines': [ + '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', + ], + 'link_settings': { + 'libraries': [ + '-lpulse', + ], + }, + }], + ], + }], + ['OS=="mac"', { + 'link_settings': { + 'libraries': [ + '$(SDKROOT)/System/Library/Frameworks/AudioToolbox.framework', + '$(SDKROOT)/System/Library/Frameworks/CoreAudio.framework', ], }, }], - ], - }], - ['OS=="mac"', { - 'include_dirs': [ - 'mac', - ], - 'link_settings': { - 'libraries': [ - '$(SDKROOT)/System/Library/Frameworks/AudioToolbox.framework', - '$(SDKROOT)/System/Library/Frameworks/CoreAudio.framework', - ], - }, - }], - ['OS=="win"', { - 'include_dirs': [ - 'win', - '../../../../../..', - ], - }], - ] # conditions + ], # conditions + }], # include_internal_audio_device==1 + ], # conditions }, ], # Exclude the test targets when building with chromium. diff --git a/src/modules/audio_device/main/source/audio_device_impl.cc b/src/modules/audio_device/main/source/audio_device_impl.cc index 932f0c28f..f4d865c87 100644 --- a/src/modules/audio_device/main/source/audio_device_impl.cc +++ b/src/modules/audio_device/main/source/audio_device_impl.cc @@ -11,8 +11,8 @@ #include "audio_device_impl.h" #include "audio_device_config.h" -#include "critical_section_wrapper.h" -#include "trace.h" +#include +#include #if defined(_WIN32) #include "audio_device_utility_win.h" @@ -45,8 +45,8 @@ #endif #include "audio_device_dummy.h" #include "audio_device_utility_dummy.h" - -#include +#include "critical_section_wrapper.h" +#include "trace.h" #define CHECK_INITIALIZED() \ { \ @@ -232,6 +232,15 @@ WebRtc_Word32 AudioDeviceModuleImpl::CreatePlatformSpecificObjects() AudioDeviceGeneric* ptrAudioDevice(NULL); AudioDeviceUtility* ptrAudioDeviceUtility(NULL); +#if defined(WEBRTC_DUMMY_AUDIO_BUILD) + ptrAudioDevice = new AudioDeviceDummy(Id()); + WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "Dummy Audio APIs will be utilized"); + + if (ptrAudioDevice != NULL) + { + ptrAudioDeviceUtility = new AudioDeviceUtilityDummy(Id()); + } +#else const AudioLayer audioLayer(PlatformAudioLayer()); // Create the *Windows* implementation of the Audio Device @@ -418,6 +427,7 @@ WebRtc_Word32 AudioDeviceModuleImpl::CreatePlatformSpecificObjects() ptrAudioDeviceUtility = new AudioDeviceUtilityDummy(Id()); } } +#endif // if defined(WEBRTC_DUMMY_AUDIO_BUILD) if (ptrAudioDevice == NULL) {