Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include "webrtc/base/checks.h" | 11 #include "webrtc/base/checks.h" |
| 12 #include "webrtc/base/logging.h" | 12 #include "webrtc/base/logging.h" |
| 13 #include "webrtc/base/checks.h" | 13 #include "webrtc/base/checks.h" |
| 14 #include "webrtc/base/refcount.h" | 14 #include "webrtc/base/refcount.h" |
| 15 #include "webrtc/base/timeutils.h" | 15 #include "webrtc/base/timeutils.h" |
| 16 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar y.h" | 16 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar y.h" |
| 17 #include "webrtc/modules/audio_device/audio_device_config.h" | 17 #include "webrtc/modules/audio_device/audio_device_config.h" |
| 18 #include "webrtc/modules/audio_device/audio_device_generic.h" | 18 #include "webrtc/modules/audio_device/audio_device_generic.h" |
| 19 #include "webrtc/modules/audio_device/audio_device_impl.h" | 19 #include "webrtc/modules/audio_device/audio_device_impl.h" |
| 20 #include "webrtc/system_wrappers/include/metrics.h" | 20 #include "webrtc/system_wrappers/include/metrics.h" |
| 21 | 21 |
| 22 #include <assert.h> | 22 #include <assert.h> |
| 23 #include <string.h> | 23 #include <string.h> |
| 24 | 24 |
| 25 #if defined(_WIN32) | 25 #if defined(_WIN32) |
| 26 #include "audio_device_wave_win.h" | |
| 27 #if defined(WEBRTC_WINDOWS_CORE_AUDIO_BUILD) | 26 #if defined(WEBRTC_WINDOWS_CORE_AUDIO_BUILD) |
| 28 #include "audio_device_core_win.h" | 27 #include "audio_device_core_win.h" |
| 29 #endif | 28 #endif |
| 30 #elif defined(WEBRTC_ANDROID) | 29 #elif defined(WEBRTC_ANDROID) |
| 31 #include <stdlib.h> | 30 #include <stdlib.h> |
| 32 #include "webrtc/modules/audio_device/android/audio_device_template.h" | 31 #include "webrtc/modules/audio_device/android/audio_device_template.h" |
| 33 #include "webrtc/modules/audio_device/android/audio_manager.h" | 32 #include "webrtc/modules/audio_device/android/audio_manager.h" |
| 34 #include "webrtc/modules/audio_device/android/audio_record_jni.h" | 33 #include "webrtc/modules/audio_device/android/audio_record_jni.h" |
| 35 #include "webrtc/modules/audio_device/android/audio_track_jni.h" | 34 #include "webrtc/modules/audio_device/android/audio_track_jni.h" |
| 36 #include "webrtc/modules/audio_device/android/opensles_player.h" | 35 #include "webrtc/modules/audio_device/android/opensles_player.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 193 } else { | 192 } else { |
| 194 // Create a dummy device instead. | 193 // Create a dummy device instead. |
| 195 ptrAudioDevice = new AudioDeviceDummy(Id()); | 194 ptrAudioDevice = new AudioDeviceDummy(Id()); |
| 196 LOG(INFO) << "Dummy Audio APIs will be utilized"; | 195 LOG(INFO) << "Dummy Audio APIs will be utilized"; |
| 197 } | 196 } |
| 198 #else | 197 #else |
| 199 AudioLayer audioLayer(PlatformAudioLayer()); | 198 AudioLayer audioLayer(PlatformAudioLayer()); |
| 200 | 199 |
| 201 // Create the *Windows* implementation of the Audio Device | 200 // Create the *Windows* implementation of the Audio Device |
| 202 // | 201 // |
| 203 #if defined(_WIN32) | 202 #if defined(_WIN32) |
|
the sun
2017/02/17 18:41:55
Can we remove the _WIN32 conditional?
tommi
2017/02/17 21:44:22
Done.
| |
| 204 if ((audioLayer == kWindowsWaveAudio) | |
| 205 #if !defined(WEBRTC_WINDOWS_CORE_AUDIO_BUILD) | |
| 206 // Wave audio is default if Core audio is not supported in this build | |
| 207 || (audioLayer == kPlatformDefaultAudio) | |
| 208 #endif | |
| 209 ) { | |
| 210 // create *Windows Wave Audio* implementation | |
| 211 ptrAudioDevice = new AudioDeviceWindowsWave(Id()); | |
| 212 LOG(INFO) << "Windows Wave APIs will be utilized"; | |
| 213 } | |
| 214 #if defined(WEBRTC_WINDOWS_CORE_AUDIO_BUILD) | 203 #if defined(WEBRTC_WINDOWS_CORE_AUDIO_BUILD) |
| 215 if ((audioLayer == kWindowsCoreAudio) || | 204 if ((audioLayer == kWindowsCoreAudio) || |
| 216 (audioLayer == kPlatformDefaultAudio)) { | 205 (audioLayer == kPlatformDefaultAudio)) { |
| 217 LOG(INFO) << "attempting to use the Windows Core Audio APIs..."; | 206 LOG(INFO) << "attempting to use the Windows Core Audio APIs..."; |
| 218 | 207 |
| 219 if (AudioDeviceWindowsCore::CoreAudioIsSupported()) { | 208 if (AudioDeviceWindowsCore::CoreAudioIsSupported()) { |
| 220 // create *Windows Core Audio* implementation | 209 // create *Windows Core Audio* implementation |
| 221 ptrAudioDevice = new AudioDeviceWindowsCore(Id()); | 210 ptrAudioDevice = new AudioDeviceWindowsCore(Id()); |
| 222 LOG(INFO) << "Windows Core Audio APIs will be utilized"; | 211 LOG(INFO) << "Windows Core Audio APIs will be utilized"; |
| 223 } else { | |
| 224 // create *Windows Wave Audio* implementation | |
| 225 ptrAudioDevice = new AudioDeviceWindowsWave(Id()); | |
| 226 if (ptrAudioDevice != NULL) { | |
| 227 // Core Audio was not supported => revert to Windows Wave instead | |
| 228 _platformAudioLayer = | |
| 229 kWindowsWaveAudio; // modify the state set at construction | |
| 230 LOG(WARNING) << "Windows Core Audio is *not* supported => Wave APIs " | |
| 231 "will be utilized instead"; | |
| 232 } | |
| 233 } | 212 } |
| 234 } | 213 } |
| 235 #endif // defined(WEBRTC_WINDOWS_CORE_AUDIO_BUILD) | 214 #endif // defined(WEBRTC_WINDOWS_CORE_AUDIO_BUILD) |
| 236 #endif // #if defined(_WIN32) | 215 #endif // #if defined(_WIN32) |
| 237 | 216 |
| 238 #if defined(WEBRTC_ANDROID) | 217 #if defined(WEBRTC_ANDROID) |
| 239 // Create an Android audio manager. | 218 // Create an Android audio manager. |
| 240 _audioManagerAndroid.reset(new AudioManager()); | 219 _audioManagerAndroid.reset(new AudioManager()); |
| 241 // Select best possible combination of audio layers. | 220 // Select best possible combination of audio layers. |
| 242 if (audioLayer == kPlatformDefaultAudio) { | 221 if (audioLayer == kPlatformDefaultAudio) { |
| (...skipping 1628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1871 // PlatformAudioLayer | 1850 // PlatformAudioLayer |
| 1872 // ---------------------------------------------------------------------------- | 1851 // ---------------------------------------------------------------------------- |
| 1873 | 1852 |
| 1874 AudioDeviceModule::AudioLayer AudioDeviceModuleImpl::PlatformAudioLayer() | 1853 AudioDeviceModule::AudioLayer AudioDeviceModuleImpl::PlatformAudioLayer() |
| 1875 const { | 1854 const { |
| 1876 LOG(INFO) << __FUNCTION__; | 1855 LOG(INFO) << __FUNCTION__; |
| 1877 return _platformAudioLayer; | 1856 return _platformAudioLayer; |
| 1878 } | 1857 } |
| 1879 | 1858 |
| 1880 } // namespace webrtc | 1859 } // namespace webrtc |
| OLD | NEW |