diff --git a/webrtc/build/common.gypi b/webrtc/build/common.gypi index 863d63b8ad..26b0de367a 100644 --- a/webrtc/build/common.gypi +++ b/webrtc/build/common.gypi @@ -129,7 +129,6 @@ # Exclude internal ADM since Chromium uses its own IO handling. 'include_internal_audio_device%': 0, - }, { # Settings for the standalone (not-in-Chromium) build. # TODO(andrew): For now, disable the Chrome plugins, which causes a # flood of chromium-style warnings. Investigate enabling them: @@ -370,6 +369,11 @@ }], ], }], + ['include_internal_audio_device==1', { + 'defines': [ + 'WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE', + ], + }], ], # conditions 'direct_dependent_settings': { 'conditions': [ diff --git a/webrtc/modules/audio_device/BUILD.gn b/webrtc/modules/audio_device/BUILD.gn index d485af5605..f23905fc27 100644 --- a/webrtc/modules/audio_device/BUILD.gn +++ b/webrtc/modules/audio_device/BUILD.gn @@ -24,8 +24,6 @@ source_set("audio_device") { "audio_device_buffer.h", "audio_device_generic.cc", "audio_device_generic.h", - "audio_device_impl.cc", - "audio_device_impl.h", "audio_device_config.h", "dummy/audio_device_dummy.cc", "dummy/audio_device_dummy.h", @@ -50,6 +48,7 @@ source_set("audio_device") { include_dirs += [ "android" ] } if (rtc_include_internal_audio_device) { + defines += [ "WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE" ] sources += [ "android/audio_device_template.h", "android/audio_manager.cc", @@ -64,6 +63,8 @@ source_set("audio_device") { "android/opensles_common.h", "android/opensles_player.cc", "android/opensles_player.h", + "audio_device_impl.cc", + "audio_device_impl.h", "ios/audio_device_ios.h", "ios/audio_device_ios.mm", "linux/alsasymboltable_linux.cc", diff --git a/webrtc/modules/audio_device/audio_device.gypi b/webrtc/modules/audio_device/audio_device.gypi index 9add647505..9c9380eb69 100644 --- a/webrtc/modules/audio_device/audio_device.gypi +++ b/webrtc/modules/audio_device/audio_device.gypi @@ -38,8 +38,6 @@ 'audio_device_buffer.h', 'audio_device_generic.cc', 'audio_device_generic.h', - 'audio_device_impl.cc', - 'audio_device_impl.h', 'audio_device_config.h', 'dummy/audio_device_dummy.cc', 'dummy/audio_device_dummy.h', @@ -101,6 +99,8 @@ 'android/opensles_common.h', 'android/opensles_player.cc', 'android/opensles_player.h', + 'audio_device_impl.cc', + 'audio_device_impl.h', 'ios/audio_device_ios.h', 'ios/audio_device_ios.mm', 'linux/alsasymboltable_linux.cc', diff --git a/webrtc/modules/audio_device/audio_device_impl.h b/webrtc/modules/audio_device/audio_device_impl.h index f2f4996154..efc305ba23 100644 --- a/webrtc/modules/audio_device/audio_device_impl.h +++ b/webrtc/modules/audio_device/audio_device_impl.h @@ -11,6 +11,8 @@ #ifndef WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_IMPL_H #define WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_IMPL_H +#if defined(WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE) + #include "webrtc/base/checks.h" #include "webrtc/base/scoped_ptr.h" #include "webrtc/modules/audio_device/audio_device_buffer.h" @@ -194,7 +196,7 @@ public: public: int32_t Id() {return _id;} -#if defined(WEBRTC_ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD) +#if defined(WEBRTC_ANDROID) // Only use this acccessor for test purposes on Android. AudioManager* GetAndroidAudioManagerForTest() { return _audioManagerAndroid.get(); @@ -218,7 +220,7 @@ private: AudioDeviceGeneric* _ptrAudioDevice; AudioDeviceBuffer _audioDeviceBuffer; -#if defined(WEBRTC_ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD) +#if defined(WEBRTC_ANDROID) rtc::scoped_ptr _audioManagerAndroid; #endif int32_t _id; @@ -231,4 +233,6 @@ private: } // namespace webrtc +#endif // defined(WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE) + #endif // WEBRTC_MODULES_INTERFACE_AUDIO_DEVICE_IMPL_H_ diff --git a/webrtc/voice_engine/voe_base_impl.cc b/webrtc/voice_engine/voe_base_impl.cc index 226b858593..e245fca110 100644 --- a/webrtc/voice_engine/voe_base_impl.cc +++ b/webrtc/voice_engine/voe_base_impl.cc @@ -218,6 +218,9 @@ int VoEBaseImpl::Init(AudioDeviceModule* external_adm, // Create an internal ADM if the user has not added an external // ADM implementation as input to Init(). if (external_adm == nullptr) { +#if !defined(WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE) + return -1; +#else // Create the internal ADM implementation. shared_->set_audio_device(AudioDeviceModuleImpl::Create( VoEId(shared_->instance_id(), -1), shared_->audio_device_layer())); @@ -227,6 +230,7 @@ int VoEBaseImpl::Init(AudioDeviceModule* external_adm, "Init() failed to create the ADM"); return -1; } +#endif // WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE } else { // Use the already existing external ADM implementation. shared_->set_audio_device(external_adm);