| 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/logging.h" |
| 11 #include "webrtc/base/refcount.h" | 12 #include "webrtc/base/refcount.h" |
| 12 #include "webrtc/base/timeutils.h" | 13 #include "webrtc/base/timeutils.h" |
| 13 #include "webrtc/base/trace_event.h" | |
| 14 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar
y.h" | 14 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar
y.h" |
| 15 #include "webrtc/modules/audio_device/audio_device_config.h" | 15 #include "webrtc/modules/audio_device/audio_device_config.h" |
| 16 #include "webrtc/modules/audio_device/audio_device_impl.h" | 16 #include "webrtc/modules/audio_device/audio_device_impl.h" |
| 17 | 17 |
| 18 #include <assert.h> | 18 #include <assert.h> |
| 19 #include <string.h> | 19 #include <string.h> |
| 20 | 20 |
| 21 #if defined(_WIN32) | 21 #if defined(_WIN32) |
| 22 #include "audio_device_wave_win.h" | 22 #include "audio_device_wave_win.h" |
| 23 #if defined(WEBRTC_WINDOWS_CORE_AUDIO_BUILD) | 23 #if defined(WEBRTC_WINDOWS_CORE_AUDIO_BUILD) |
| (...skipping 19 matching lines...) Expand all Loading... |
| 43 #include "audio_device_mac.h" | 43 #include "audio_device_mac.h" |
| 44 #endif | 44 #endif |
| 45 | 45 |
| 46 #if defined(WEBRTC_DUMMY_FILE_DEVICES) | 46 #if defined(WEBRTC_DUMMY_FILE_DEVICES) |
| 47 #include "webrtc/modules/audio_device/dummy/file_audio_device_factory.h" | 47 #include "webrtc/modules/audio_device/dummy/file_audio_device_factory.h" |
| 48 #endif | 48 #endif |
| 49 | 49 |
| 50 #include "webrtc/modules/audio_device/dummy/audio_device_dummy.h" | 50 #include "webrtc/modules/audio_device/dummy/audio_device_dummy.h" |
| 51 #include "webrtc/modules/audio_device/dummy/file_audio_device.h" | 51 #include "webrtc/modules/audio_device/dummy/file_audio_device.h" |
| 52 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | 52 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
| 53 #include "webrtc/system_wrappers/include/trace.h" | |
| 54 | 53 |
| 55 #define CHECK_INITIALIZED() \ | 54 #define CHECK_INITIALIZED() \ |
| 56 { \ | 55 { \ |
| 57 if (!_initialized) { \ | 56 if (!_initialized) { \ |
| 58 return -1; \ | 57 return -1; \ |
| 59 }; \ | 58 }; \ |
| 60 } | 59 } |
| 61 | 60 |
| 62 #define CHECK_INITIALIZED_BOOL() \ | 61 #define CHECK_INITIALIZED_BOOL() \ |
| 63 { \ | 62 { \ |
| 64 if (!_initialized) { \ | 63 if (!_initialized) { \ |
| 65 return false; \ | 64 return false; \ |
| 66 }; \ | 65 }; \ |
| 67 } | 66 } |
| 68 | 67 |
| 69 namespace webrtc { | 68 namespace webrtc { |
| 70 | 69 |
| 71 // ============================================================================ | 70 // ============================================================================ |
| 72 // Static methods | 71 // Static methods |
| 73 // ============================================================================ | 72 // ============================================================================ |
| 74 | 73 |
| 75 // ---------------------------------------------------------------------------- | 74 // ---------------------------------------------------------------------------- |
| 76 // AudioDeviceModule::Create() | 75 // AudioDeviceModule::Create() |
| 77 // ---------------------------------------------------------------------------- | 76 // ---------------------------------------------------------------------------- |
| 78 | 77 |
| 79 rtc::scoped_refptr<AudioDeviceModule> AudioDeviceModule::Create( | 78 rtc::scoped_refptr<AudioDeviceModule> AudioDeviceModule::Create( |
| 80 const int32_t id, | 79 const int32_t id, |
| 81 const AudioLayer audio_layer) { | 80 const AudioLayer audio_layer) { |
| 81 LOG(INFO) << __FUNCTION__; |
| 82 // Create the generic ref counted (platform independent) implementation. | 82 // Create the generic ref counted (platform independent) implementation. |
| 83 rtc::scoped_refptr<AudioDeviceModuleImpl> audioDevice( | 83 rtc::scoped_refptr<AudioDeviceModuleImpl> audioDevice( |
| 84 new rtc::RefCountedObject<AudioDeviceModuleImpl>(id, audio_layer)); | 84 new rtc::RefCountedObject<AudioDeviceModuleImpl>(id, audio_layer)); |
| 85 | 85 |
| 86 // Ensure that the current platform is supported. | 86 // Ensure that the current platform is supported. |
| 87 if (audioDevice->CheckPlatform() == -1) { | 87 if (audioDevice->CheckPlatform() == -1) { |
| 88 return nullptr; | 88 return nullptr; |
| 89 } | 89 } |
| 90 | 90 |
| 91 // Create the platform-dependent implementation. | 91 // Create the platform-dependent implementation. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 118 _critSectEventCb(*CriticalSectionWrapper::CreateCriticalSection()), | 118 _critSectEventCb(*CriticalSectionWrapper::CreateCriticalSection()), |
| 119 _critSectAudioCb(*CriticalSectionWrapper::CreateCriticalSection()), | 119 _critSectAudioCb(*CriticalSectionWrapper::CreateCriticalSection()), |
| 120 _ptrCbAudioDeviceObserver(NULL), | 120 _ptrCbAudioDeviceObserver(NULL), |
| 121 _ptrAudioDevice(NULL), | 121 _ptrAudioDevice(NULL), |
| 122 _id(id), | 122 _id(id), |
| 123 _platformAudioLayer(audioLayer), | 123 _platformAudioLayer(audioLayer), |
| 124 _lastProcessTime(rtc::TimeMillis()), | 124 _lastProcessTime(rtc::TimeMillis()), |
| 125 _platformType(kPlatformNotSupported), | 125 _platformType(kPlatformNotSupported), |
| 126 _initialized(false), | 126 _initialized(false), |
| 127 _lastError(kAdmErrNone) { | 127 _lastError(kAdmErrNone) { |
| 128 WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, id, "%s created", __FUNCTION__); | 128 LOG(INFO) << __FUNCTION__; |
| 129 } | 129 } |
| 130 | 130 |
| 131 // ---------------------------------------------------------------------------- | 131 // ---------------------------------------------------------------------------- |
| 132 // CheckPlatform | 132 // CheckPlatform |
| 133 // ---------------------------------------------------------------------------- | 133 // ---------------------------------------------------------------------------- |
| 134 | 134 |
| 135 int32_t AudioDeviceModuleImpl::CheckPlatform() { | 135 int32_t AudioDeviceModuleImpl::CheckPlatform() { |
| 136 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "%s", __FUNCTION__); | 136 LOG(INFO) << __FUNCTION__; |
| 137 | 137 |
| 138 // Ensure that the current platform is supported | 138 // Ensure that the current platform is supported |
| 139 // | 139 // |
| 140 PlatformType platform(kPlatformNotSupported); | 140 PlatformType platform(kPlatformNotSupported); |
| 141 | 141 |
| 142 #if defined(_WIN32) | 142 #if defined(_WIN32) |
| 143 platform = kPlatformWin32; | 143 platform = kPlatformWin32; |
| 144 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "current platform is WIN32"); | 144 LOG(INFO) << "current platform is Win32"; |
| 145 #elif defined(WEBRTC_ANDROID) | 145 #elif defined(WEBRTC_ANDROID) |
| 146 platform = kPlatformAndroid; | 146 platform = kPlatformAndroid; |
| 147 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, | 147 LOG(INFO) << "current platform is Android"; |
| 148 "current platform is ANDROID"); | |
| 149 #elif defined(WEBRTC_LINUX) | 148 #elif defined(WEBRTC_LINUX) |
| 150 platform = kPlatformLinux; | 149 platform = kPlatformLinux; |
| 151 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "current platform is LINUX"); | 150 LOG(INFO) << "current platform is Linux"; |
| 152 #elif defined(WEBRTC_IOS) | 151 #elif defined(WEBRTC_IOS) |
| 153 platform = kPlatformIOS; | 152 platform = kPlatformIOS; |
| 154 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "current platform is IOS"); | 153 LOG(INFO) << "current platform is IOS"; |
| 155 #elif defined(WEBRTC_MAC) | 154 #elif defined(WEBRTC_MAC) |
| 156 platform = kPlatformMac; | 155 platform = kPlatformMac; |
| 157 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "current platform is MAC"); | 156 LOG(INFO) << "current platform is Mac"; |
| 158 #endif | 157 #endif |
| 159 | 158 |
| 160 if (platform == kPlatformNotSupported) { | 159 if (platform == kPlatformNotSupported) { |
| 161 WEBRTC_TRACE( | 160 LOG(LERROR) << "current platform is not supported => this module will self " |
| 162 kTraceCritical, kTraceAudioDevice, _id, | 161 "destruct!"; |
| 163 "current platform is not supported => this module will self destruct!"); | |
| 164 return -1; | 162 return -1; |
| 165 } | 163 } |
| 166 | 164 |
| 167 // Store valid output results | 165 // Store valid output results |
| 168 // | 166 // |
| 169 _platformType = platform; | 167 _platformType = platform; |
| 170 | 168 |
| 171 return 0; | 169 return 0; |
| 172 } | 170 } |
| 173 | 171 |
| 174 // ---------------------------------------------------------------------------- | 172 // ---------------------------------------------------------------------------- |
| 175 // CreatePlatformSpecificObjects | 173 // CreatePlatformSpecificObjects |
| 176 // ---------------------------------------------------------------------------- | 174 // ---------------------------------------------------------------------------- |
| 177 | 175 |
| 178 int32_t AudioDeviceModuleImpl::CreatePlatformSpecificObjects() { | 176 int32_t AudioDeviceModuleImpl::CreatePlatformSpecificObjects() { |
| 179 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "%s", __FUNCTION__); | 177 LOG(INFO) << __FUNCTION__; |
| 180 | 178 |
| 181 AudioDeviceGeneric* ptrAudioDevice(NULL); | 179 AudioDeviceGeneric* ptrAudioDevice(NULL); |
| 182 | 180 |
| 183 #if defined(WEBRTC_DUMMY_AUDIO_BUILD) | 181 #if defined(WEBRTC_DUMMY_AUDIO_BUILD) |
| 184 ptrAudioDevice = new AudioDeviceDummy(Id()); | 182 ptrAudioDevice = new AudioDeviceDummy(Id()); |
| 185 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, | 183 LOG(INFO) << "Dummy Audio APIs will be utilized"; |
| 186 "Dummy Audio APIs will be utilized"); | |
| 187 #elif defined(WEBRTC_DUMMY_FILE_DEVICES) | 184 #elif defined(WEBRTC_DUMMY_FILE_DEVICES) |
| 188 ptrAudioDevice = FileAudioDeviceFactory::CreateFileAudioDevice(Id()); | 185 ptrAudioDevice = FileAudioDeviceFactory::CreateFileAudioDevice(Id()); |
| 189 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, | 186 LOG(INFO) << "Will use file-playing dummy device."; |
| 190 "Will use file-playing dummy device."); | |
| 191 #else | 187 #else |
| 192 AudioLayer audioLayer(PlatformAudioLayer()); | 188 AudioLayer audioLayer(PlatformAudioLayer()); |
| 193 | 189 |
| 194 // Create the *Windows* implementation of the Audio Device | 190 // Create the *Windows* implementation of the Audio Device |
| 195 // | 191 // |
| 196 #if defined(_WIN32) | 192 #if defined(_WIN32) |
| 197 if ((audioLayer == kWindowsWaveAudio) | 193 if ((audioLayer == kWindowsWaveAudio) |
| 198 #if !defined(WEBRTC_WINDOWS_CORE_AUDIO_BUILD) | 194 #if !defined(WEBRTC_WINDOWS_CORE_AUDIO_BUILD) |
| 199 // Wave audio is default if Core audio is not supported in this build | 195 // Wave audio is default if Core audio is not supported in this build |
| 200 || (audioLayer == kPlatformDefaultAudio) | 196 || (audioLayer == kPlatformDefaultAudio) |
| 201 #endif | 197 #endif |
| 202 ) { | 198 ) { |
| 203 // create *Windows Wave Audio* implementation | 199 // create *Windows Wave Audio* implementation |
| 204 ptrAudioDevice = new AudioDeviceWindowsWave(Id()); | 200 ptrAudioDevice = new AudioDeviceWindowsWave(Id()); |
| 205 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, | 201 LOG(INFO) << "Windows Wave APIs will be utilized"; |
| 206 "Windows Wave APIs will be utilized"); | |
| 207 } | 202 } |
| 208 #if defined(WEBRTC_WINDOWS_CORE_AUDIO_BUILD) | 203 #if defined(WEBRTC_WINDOWS_CORE_AUDIO_BUILD) |
| 209 if ((audioLayer == kWindowsCoreAudio) || | 204 if ((audioLayer == kWindowsCoreAudio) || |
| 210 (audioLayer == kPlatformDefaultAudio)) { | 205 (audioLayer == kPlatformDefaultAudio)) { |
| 211 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, | 206 LOG(INFO) << "attempting to use the Windows Core Audio APIs..."; |
| 212 "attempting to use the Windows Core Audio APIs..."); | |
| 213 | 207 |
| 214 if (AudioDeviceWindowsCore::CoreAudioIsSupported()) { | 208 if (AudioDeviceWindowsCore::CoreAudioIsSupported()) { |
| 215 // create *Windows Core Audio* implementation | 209 // create *Windows Core Audio* implementation |
| 216 ptrAudioDevice = new AudioDeviceWindowsCore(Id()); | 210 ptrAudioDevice = new AudioDeviceWindowsCore(Id()); |
| 217 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, | 211 LOG(INFO) << "Windows Core Audio APIs will be utilized"; |
| 218 "Windows Core Audio APIs will be utilized"); | |
| 219 } else { | 212 } else { |
| 220 // create *Windows Wave Audio* implementation | 213 // create *Windows Wave Audio* implementation |
| 221 ptrAudioDevice = new AudioDeviceWindowsWave(Id()); | 214 ptrAudioDevice = new AudioDeviceWindowsWave(Id()); |
| 222 if (ptrAudioDevice != NULL) { | 215 if (ptrAudioDevice != NULL) { |
| 223 // Core Audio was not supported => revert to Windows Wave instead | 216 // Core Audio was not supported => revert to Windows Wave instead |
| 224 _platformAudioLayer = | 217 _platformAudioLayer = |
| 225 kWindowsWaveAudio; // modify the state set at construction | 218 kWindowsWaveAudio; // modify the state set at construction |
| 226 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, | 219 LOG(WARNING) << "Windows Core Audio is *not* supported => Wave APIs " |
| 227 "Windows Core Audio is *not* supported => Wave APIs will " | 220 "will be utilized instead"; |
| 228 "be utilized instead"); | |
| 229 } | 221 } |
| 230 } | 222 } |
| 231 } | 223 } |
| 232 #endif // defined(WEBRTC_WINDOWS_CORE_AUDIO_BUILD) | 224 #endif // defined(WEBRTC_WINDOWS_CORE_AUDIO_BUILD) |
| 233 #endif // #if defined(_WIN32) | 225 #endif // #if defined(_WIN32) |
| 234 | 226 |
| 235 #if defined(WEBRTC_ANDROID) | 227 #if defined(WEBRTC_ANDROID) |
| 236 // Create an Android audio manager. | 228 // Create an Android audio manager. |
| 237 _audioManagerAndroid.reset(new AudioManager()); | 229 _audioManagerAndroid.reset(new AudioManager()); |
| 238 // Select best possible combination of audio layers. | 230 // Select best possible combination of audio layers. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 263 ptrAudioDevice = NULL; | 255 ptrAudioDevice = NULL; |
| 264 } | 256 } |
| 265 // END #if defined(WEBRTC_ANDROID) | 257 // END #if defined(WEBRTC_ANDROID) |
| 266 | 258 |
| 267 // Create the *Linux* implementation of the Audio Device | 259 // Create the *Linux* implementation of the Audio Device |
| 268 // | 260 // |
| 269 #elif defined(WEBRTC_LINUX) | 261 #elif defined(WEBRTC_LINUX) |
| 270 if ((audioLayer == kLinuxPulseAudio) || | 262 if ((audioLayer == kLinuxPulseAudio) || |
| 271 (audioLayer == kPlatformDefaultAudio)) { | 263 (audioLayer == kPlatformDefaultAudio)) { |
| 272 #if defined(LINUX_PULSE) | 264 #if defined(LINUX_PULSE) |
| 273 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, | 265 LOG(INFO) << "attempting to use the Linux PulseAudio APIs..."; |
| 274 "attempting to use the Linux PulseAudio APIs..."); | |
| 275 | 266 |
| 276 // create *Linux PulseAudio* implementation | 267 // create *Linux PulseAudio* implementation |
| 277 AudioDeviceLinuxPulse* pulseDevice = new AudioDeviceLinuxPulse(Id()); | 268 AudioDeviceLinuxPulse* pulseDevice = new AudioDeviceLinuxPulse(Id()); |
| 278 if (pulseDevice->Init() != -1) { | 269 if (pulseDevice->Init() != -1) { |
| 279 ptrAudioDevice = pulseDevice; | 270 ptrAudioDevice = pulseDevice; |
| 280 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, | 271 LOG(INFO) << "Linux PulseAudio APIs will be utilized"; |
| 281 "Linux PulseAudio APIs will be utilized"); | |
| 282 } else { | 272 } else { |
| 283 delete pulseDevice; | 273 delete pulseDevice; |
| 284 #endif | 274 #endif |
| 285 #if defined(LINUX_ALSA) | 275 #if defined(LINUX_ALSA) |
| 286 // create *Linux ALSA Audio* implementation | 276 // create *Linux ALSA Audio* implementation |
| 287 ptrAudioDevice = new AudioDeviceLinuxALSA(Id()); | 277 ptrAudioDevice = new AudioDeviceLinuxALSA(Id()); |
| 288 if (ptrAudioDevice != NULL) { | 278 if (ptrAudioDevice != NULL) { |
| 289 // Pulse Audio was not supported => revert to ALSA instead | 279 // Pulse Audio was not supported => revert to ALSA instead |
| 290 _platformAudioLayer = | 280 _platformAudioLayer = |
| 291 kLinuxAlsaAudio; // modify the state set at construction | 281 kLinuxAlsaAudio; // modify the state set at construction |
| 292 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, | 282 LOG(WARNING) << "Linux PulseAudio is *not* supported => ALSA APIs will " |
| 293 "Linux PulseAudio is *not* supported => ALSA APIs will be " | 283 "be utilized instead"; |
| 294 "utilized instead"); | |
| 295 } | 284 } |
| 296 #endif | 285 #endif |
| 297 #if defined(LINUX_PULSE) | 286 #if defined(LINUX_PULSE) |
| 298 } | 287 } |
| 299 #endif | 288 #endif |
| 300 } else if (audioLayer == kLinuxAlsaAudio) { | 289 } else if (audioLayer == kLinuxAlsaAudio) { |
| 301 #if defined(LINUX_ALSA) | 290 #if defined(LINUX_ALSA) |
| 302 // create *Linux ALSA Audio* implementation | 291 // create *Linux ALSA Audio* implementation |
| 303 ptrAudioDevice = new AudioDeviceLinuxALSA(Id()); | 292 ptrAudioDevice = new AudioDeviceLinuxALSA(Id()); |
| 304 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, | 293 LOG(INFO) << "Linux ALSA APIs will be utilized"; |
| 305 "Linux ALSA APIs will be utilized"); | |
| 306 #endif | 294 #endif |
| 307 } | 295 } |
| 308 #endif // #if defined(WEBRTC_LINUX) | 296 #endif // #if defined(WEBRTC_LINUX) |
| 309 | 297 |
| 310 // Create the *iPhone* implementation of the Audio Device | 298 // Create the *iPhone* implementation of the Audio Device |
| 311 // | 299 // |
| 312 #if defined(WEBRTC_IOS) | 300 #if defined(WEBRTC_IOS) |
| 313 if (audioLayer == kPlatformDefaultAudio) { | 301 if (audioLayer == kPlatformDefaultAudio) { |
| 314 // Create iOS Audio Device implementation. | 302 // Create iOS Audio Device implementation. |
| 315 ptrAudioDevice = new AudioDeviceIOS(); | 303 ptrAudioDevice = new AudioDeviceIOS(); |
| 316 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, | 304 LOG(INFO) << "iPhone Audio APIs will be utilized"; |
| 317 "iPhone Audio APIs will be utilized"); | |
| 318 } | 305 } |
| 319 // END #if defined(WEBRTC_IOS) | 306 // END #if defined(WEBRTC_IOS) |
| 320 | 307 |
| 321 // Create the *Mac* implementation of the Audio Device | 308 // Create the *Mac* implementation of the Audio Device |
| 322 // | 309 // |
| 323 #elif defined(WEBRTC_MAC) | 310 #elif defined(WEBRTC_MAC) |
| 324 if (audioLayer == kPlatformDefaultAudio) { | 311 if (audioLayer == kPlatformDefaultAudio) { |
| 325 // Create *Mac Audio* implementation | 312 // Create *Mac Audio* implementation |
| 326 ptrAudioDevice = new AudioDeviceMac(Id()); | 313 ptrAudioDevice = new AudioDeviceMac(Id()); |
| 327 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, | 314 LOG(INFO) << "Mac OS X Audio APIs will be utilized"; |
| 328 "Mac OS X Audio APIs will be utilized"); | |
| 329 } | 315 } |
| 330 #endif // WEBRTC_MAC | 316 #endif // WEBRTC_MAC |
| 331 | 317 |
| 332 // Create the *Dummy* implementation of the Audio Device | 318 // Create the *Dummy* implementation of the Audio Device |
| 333 // Available for all platforms | 319 // Available for all platforms |
| 334 // | 320 // |
| 335 if (audioLayer == kDummyAudio) { | 321 if (audioLayer == kDummyAudio) { |
| 336 // Create *Dummy Audio* implementation | 322 // Create *Dummy Audio* implementation |
| 337 assert(!ptrAudioDevice); | 323 assert(!ptrAudioDevice); |
| 338 ptrAudioDevice = new AudioDeviceDummy(Id()); | 324 ptrAudioDevice = new AudioDeviceDummy(Id()); |
| 339 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, | 325 LOG(INFO) << "Dummy Audio APIs will be utilized"; |
| 340 "Dummy Audio APIs will be utilized"); | |
| 341 } | 326 } |
| 342 #endif // if defined(WEBRTC_DUMMY_AUDIO_BUILD) | 327 #endif // if defined(WEBRTC_DUMMY_AUDIO_BUILD) |
| 343 | 328 |
| 344 if (ptrAudioDevice == NULL) { | 329 if (ptrAudioDevice == NULL) { |
| 345 WEBRTC_TRACE( | 330 LOG(LERROR) |
| 346 kTraceCritical, kTraceAudioDevice, _id, | 331 << "unable to create the platform specific audio device implementation"; |
| 347 "unable to create the platform specific audio device implementation"); | |
| 348 return -1; | 332 return -1; |
| 349 } | 333 } |
| 350 | 334 |
| 351 // Store valid output pointers | 335 // Store valid output pointers |
| 352 // | 336 // |
| 353 _ptrAudioDevice = ptrAudioDevice; | 337 _ptrAudioDevice = ptrAudioDevice; |
| 354 | 338 |
| 355 return 0; | 339 return 0; |
| 356 } | 340 } |
| 357 | 341 |
| 358 // ---------------------------------------------------------------------------- | 342 // ---------------------------------------------------------------------------- |
| 359 // AttachAudioBuffer | 343 // AttachAudioBuffer |
| 360 // | 344 // |
| 361 // Install "bridge" between the platform implemetation and the generic | 345 // Install "bridge" between the platform implemetation and the generic |
| 362 // implementation. The "child" shall set the native sampling rate and the | 346 // implementation. The "child" shall set the native sampling rate and the |
| 363 // number of channels in this function call. | 347 // number of channels in this function call. |
| 364 // ---------------------------------------------------------------------------- | 348 // ---------------------------------------------------------------------------- |
| 365 | 349 |
| 366 int32_t AudioDeviceModuleImpl::AttachAudioBuffer() { | 350 int32_t AudioDeviceModuleImpl::AttachAudioBuffer() { |
| 367 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "%s", __FUNCTION__); | 351 LOG(INFO) << __FUNCTION__; |
| 368 | 352 |
| 369 _audioDeviceBuffer.SetId(_id); | 353 _audioDeviceBuffer.SetId(_id); |
| 370 _ptrAudioDevice->AttachAudioBuffer(&_audioDeviceBuffer); | 354 _ptrAudioDevice->AttachAudioBuffer(&_audioDeviceBuffer); |
| 371 return 0; | 355 return 0; |
| 372 } | 356 } |
| 373 | 357 |
| 374 // ---------------------------------------------------------------------------- | 358 // ---------------------------------------------------------------------------- |
| 375 // ~AudioDeviceModuleImpl - dtor | 359 // ~AudioDeviceModuleImpl - dtor |
| 376 // ---------------------------------------------------------------------------- | 360 // ---------------------------------------------------------------------------- |
| 377 | 361 |
| 378 AudioDeviceModuleImpl::~AudioDeviceModuleImpl() { | 362 AudioDeviceModuleImpl::~AudioDeviceModuleImpl() { |
| 379 WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, "%s destroyed", | 363 LOG(INFO) << __FUNCTION__; |
| 380 __FUNCTION__); | |
| 381 | 364 |
| 382 if (_ptrAudioDevice) { | 365 if (_ptrAudioDevice) { |
| 383 delete _ptrAudioDevice; | 366 delete _ptrAudioDevice; |
| 384 _ptrAudioDevice = NULL; | 367 _ptrAudioDevice = NULL; |
| 385 } | 368 } |
| 386 | 369 |
| 387 delete &_critSect; | 370 delete &_critSect; |
| 388 delete &_critSectEventCb; | 371 delete &_critSectEventCb; |
| 389 delete &_critSectAudioCb; | 372 delete &_critSectAudioCb; |
| 390 } | 373 } |
| 391 | 374 |
| 392 // ============================================================================ | 375 // ============================================================================ |
| 393 // Module | 376 // Module |
| 394 // ============================================================================ | 377 // ============================================================================ |
| 395 | 378 |
| 396 // ---------------------------------------------------------------------------- | 379 // ---------------------------------------------------------------------------- |
| 397 // Module::TimeUntilNextProcess | 380 // Module::TimeUntilNextProcess |
| 398 // | 381 // |
| 399 // Returns the number of milliseconds until the module want a worker thread | 382 // Returns the number of milliseconds until the module want a worker thread |
| 400 // to call Process(). | 383 // to call Process(). |
| 401 // ---------------------------------------------------------------------------- | 384 // ---------------------------------------------------------------------------- |
| 402 | 385 |
| 403 int64_t AudioDeviceModuleImpl::TimeUntilNextProcess() { | 386 int64_t AudioDeviceModuleImpl::TimeUntilNextProcess() { |
| 387 LOG(LS_VERBOSE) << __FUNCTION__; |
| 404 int64_t now = rtc::TimeMillis(); | 388 int64_t now = rtc::TimeMillis(); |
| 405 int64_t deltaProcess = kAdmMaxIdleTimeProcess - (now - _lastProcessTime); | 389 int64_t deltaProcess = kAdmMaxIdleTimeProcess - (now - _lastProcessTime); |
| 406 return deltaProcess; | 390 return deltaProcess; |
| 407 } | 391 } |
| 408 | 392 |
| 409 // ---------------------------------------------------------------------------- | 393 // ---------------------------------------------------------------------------- |
| 410 // Module::Process | 394 // Module::Process |
| 411 // | 395 // |
| 412 // Check for posted error and warning reports. Generate callbacks if | 396 // Check for posted error and warning reports. Generate callbacks if |
| 413 // new reports exists. | 397 // new reports exists. |
| 414 // ---------------------------------------------------------------------------- | 398 // ---------------------------------------------------------------------------- |
| 415 | 399 |
| 416 void AudioDeviceModuleImpl::Process() { | 400 void AudioDeviceModuleImpl::Process() { |
| 401 LOG(LS_VERBOSE) << __FUNCTION__; |
| 417 _lastProcessTime = rtc::TimeMillis(); | 402 _lastProcessTime = rtc::TimeMillis(); |
| 418 | 403 |
| 419 // kPlayoutWarning | 404 // kPlayoutWarning |
| 420 if (_ptrAudioDevice->PlayoutWarning()) { | 405 if (_ptrAudioDevice->PlayoutWarning()) { |
| 421 CriticalSectionScoped lock(&_critSectEventCb); | 406 CriticalSectionScoped lock(&_critSectEventCb); |
| 422 if (_ptrCbAudioDeviceObserver) { | 407 if (_ptrCbAudioDeviceObserver) { |
| 423 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, | 408 LOG(WARNING) << "=> OnWarningIsReported(kPlayoutWarning)"; |
| 424 "=> OnWarningIsReported(kPlayoutWarning)"); | |
| 425 _ptrCbAudioDeviceObserver->OnWarningIsReported( | 409 _ptrCbAudioDeviceObserver->OnWarningIsReported( |
| 426 AudioDeviceObserver::kPlayoutWarning); | 410 AudioDeviceObserver::kPlayoutWarning); |
| 427 } | 411 } |
| 428 _ptrAudioDevice->ClearPlayoutWarning(); | 412 _ptrAudioDevice->ClearPlayoutWarning(); |
| 429 } | 413 } |
| 430 | 414 |
| 431 // kPlayoutError | 415 // kPlayoutError |
| 432 if (_ptrAudioDevice->PlayoutError()) { | 416 if (_ptrAudioDevice->PlayoutError()) { |
| 433 CriticalSectionScoped lock(&_critSectEventCb); | 417 CriticalSectionScoped lock(&_critSectEventCb); |
| 434 if (_ptrCbAudioDeviceObserver) { | 418 if (_ptrCbAudioDeviceObserver) { |
| 435 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, | 419 LOG(LERROR) << "=> OnErrorIsReported(kPlayoutError)"; |
| 436 "=> OnErrorIsReported(kPlayoutError)"); | |
| 437 _ptrCbAudioDeviceObserver->OnErrorIsReported( | 420 _ptrCbAudioDeviceObserver->OnErrorIsReported( |
| 438 AudioDeviceObserver::kPlayoutError); | 421 AudioDeviceObserver::kPlayoutError); |
| 439 } | 422 } |
| 440 _ptrAudioDevice->ClearPlayoutError(); | 423 _ptrAudioDevice->ClearPlayoutError(); |
| 441 } | 424 } |
| 442 | 425 |
| 443 // kRecordingWarning | 426 // kRecordingWarning |
| 444 if (_ptrAudioDevice->RecordingWarning()) { | 427 if (_ptrAudioDevice->RecordingWarning()) { |
| 445 CriticalSectionScoped lock(&_critSectEventCb); | 428 CriticalSectionScoped lock(&_critSectEventCb); |
| 446 if (_ptrCbAudioDeviceObserver) { | 429 if (_ptrCbAudioDeviceObserver) { |
| 447 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, | 430 LOG(WARNING) << "=> OnWarningIsReported(kRecordingWarning)"; |
| 448 "=> OnWarningIsReported(kRecordingWarning)"); | |
| 449 _ptrCbAudioDeviceObserver->OnWarningIsReported( | 431 _ptrCbAudioDeviceObserver->OnWarningIsReported( |
| 450 AudioDeviceObserver::kRecordingWarning); | 432 AudioDeviceObserver::kRecordingWarning); |
| 451 } | 433 } |
| 452 _ptrAudioDevice->ClearRecordingWarning(); | 434 _ptrAudioDevice->ClearRecordingWarning(); |
| 453 } | 435 } |
| 454 | 436 |
| 455 // kRecordingError | 437 // kRecordingError |
| 456 if (_ptrAudioDevice->RecordingError()) { | 438 if (_ptrAudioDevice->RecordingError()) { |
| 457 CriticalSectionScoped lock(&_critSectEventCb); | 439 CriticalSectionScoped lock(&_critSectEventCb); |
| 458 if (_ptrCbAudioDeviceObserver) { | 440 if (_ptrCbAudioDeviceObserver) { |
| 459 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, | 441 LOG(LERROR) << "=> OnErrorIsReported(kRecordingError)"; |
| 460 "=> OnErrorIsReported(kRecordingError)"); | |
| 461 _ptrCbAudioDeviceObserver->OnErrorIsReported( | 442 _ptrCbAudioDeviceObserver->OnErrorIsReported( |
| 462 AudioDeviceObserver::kRecordingError); | 443 AudioDeviceObserver::kRecordingError); |
| 463 } | 444 } |
| 464 _ptrAudioDevice->ClearRecordingError(); | 445 _ptrAudioDevice->ClearRecordingError(); |
| 465 } | 446 } |
| 466 } | 447 } |
| 467 | 448 |
| 468 // ============================================================================ | 449 // ============================================================================ |
| 469 // Public API | 450 // Public API |
| 470 // ============================================================================ | 451 // ============================================================================ |
| 471 | 452 |
| 472 // ---------------------------------------------------------------------------- | 453 // ---------------------------------------------------------------------------- |
| 473 // ActiveAudioLayer | 454 // ActiveAudioLayer |
| 474 // ---------------------------------------------------------------------------- | 455 // ---------------------------------------------------------------------------- |
| 475 | 456 |
| 476 int32_t AudioDeviceModuleImpl::ActiveAudioLayer(AudioLayer* audioLayer) const { | 457 int32_t AudioDeviceModuleImpl::ActiveAudioLayer(AudioLayer* audioLayer) const { |
| 458 LOG(INFO) << __FUNCTION__; |
| 477 AudioLayer activeAudio; | 459 AudioLayer activeAudio; |
| 478 if (_ptrAudioDevice->ActiveAudioLayer(activeAudio) == -1) { | 460 if (_ptrAudioDevice->ActiveAudioLayer(activeAudio) == -1) { |
| 479 return -1; | 461 return -1; |
| 480 } | 462 } |
| 481 *audioLayer = activeAudio; | 463 *audioLayer = activeAudio; |
| 482 return 0; | 464 return 0; |
| 483 } | 465 } |
| 484 | 466 |
| 485 // ---------------------------------------------------------------------------- | 467 // ---------------------------------------------------------------------------- |
| 486 // LastError | 468 // LastError |
| 487 // ---------------------------------------------------------------------------- | 469 // ---------------------------------------------------------------------------- |
| 488 | 470 |
| 489 AudioDeviceModule::ErrorCode AudioDeviceModuleImpl::LastError() const { | 471 AudioDeviceModule::ErrorCode AudioDeviceModuleImpl::LastError() const { |
| 472 LOG(INFO) << __FUNCTION__; |
| 490 return _lastError; | 473 return _lastError; |
| 491 } | 474 } |
| 492 | 475 |
| 493 // ---------------------------------------------------------------------------- | 476 // ---------------------------------------------------------------------------- |
| 494 // Init | 477 // Init |
| 495 // ---------------------------------------------------------------------------- | 478 // ---------------------------------------------------------------------------- |
| 496 | 479 |
| 497 int32_t AudioDeviceModuleImpl::Init() { | 480 int32_t AudioDeviceModuleImpl::Init() { |
| 481 LOG(INFO) << __FUNCTION__; |
| 498 if (_initialized) | 482 if (_initialized) |
| 499 return 0; | 483 return 0; |
| 500 | 484 |
| 501 if (!_ptrAudioDevice) | 485 if (!_ptrAudioDevice) |
| 502 return -1; | 486 return -1; |
| 503 | 487 |
| 504 if (_ptrAudioDevice->Init() == -1) { | 488 if (_ptrAudioDevice->Init() == -1) { |
| 505 return -1; | 489 return -1; |
| 506 } | 490 } |
| 507 | 491 |
| 508 _initialized = true; | 492 _initialized = true; |
| 509 return 0; | 493 return 0; |
| 510 } | 494 } |
| 511 | 495 |
| 512 // ---------------------------------------------------------------------------- | 496 // ---------------------------------------------------------------------------- |
| 513 // Terminate | 497 // Terminate |
| 514 // ---------------------------------------------------------------------------- | 498 // ---------------------------------------------------------------------------- |
| 515 | 499 |
| 516 int32_t AudioDeviceModuleImpl::Terminate() { | 500 int32_t AudioDeviceModuleImpl::Terminate() { |
| 501 LOG(INFO) << __FUNCTION__; |
| 517 if (!_initialized) | 502 if (!_initialized) |
| 518 return 0; | 503 return 0; |
| 519 | 504 |
| 520 if (_ptrAudioDevice->Terminate() == -1) { | 505 if (_ptrAudioDevice->Terminate() == -1) { |
| 521 return -1; | 506 return -1; |
| 522 } | 507 } |
| 523 | 508 |
| 524 _initialized = false; | 509 _initialized = false; |
| 525 return 0; | 510 return 0; |
| 526 } | 511 } |
| 527 | 512 |
| 528 // ---------------------------------------------------------------------------- | 513 // ---------------------------------------------------------------------------- |
| 529 // Initialized | 514 // Initialized |
| 530 // ---------------------------------------------------------------------------- | 515 // ---------------------------------------------------------------------------- |
| 531 | 516 |
| 532 bool AudioDeviceModuleImpl::Initialized() const { | 517 bool AudioDeviceModuleImpl::Initialized() const { |
| 533 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: %d", | 518 LOG(INFO) << __FUNCTION__ << ": " << _initialized; |
| 534 _initialized); | |
| 535 return (_initialized); | 519 return (_initialized); |
| 536 } | 520 } |
| 537 | 521 |
| 538 // ---------------------------------------------------------------------------- | 522 // ---------------------------------------------------------------------------- |
| 539 // InitSpeaker | 523 // InitSpeaker |
| 540 // ---------------------------------------------------------------------------- | 524 // ---------------------------------------------------------------------------- |
| 541 | 525 |
| 542 int32_t AudioDeviceModuleImpl::InitSpeaker() { | 526 int32_t AudioDeviceModuleImpl::InitSpeaker() { |
| 527 LOG(INFO) << __FUNCTION__; |
| 543 CHECK_INITIALIZED(); | 528 CHECK_INITIALIZED(); |
| 544 return (_ptrAudioDevice->InitSpeaker()); | 529 return (_ptrAudioDevice->InitSpeaker()); |
| 545 } | 530 } |
| 546 | 531 |
| 547 // ---------------------------------------------------------------------------- | 532 // ---------------------------------------------------------------------------- |
| 548 // InitMicrophone | 533 // InitMicrophone |
| 549 // ---------------------------------------------------------------------------- | 534 // ---------------------------------------------------------------------------- |
| 550 | 535 |
| 551 int32_t AudioDeviceModuleImpl::InitMicrophone() { | 536 int32_t AudioDeviceModuleImpl::InitMicrophone() { |
| 537 LOG(INFO) << __FUNCTION__; |
| 552 CHECK_INITIALIZED(); | 538 CHECK_INITIALIZED(); |
| 553 return (_ptrAudioDevice->InitMicrophone()); | 539 return (_ptrAudioDevice->InitMicrophone()); |
| 554 } | 540 } |
| 555 | 541 |
| 556 // ---------------------------------------------------------------------------- | 542 // ---------------------------------------------------------------------------- |
| 557 // SpeakerVolumeIsAvailable | 543 // SpeakerVolumeIsAvailable |
| 558 // ---------------------------------------------------------------------------- | 544 // ---------------------------------------------------------------------------- |
| 559 | 545 |
| 560 int32_t AudioDeviceModuleImpl::SpeakerVolumeIsAvailable(bool* available) { | 546 int32_t AudioDeviceModuleImpl::SpeakerVolumeIsAvailable(bool* available) { |
| 547 LOG(INFO) << __FUNCTION__; |
| 561 CHECK_INITIALIZED(); | 548 CHECK_INITIALIZED(); |
| 562 | 549 |
| 563 bool isAvailable(0); | 550 bool isAvailable(0); |
| 564 | 551 |
| 565 if (_ptrAudioDevice->SpeakerVolumeIsAvailable(isAvailable) == -1) { | 552 if (_ptrAudioDevice->SpeakerVolumeIsAvailable(isAvailable) == -1) { |
| 566 return -1; | 553 return -1; |
| 567 } | 554 } |
| 568 | 555 |
| 569 *available = isAvailable; | 556 *available = isAvailable; |
| 570 | 557 |
| 571 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: available=%d", | 558 if (isAvailable) { |
| 572 *available); | 559 LOG(INFO) << __FUNCTION__ << " output: available"; |
| 560 } else { |
| 561 LOG(INFO) << __FUNCTION__ << " output: not available"; |
| 562 } |
| 573 return (0); | 563 return (0); |
| 574 } | 564 } |
| 575 | 565 |
| 576 // ---------------------------------------------------------------------------- | 566 // ---------------------------------------------------------------------------- |
| 577 // SetSpeakerVolume | 567 // SetSpeakerVolume |
| 578 // ---------------------------------------------------------------------------- | 568 // ---------------------------------------------------------------------------- |
| 579 | 569 |
| 580 int32_t AudioDeviceModuleImpl::SetSpeakerVolume(uint32_t volume) { | 570 int32_t AudioDeviceModuleImpl::SetSpeakerVolume(uint32_t volume) { |
| 571 LOG(INFO) << __FUNCTION__ << "(" << volume << ")"; |
| 581 CHECK_INITIALIZED(); | 572 CHECK_INITIALIZED(); |
| 582 return (_ptrAudioDevice->SetSpeakerVolume(volume)); | 573 return (_ptrAudioDevice->SetSpeakerVolume(volume)); |
| 583 } | 574 } |
| 584 | 575 |
| 585 // ---------------------------------------------------------------------------- | 576 // ---------------------------------------------------------------------------- |
| 586 // SpeakerVolume | 577 // SpeakerVolume |
| 587 // ---------------------------------------------------------------------------- | 578 // ---------------------------------------------------------------------------- |
| 588 | 579 |
| 589 int32_t AudioDeviceModuleImpl::SpeakerVolume(uint32_t* volume) const { | 580 int32_t AudioDeviceModuleImpl::SpeakerVolume(uint32_t* volume) const { |
| 581 LOG(INFO) << __FUNCTION__; |
| 590 CHECK_INITIALIZED(); | 582 CHECK_INITIALIZED(); |
| 591 | 583 |
| 592 uint32_t level(0); | 584 uint32_t level(0); |
| 593 | 585 |
| 594 if (_ptrAudioDevice->SpeakerVolume(level) == -1) { | 586 if (_ptrAudioDevice->SpeakerVolume(level) == -1) { |
| 595 return -1; | 587 return -1; |
| 596 } | 588 } |
| 597 | 589 |
| 598 *volume = level; | 590 *volume = level; |
| 599 | 591 |
| 600 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: volume=%u", | 592 LOG(INFO) << __FUNCTION__ << " output: " << *volume; |
| 601 *volume); | |
| 602 return (0); | 593 return (0); |
| 603 } | 594 } |
| 604 | 595 |
| 605 // ---------------------------------------------------------------------------- | 596 // ---------------------------------------------------------------------------- |
| 606 // SetWaveOutVolume | 597 // SetWaveOutVolume |
| 607 // ---------------------------------------------------------------------------- | 598 // ---------------------------------------------------------------------------- |
| 608 | 599 |
| 609 int32_t AudioDeviceModuleImpl::SetWaveOutVolume(uint16_t volumeLeft, | 600 int32_t AudioDeviceModuleImpl::SetWaveOutVolume(uint16_t volumeLeft, |
| 610 uint16_t volumeRight) { | 601 uint16_t volumeRight) { |
| 602 LOG(INFO) << __FUNCTION__ << "(" << volumeLeft << ", " << volumeRight << ")"; |
| 611 CHECK_INITIALIZED(); | 603 CHECK_INITIALIZED(); |
| 612 return (_ptrAudioDevice->SetWaveOutVolume(volumeLeft, volumeRight)); | 604 return (_ptrAudioDevice->SetWaveOutVolume(volumeLeft, volumeRight)); |
| 613 } | 605 } |
| 614 | 606 |
| 615 // ---------------------------------------------------------------------------- | 607 // ---------------------------------------------------------------------------- |
| 616 // WaveOutVolume | 608 // WaveOutVolume |
| 617 // ---------------------------------------------------------------------------- | 609 // ---------------------------------------------------------------------------- |
| 618 | 610 |
| 619 int32_t AudioDeviceModuleImpl::WaveOutVolume(uint16_t* volumeLeft, | 611 int32_t AudioDeviceModuleImpl::WaveOutVolume(uint16_t* volumeLeft, |
| 620 uint16_t* volumeRight) const { | 612 uint16_t* volumeRight) const { |
| 613 LOG(INFO) << __FUNCTION__; |
| 621 CHECK_INITIALIZED(); | 614 CHECK_INITIALIZED(); |
| 622 | 615 |
| 623 uint16_t volLeft(0); | 616 uint16_t volLeft(0); |
| 624 uint16_t volRight(0); | 617 uint16_t volRight(0); |
| 625 | 618 |
| 626 if (_ptrAudioDevice->WaveOutVolume(volLeft, volRight) == -1) { | 619 if (_ptrAudioDevice->WaveOutVolume(volLeft, volRight) == -1) { |
| 627 return -1; | 620 return -1; |
| 628 } | 621 } |
| 629 | 622 |
| 630 *volumeLeft = volLeft; | 623 *volumeLeft = volLeft; |
| 631 *volumeRight = volRight; | 624 *volumeRight = volRight; |
| 632 | 625 |
| 633 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, | 626 LOG(INFO) << __FUNCTION__ << " output: volumeLeft = " << *volumeLeft |
| 634 "outputs: volumeLeft=%u, volumeRight=%u", *volumeLeft, | 627 << ", volumeRight = " << *volumeRight; |
| 635 *volumeRight); | |
| 636 | 628 |
| 637 return (0); | 629 return (0); |
| 638 } | 630 } |
| 639 | 631 |
| 640 // ---------------------------------------------------------------------------- | 632 // ---------------------------------------------------------------------------- |
| 641 // SpeakerIsInitialized | 633 // SpeakerIsInitialized |
| 642 // ---------------------------------------------------------------------------- | 634 // ---------------------------------------------------------------------------- |
| 643 | 635 |
| 644 bool AudioDeviceModuleImpl::SpeakerIsInitialized() const { | 636 bool AudioDeviceModuleImpl::SpeakerIsInitialized() const { |
| 637 LOG(INFO) << __FUNCTION__; |
| 645 CHECK_INITIALIZED_BOOL(); | 638 CHECK_INITIALIZED_BOOL(); |
| 646 | 639 |
| 647 bool isInitialized = _ptrAudioDevice->SpeakerIsInitialized(); | 640 bool isInitialized = _ptrAudioDevice->SpeakerIsInitialized(); |
| 648 | 641 |
| 649 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: %d", | 642 if (isInitialized) { |
| 650 isInitialized); | 643 LOG(INFO) << __FUNCTION__ << " output: initialized"; |
| 644 } else { |
| 645 LOG(INFO) << __FUNCTION__ << " output: not initialized"; |
| 646 } |
| 651 return (isInitialized); | 647 return (isInitialized); |
| 652 } | 648 } |
| 653 | 649 |
| 654 // ---------------------------------------------------------------------------- | 650 // ---------------------------------------------------------------------------- |
| 655 // MicrophoneIsInitialized | 651 // MicrophoneIsInitialized |
| 656 // ---------------------------------------------------------------------------- | 652 // ---------------------------------------------------------------------------- |
| 657 | 653 |
| 658 bool AudioDeviceModuleImpl::MicrophoneIsInitialized() const { | 654 bool AudioDeviceModuleImpl::MicrophoneIsInitialized() const { |
| 655 LOG(INFO) << __FUNCTION__; |
| 659 CHECK_INITIALIZED_BOOL(); | 656 CHECK_INITIALIZED_BOOL(); |
| 660 | 657 |
| 661 bool isInitialized = _ptrAudioDevice->MicrophoneIsInitialized(); | 658 bool isInitialized = _ptrAudioDevice->MicrophoneIsInitialized(); |
| 662 | 659 |
| 663 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: %d", | 660 if (isInitialized) { |
| 664 isInitialized); | 661 LOG(INFO) << __FUNCTION__ << " output: initialized"; |
| 662 } else { |
| 663 LOG(INFO) << __FUNCTION__ << " output: not initialized"; |
| 664 } |
| 665 return (isInitialized); | 665 return (isInitialized); |
| 666 } | 666 } |
| 667 | 667 |
| 668 // ---------------------------------------------------------------------------- | 668 // ---------------------------------------------------------------------------- |
| 669 // MaxSpeakerVolume | 669 // MaxSpeakerVolume |
| 670 // ---------------------------------------------------------------------------- | 670 // ---------------------------------------------------------------------------- |
| 671 | 671 |
| 672 int32_t AudioDeviceModuleImpl::MaxSpeakerVolume(uint32_t* maxVolume) const { | 672 int32_t AudioDeviceModuleImpl::MaxSpeakerVolume(uint32_t* maxVolume) const { |
| 673 LOG(INFO) << __FUNCTION__; |
| 673 CHECK_INITIALIZED(); | 674 CHECK_INITIALIZED(); |
| 674 | 675 |
| 675 uint32_t maxVol(0); | 676 uint32_t maxVol(0); |
| 676 | 677 |
| 677 if (_ptrAudioDevice->MaxSpeakerVolume(maxVol) == -1) { | 678 if (_ptrAudioDevice->MaxSpeakerVolume(maxVol) == -1) { |
| 678 return -1; | 679 return -1; |
| 679 } | 680 } |
| 680 | 681 |
| 681 *maxVolume = maxVol; | 682 *maxVolume = maxVol; |
| 682 | 683 |
| 683 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: maxVolume=%d", | 684 LOG(INFO) << __FUNCTION__ << " output: maxVolume = " << *maxVolume; |
| 684 *maxVolume); | |
| 685 return (0); | 685 return (0); |
| 686 } | 686 } |
| 687 | 687 |
| 688 // ---------------------------------------------------------------------------- | 688 // ---------------------------------------------------------------------------- |
| 689 // MinSpeakerVolume | 689 // MinSpeakerVolume |
| 690 // ---------------------------------------------------------------------------- | 690 // ---------------------------------------------------------------------------- |
| 691 | 691 |
| 692 int32_t AudioDeviceModuleImpl::MinSpeakerVolume(uint32_t* minVolume) const { | 692 int32_t AudioDeviceModuleImpl::MinSpeakerVolume(uint32_t* minVolume) const { |
| 693 LOG(INFO) << __FUNCTION__; |
| 693 CHECK_INITIALIZED(); | 694 CHECK_INITIALIZED(); |
| 694 | 695 |
| 695 uint32_t minVol(0); | 696 uint32_t minVol(0); |
| 696 | 697 |
| 697 if (_ptrAudioDevice->MinSpeakerVolume(minVol) == -1) { | 698 if (_ptrAudioDevice->MinSpeakerVolume(minVol) == -1) { |
| 698 return -1; | 699 return -1; |
| 699 } | 700 } |
| 700 | 701 |
| 701 *minVolume = minVol; | 702 *minVolume = minVol; |
| 702 | 703 |
| 703 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: minVolume=%u", | 704 LOG(INFO) << __FUNCTION__ << " output: " << *minVolume; |
| 704 *minVolume); | |
| 705 return (0); | 705 return (0); |
| 706 } | 706 } |
| 707 | 707 |
| 708 // ---------------------------------------------------------------------------- | 708 // ---------------------------------------------------------------------------- |
| 709 // SpeakerVolumeStepSize | 709 // SpeakerVolumeStepSize |
| 710 // ---------------------------------------------------------------------------- | 710 // ---------------------------------------------------------------------------- |
| 711 | 711 |
| 712 int32_t AudioDeviceModuleImpl::SpeakerVolumeStepSize(uint16_t* stepSize) const { | 712 int32_t AudioDeviceModuleImpl::SpeakerVolumeStepSize(uint16_t* stepSize) const { |
| 713 LOG(INFO) << __FUNCTION__; |
| 713 CHECK_INITIALIZED(); | 714 CHECK_INITIALIZED(); |
| 714 | 715 |
| 715 uint16_t delta(0); | 716 uint16_t delta(0); |
| 716 | 717 |
| 717 if (_ptrAudioDevice->SpeakerVolumeStepSize(delta) == -1) { | 718 if (_ptrAudioDevice->SpeakerVolumeStepSize(delta) == -1) { |
| 718 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, | 719 LOG(LERROR) << "failed to retrieve the speaker-volume step size"; |
| 719 "failed to retrieve the speaker-volume step size"); | |
| 720 return -1; | 720 return -1; |
| 721 } | 721 } |
| 722 | 722 |
| 723 *stepSize = delta; | 723 *stepSize = delta; |
| 724 | 724 |
| 725 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: stepSize=%u", | 725 LOG(INFO) << __FUNCTION__ << " output: " << *stepSize; |
| 726 *stepSize); | |
| 727 return (0); | 726 return (0); |
| 728 } | 727 } |
| 729 | 728 |
| 730 // ---------------------------------------------------------------------------- | 729 // ---------------------------------------------------------------------------- |
| 731 // SpeakerMuteIsAvailable | 730 // SpeakerMuteIsAvailable |
| 732 // ---------------------------------------------------------------------------- | 731 // ---------------------------------------------------------------------------- |
| 733 | 732 |
| 734 int32_t AudioDeviceModuleImpl::SpeakerMuteIsAvailable(bool* available) { | 733 int32_t AudioDeviceModuleImpl::SpeakerMuteIsAvailable(bool* available) { |
| 734 LOG(INFO) << __FUNCTION__; |
| 735 CHECK_INITIALIZED(); | 735 CHECK_INITIALIZED(); |
| 736 | 736 |
| 737 bool isAvailable(0); | 737 bool isAvailable(0); |
| 738 | 738 |
| 739 if (_ptrAudioDevice->SpeakerMuteIsAvailable(isAvailable) == -1) { | 739 if (_ptrAudioDevice->SpeakerMuteIsAvailable(isAvailable) == -1) { |
| 740 return -1; | 740 return -1; |
| 741 } | 741 } |
| 742 | 742 |
| 743 *available = isAvailable; | 743 *available = isAvailable; |
| 744 | 744 |
| 745 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: available=%d", | 745 if (isAvailable) { |
| 746 *available); | 746 LOG(INFO) << __FUNCTION__ << " output: available"; |
| 747 } else { |
| 748 LOG(INFO) << __FUNCTION__ << " output: not available"; |
| 749 } |
| 747 return (0); | 750 return (0); |
| 748 } | 751 } |
| 749 | 752 |
| 750 // ---------------------------------------------------------------------------- | 753 // ---------------------------------------------------------------------------- |
| 751 // SetSpeakerMute | 754 // SetSpeakerMute |
| 752 // ---------------------------------------------------------------------------- | 755 // ---------------------------------------------------------------------------- |
| 753 | 756 |
| 754 int32_t AudioDeviceModuleImpl::SetSpeakerMute(bool enable) { | 757 int32_t AudioDeviceModuleImpl::SetSpeakerMute(bool enable) { |
| 758 LOG(INFO) << __FUNCTION__ << "(" << enable << ")"; |
| 755 CHECK_INITIALIZED(); | 759 CHECK_INITIALIZED(); |
| 756 return (_ptrAudioDevice->SetSpeakerMute(enable)); | 760 return (_ptrAudioDevice->SetSpeakerMute(enable)); |
| 757 } | 761 } |
| 758 | 762 |
| 759 // ---------------------------------------------------------------------------- | 763 // ---------------------------------------------------------------------------- |
| 760 // SpeakerMute | 764 // SpeakerMute |
| 761 // ---------------------------------------------------------------------------- | 765 // ---------------------------------------------------------------------------- |
| 762 | 766 |
| 763 int32_t AudioDeviceModuleImpl::SpeakerMute(bool* enabled) const { | 767 int32_t AudioDeviceModuleImpl::SpeakerMute(bool* enabled) const { |
| 768 LOG(INFO) << __FUNCTION__; |
| 764 CHECK_INITIALIZED(); | 769 CHECK_INITIALIZED(); |
| 765 | 770 |
| 766 bool muted(false); | 771 bool muted(false); |
| 767 | 772 |
| 768 if (_ptrAudioDevice->SpeakerMute(muted) == -1) { | 773 if (_ptrAudioDevice->SpeakerMute(muted) == -1) { |
| 769 return -1; | 774 return -1; |
| 770 } | 775 } |
| 771 | 776 |
| 772 *enabled = muted; | 777 *enabled = muted; |
| 773 | 778 |
| 774 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: enabled=%u", | 779 if (muted) { |
| 775 *enabled); | 780 LOG(INFO) << __FUNCTION__ << " output: muted"; |
| 781 } else { |
| 782 LOG(INFO) << __FUNCTION__ << " output: not muted"; |
| 783 } |
| 776 return (0); | 784 return (0); |
| 777 } | 785 } |
| 778 | 786 |
| 779 // ---------------------------------------------------------------------------- | 787 // ---------------------------------------------------------------------------- |
| 780 // MicrophoneMuteIsAvailable | 788 // MicrophoneMuteIsAvailable |
| 781 // ---------------------------------------------------------------------------- | 789 // ---------------------------------------------------------------------------- |
| 782 | 790 |
| 783 int32_t AudioDeviceModuleImpl::MicrophoneMuteIsAvailable(bool* available) { | 791 int32_t AudioDeviceModuleImpl::MicrophoneMuteIsAvailable(bool* available) { |
| 792 LOG(INFO) << __FUNCTION__; |
| 784 CHECK_INITIALIZED(); | 793 CHECK_INITIALIZED(); |
| 785 | 794 |
| 786 bool isAvailable(0); | 795 bool isAvailable(0); |
| 787 | 796 |
| 788 if (_ptrAudioDevice->MicrophoneMuteIsAvailable(isAvailable) == -1) { | 797 if (_ptrAudioDevice->MicrophoneMuteIsAvailable(isAvailable) == -1) { |
| 789 return -1; | 798 return -1; |
| 790 } | 799 } |
| 791 | 800 |
| 792 *available = isAvailable; | 801 *available = isAvailable; |
| 793 | 802 |
| 794 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: available=%d", | 803 if (isAvailable) { |
| 795 *available); | 804 LOG(INFO) << __FUNCTION__ << " output: available"; |
| 805 } else { |
| 806 LOG(INFO) << __FUNCTION__ << " output: not available"; |
| 807 } |
| 796 return (0); | 808 return (0); |
| 797 } | 809 } |
| 798 | 810 |
| 799 // ---------------------------------------------------------------------------- | 811 // ---------------------------------------------------------------------------- |
| 800 // SetMicrophoneMute | 812 // SetMicrophoneMute |
| 801 // ---------------------------------------------------------------------------- | 813 // ---------------------------------------------------------------------------- |
| 802 | 814 |
| 803 int32_t AudioDeviceModuleImpl::SetMicrophoneMute(bool enable) { | 815 int32_t AudioDeviceModuleImpl::SetMicrophoneMute(bool enable) { |
| 816 LOG(INFO) << __FUNCTION__ << "(" << enable << ")"; |
| 804 CHECK_INITIALIZED(); | 817 CHECK_INITIALIZED(); |
| 805 return (_ptrAudioDevice->SetMicrophoneMute(enable)); | 818 return (_ptrAudioDevice->SetMicrophoneMute(enable)); |
| 806 } | 819 } |
| 807 | 820 |
| 808 // ---------------------------------------------------------------------------- | 821 // ---------------------------------------------------------------------------- |
| 809 // MicrophoneMute | 822 // MicrophoneMute |
| 810 // ---------------------------------------------------------------------------- | 823 // ---------------------------------------------------------------------------- |
| 811 | 824 |
| 812 int32_t AudioDeviceModuleImpl::MicrophoneMute(bool* enabled) const { | 825 int32_t AudioDeviceModuleImpl::MicrophoneMute(bool* enabled) const { |
| 826 LOG(INFO) << __FUNCTION__; |
| 813 CHECK_INITIALIZED(); | 827 CHECK_INITIALIZED(); |
| 814 | 828 |
| 815 bool muted(false); | 829 bool muted(false); |
| 816 | 830 |
| 817 if (_ptrAudioDevice->MicrophoneMute(muted) == -1) { | 831 if (_ptrAudioDevice->MicrophoneMute(muted) == -1) { |
| 818 return -1; | 832 return -1; |
| 819 } | 833 } |
| 820 | 834 |
| 821 *enabled = muted; | 835 *enabled = muted; |
| 822 | 836 |
| 823 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: enabled=%u", | 837 if (muted) { |
| 824 *enabled); | 838 LOG(INFO) << __FUNCTION__ << " output: muted"; |
| 839 } else { |
| 840 LOG(INFO) << __FUNCTION__ << " output: not muted"; |
| 841 } |
| 825 return (0); | 842 return (0); |
| 826 } | 843 } |
| 827 | 844 |
| 828 // ---------------------------------------------------------------------------- | 845 // ---------------------------------------------------------------------------- |
| 829 // MicrophoneBoostIsAvailable | 846 // MicrophoneBoostIsAvailable |
| 830 // ---------------------------------------------------------------------------- | 847 // ---------------------------------------------------------------------------- |
| 831 | 848 |
| 832 int32_t AudioDeviceModuleImpl::MicrophoneBoostIsAvailable(bool* available) { | 849 int32_t AudioDeviceModuleImpl::MicrophoneBoostIsAvailable(bool* available) { |
| 850 LOG(INFO) << __FUNCTION__; |
| 833 CHECK_INITIALIZED(); | 851 CHECK_INITIALIZED(); |
| 834 | 852 |
| 835 bool isAvailable(0); | 853 bool isAvailable(0); |
| 836 | 854 |
| 837 if (_ptrAudioDevice->MicrophoneBoostIsAvailable(isAvailable) == -1) { | 855 if (_ptrAudioDevice->MicrophoneBoostIsAvailable(isAvailable) == -1) { |
| 838 return -1; | 856 return -1; |
| 839 } | 857 } |
| 840 | 858 |
| 841 *available = isAvailable; | 859 *available = isAvailable; |
| 842 | 860 |
| 843 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: available=%d", | 861 if (isAvailable) { |
| 844 *available); | 862 LOG(INFO) << __FUNCTION__ << " output: available"; |
| 863 } else { |
| 864 LOG(INFO) << __FUNCTION__ << " output: not available"; |
| 865 } |
| 845 return (0); | 866 return (0); |
| 846 } | 867 } |
| 847 | 868 |
| 848 // ---------------------------------------------------------------------------- | 869 // ---------------------------------------------------------------------------- |
| 849 // SetMicrophoneBoost | 870 // SetMicrophoneBoost |
| 850 // ---------------------------------------------------------------------------- | 871 // ---------------------------------------------------------------------------- |
| 851 | 872 |
| 852 int32_t AudioDeviceModuleImpl::SetMicrophoneBoost(bool enable) { | 873 int32_t AudioDeviceModuleImpl::SetMicrophoneBoost(bool enable) { |
| 874 LOG(INFO) << __FUNCTION__ << "(" << enable << ")"; |
| 853 CHECK_INITIALIZED(); | 875 CHECK_INITIALIZED(); |
| 854 return (_ptrAudioDevice->SetMicrophoneBoost(enable)); | 876 return (_ptrAudioDevice->SetMicrophoneBoost(enable)); |
| 855 } | 877 } |
| 856 | 878 |
| 857 // ---------------------------------------------------------------------------- | 879 // ---------------------------------------------------------------------------- |
| 858 // MicrophoneBoost | 880 // MicrophoneBoost |
| 859 // ---------------------------------------------------------------------------- | 881 // ---------------------------------------------------------------------------- |
| 860 | 882 |
| 861 int32_t AudioDeviceModuleImpl::MicrophoneBoost(bool* enabled) const { | 883 int32_t AudioDeviceModuleImpl::MicrophoneBoost(bool* enabled) const { |
| 884 LOG(INFO) << __FUNCTION__; |
| 862 CHECK_INITIALIZED(); | 885 CHECK_INITIALIZED(); |
| 863 | 886 |
| 864 bool onOff(false); | 887 bool onOff(false); |
| 865 | 888 |
| 866 if (_ptrAudioDevice->MicrophoneBoost(onOff) == -1) { | 889 if (_ptrAudioDevice->MicrophoneBoost(onOff) == -1) { |
| 867 return -1; | 890 return -1; |
| 868 } | 891 } |
| 869 | 892 |
| 870 *enabled = onOff; | 893 *enabled = onOff; |
| 871 | 894 |
| 872 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: enabled=%u", | 895 if (onOff) { |
| 873 *enabled); | 896 LOG(INFO) << __FUNCTION__ << " output: enabled"; |
| 897 } else { |
| 898 LOG(INFO) << __FUNCTION__ << " output: not enabled"; |
| 899 } |
| 874 return (0); | 900 return (0); |
| 875 } | 901 } |
| 876 | 902 |
| 877 // ---------------------------------------------------------------------------- | 903 // ---------------------------------------------------------------------------- |
| 878 // MicrophoneVolumeIsAvailable | 904 // MicrophoneVolumeIsAvailable |
| 879 // ---------------------------------------------------------------------------- | 905 // ---------------------------------------------------------------------------- |
| 880 | 906 |
| 881 int32_t AudioDeviceModuleImpl::MicrophoneVolumeIsAvailable(bool* available) { | 907 int32_t AudioDeviceModuleImpl::MicrophoneVolumeIsAvailable(bool* available) { |
| 908 LOG(INFO) << __FUNCTION__; |
| 882 CHECK_INITIALIZED(); | 909 CHECK_INITIALIZED(); |
| 883 | 910 |
| 884 bool isAvailable(0); | 911 bool isAvailable(0); |
| 885 | 912 |
| 886 if (_ptrAudioDevice->MicrophoneVolumeIsAvailable(isAvailable) == -1) { | 913 if (_ptrAudioDevice->MicrophoneVolumeIsAvailable(isAvailable) == -1) { |
| 887 return -1; | 914 return -1; |
| 888 } | 915 } |
| 889 | 916 |
| 890 *available = isAvailable; | 917 *available = isAvailable; |
| 891 | 918 |
| 892 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: available=%d", | 919 if (isAvailable) { |
| 893 *available); | 920 LOG(INFO) << __FUNCTION__ << " output: available"; |
| 921 } else { |
| 922 LOG(INFO) << __FUNCTION__ << " output: not available"; |
| 923 } |
| 894 return (0); | 924 return (0); |
| 895 } | 925 } |
| 896 | 926 |
| 897 // ---------------------------------------------------------------------------- | 927 // ---------------------------------------------------------------------------- |
| 898 // SetMicrophoneVolume | 928 // SetMicrophoneVolume |
| 899 // ---------------------------------------------------------------------------- | 929 // ---------------------------------------------------------------------------- |
| 900 | 930 |
| 901 int32_t AudioDeviceModuleImpl::SetMicrophoneVolume(uint32_t volume) { | 931 int32_t AudioDeviceModuleImpl::SetMicrophoneVolume(uint32_t volume) { |
| 932 LOG(INFO) << __FUNCTION__ << "(" << volume << ")"; |
| 902 CHECK_INITIALIZED(); | 933 CHECK_INITIALIZED(); |
| 903 return (_ptrAudioDevice->SetMicrophoneVolume(volume)); | 934 return (_ptrAudioDevice->SetMicrophoneVolume(volume)); |
| 904 } | 935 } |
| 905 | 936 |
| 906 // ---------------------------------------------------------------------------- | 937 // ---------------------------------------------------------------------------- |
| 907 // MicrophoneVolume | 938 // MicrophoneVolume |
| 908 // ---------------------------------------------------------------------------- | 939 // ---------------------------------------------------------------------------- |
| 909 | 940 |
| 910 int32_t AudioDeviceModuleImpl::MicrophoneVolume(uint32_t* volume) const { | 941 int32_t AudioDeviceModuleImpl::MicrophoneVolume(uint32_t* volume) const { |
| 911 WEBRTC_TRACE(kTraceStream, kTraceAudioDevice, _id, "%s", __FUNCTION__); | 942 LOG(INFO) << __FUNCTION__; |
| 912 CHECK_INITIALIZED(); | 943 CHECK_INITIALIZED(); |
| 913 | 944 |
| 914 uint32_t level(0); | 945 uint32_t level(0); |
| 915 | 946 |
| 916 if (_ptrAudioDevice->MicrophoneVolume(level) == -1) { | 947 if (_ptrAudioDevice->MicrophoneVolume(level) == -1) { |
| 917 return -1; | 948 return -1; |
| 918 } | 949 } |
| 919 | 950 |
| 920 *volume = level; | 951 *volume = level; |
| 921 | 952 |
| 922 WEBRTC_TRACE(kTraceStream, kTraceAudioDevice, _id, "output: volume=%u", | 953 LOG(INFO) << __FUNCTION__ << " output: volume = " << *volume; |
| 923 *volume); | |
| 924 return (0); | 954 return (0); |
| 925 } | 955 } |
| 926 | 956 |
| 927 // ---------------------------------------------------------------------------- | 957 // ---------------------------------------------------------------------------- |
| 928 // StereoRecordingIsAvailable | 958 // StereoRecordingIsAvailable |
| 929 // ---------------------------------------------------------------------------- | 959 // ---------------------------------------------------------------------------- |
| 930 | 960 |
| 931 int32_t AudioDeviceModuleImpl::StereoRecordingIsAvailable( | 961 int32_t AudioDeviceModuleImpl::StereoRecordingIsAvailable( |
| 932 bool* available) const { | 962 bool* available) const { |
| 963 LOG(INFO) << __FUNCTION__; |
| 933 CHECK_INITIALIZED(); | 964 CHECK_INITIALIZED(); |
| 934 | 965 |
| 935 bool isAvailable(0); | 966 bool isAvailable(0); |
| 936 | 967 |
| 937 if (_ptrAudioDevice->StereoRecordingIsAvailable(isAvailable) == -1) { | 968 if (_ptrAudioDevice->StereoRecordingIsAvailable(isAvailable) == -1) { |
| 938 return -1; | 969 return -1; |
| 939 } | 970 } |
| 940 | 971 |
| 941 *available = isAvailable; | 972 *available = isAvailable; |
| 942 | 973 |
| 943 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: available=%d", | 974 if (isAvailable) { |
| 944 *available); | 975 LOG(INFO) << __FUNCTION__ << " output: available"; |
| 976 } else { |
| 977 LOG(INFO) << __FUNCTION__ << " output: not available"; |
| 978 } |
| 945 return (0); | 979 return (0); |
| 946 } | 980 } |
| 947 | 981 |
| 948 // ---------------------------------------------------------------------------- | 982 // ---------------------------------------------------------------------------- |
| 949 // SetStereoRecording | 983 // SetStereoRecording |
| 950 // ---------------------------------------------------------------------------- | 984 // ---------------------------------------------------------------------------- |
| 951 | 985 |
| 952 int32_t AudioDeviceModuleImpl::SetStereoRecording(bool enable) { | 986 int32_t AudioDeviceModuleImpl::SetStereoRecording(bool enable) { |
| 987 LOG(INFO) << __FUNCTION__ << "(" << enable << ")"; |
| 953 CHECK_INITIALIZED(); | 988 CHECK_INITIALIZED(); |
| 954 | 989 |
| 955 if (_ptrAudioDevice->RecordingIsInitialized()) { | 990 if (_ptrAudioDevice->RecordingIsInitialized()) { |
| 956 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, | 991 LOG(WARNING) << "recording in stereo is not supported"; |
| 957 "recording in stereo is not supported"); | |
| 958 return -1; | 992 return -1; |
| 959 } | 993 } |
| 960 | 994 |
| 961 if (_ptrAudioDevice->SetStereoRecording(enable) == -1) { | 995 if (_ptrAudioDevice->SetStereoRecording(enable) == -1) { |
| 962 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, | 996 if (enable) { |
| 963 "failed to enable stereo recording"); | 997 LOG(WARNING) << "failed to enable stereo recording"; |
| 998 } else { |
| 999 LOG(WARNING) << "failed to disable stereo recording"; |
| 1000 } |
| 964 return -1; | 1001 return -1; |
| 965 } | 1002 } |
| 966 | 1003 |
| 967 int8_t nChannels(1); | 1004 int8_t nChannels(1); |
| 968 if (enable) { | 1005 if (enable) { |
| 969 nChannels = 2; | 1006 nChannels = 2; |
| 970 } | 1007 } |
| 971 _audioDeviceBuffer.SetRecordingChannels(nChannels); | 1008 _audioDeviceBuffer.SetRecordingChannels(nChannels); |
| 972 | 1009 |
| 973 return 0; | 1010 return 0; |
| 974 } | 1011 } |
| 975 | 1012 |
| 976 // ---------------------------------------------------------------------------- | 1013 // ---------------------------------------------------------------------------- |
| 977 // StereoRecording | 1014 // StereoRecording |
| 978 // ---------------------------------------------------------------------------- | 1015 // ---------------------------------------------------------------------------- |
| 979 | 1016 |
| 980 int32_t AudioDeviceModuleImpl::StereoRecording(bool* enabled) const { | 1017 int32_t AudioDeviceModuleImpl::StereoRecording(bool* enabled) const { |
| 1018 LOG(INFO) << __FUNCTION__; |
| 981 CHECK_INITIALIZED(); | 1019 CHECK_INITIALIZED(); |
| 982 | 1020 |
| 983 bool stereo(false); | 1021 bool stereo(false); |
| 984 | 1022 |
| 985 if (_ptrAudioDevice->StereoRecording(stereo) == -1) { | 1023 if (_ptrAudioDevice->StereoRecording(stereo) == -1) { |
| 986 return -1; | 1024 return -1; |
| 987 } | 1025 } |
| 988 | 1026 |
| 989 *enabled = stereo; | 1027 *enabled = stereo; |
| 990 | 1028 |
| 991 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: enabled=%u", | 1029 if (stereo) { |
| 992 *enabled); | 1030 LOG(INFO) << __FUNCTION__ << " output: enabled"; |
| 1031 } else { |
| 1032 LOG(INFO) << __FUNCTION__ << " output: not enabled"; |
| 1033 } |
| 993 return (0); | 1034 return (0); |
| 994 } | 1035 } |
| 995 | 1036 |
| 996 // ---------------------------------------------------------------------------- | 1037 // ---------------------------------------------------------------------------- |
| 997 // SetRecordingChannel | 1038 // SetRecordingChannel |
| 998 // ---------------------------------------------------------------------------- | 1039 // ---------------------------------------------------------------------------- |
| 999 | 1040 |
| 1000 int32_t AudioDeviceModuleImpl::SetRecordingChannel(const ChannelType channel) { | 1041 int32_t AudioDeviceModuleImpl::SetRecordingChannel(const ChannelType channel) { |
| 1001 if (channel == kChannelBoth) { | 1042 if (channel == kChannelBoth) { |
| 1043 LOG(INFO) << __FUNCTION__ << "(both)"; |
| 1002 } else if (channel == kChannelLeft) { | 1044 } else if (channel == kChannelLeft) { |
| 1045 LOG(INFO) << __FUNCTION__ << "(left)"; |
| 1003 } else { | 1046 } else { |
| 1047 LOG(INFO) << __FUNCTION__ << "(right)"; |
| 1004 } | 1048 } |
| 1005 CHECK_INITIALIZED(); | 1049 CHECK_INITIALIZED(); |
| 1006 | 1050 |
| 1007 bool stereo(false); | 1051 bool stereo(false); |
| 1008 | 1052 |
| 1009 if (_ptrAudioDevice->StereoRecording(stereo) == -1) { | 1053 if (_ptrAudioDevice->StereoRecording(stereo) == -1) { |
| 1010 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, | 1054 LOG(WARNING) << "recording in stereo is not supported"; |
| 1011 "recording in stereo is not supported"); | |
| 1012 return -1; | 1055 return -1; |
| 1013 } | 1056 } |
| 1014 | 1057 |
| 1015 return (_audioDeviceBuffer.SetRecordingChannel(channel)); | 1058 return (_audioDeviceBuffer.SetRecordingChannel(channel)); |
| 1016 } | 1059 } |
| 1017 | 1060 |
| 1018 // ---------------------------------------------------------------------------- | 1061 // ---------------------------------------------------------------------------- |
| 1019 // RecordingChannel | 1062 // RecordingChannel |
| 1020 // ---------------------------------------------------------------------------- | 1063 // ---------------------------------------------------------------------------- |
| 1021 | 1064 |
| 1022 int32_t AudioDeviceModuleImpl::RecordingChannel(ChannelType* channel) const { | 1065 int32_t AudioDeviceModuleImpl::RecordingChannel(ChannelType* channel) const { |
| 1066 LOG(INFO) << __FUNCTION__; |
| 1023 CHECK_INITIALIZED(); | 1067 CHECK_INITIALIZED(); |
| 1024 | 1068 |
| 1025 ChannelType chType; | 1069 ChannelType chType; |
| 1026 | 1070 |
| 1027 if (_audioDeviceBuffer.RecordingChannel(chType) == -1) { | 1071 if (_audioDeviceBuffer.RecordingChannel(chType) == -1) { |
| 1028 return -1; | 1072 return -1; |
| 1029 } | 1073 } |
| 1030 | 1074 |
| 1031 *channel = chType; | 1075 *channel = chType; |
| 1032 | 1076 |
| 1033 if (*channel == kChannelBoth) { | 1077 if (*channel == kChannelBoth) { |
| 1078 LOG(INFO) << __FUNCTION__ << " output: both"; |
| 1034 } else if (*channel == kChannelLeft) { | 1079 } else if (*channel == kChannelLeft) { |
| 1080 LOG(INFO) << __FUNCTION__ << " output: left"; |
| 1035 } else { | 1081 } else { |
| 1082 LOG(INFO) << __FUNCTION__ << " output: right"; |
| 1036 } | 1083 } |
| 1037 | 1084 |
| 1038 return (0); | 1085 return (0); |
| 1039 } | 1086 } |
| 1040 | 1087 |
| 1041 // ---------------------------------------------------------------------------- | 1088 // ---------------------------------------------------------------------------- |
| 1042 // StereoPlayoutIsAvailable | 1089 // StereoPlayoutIsAvailable |
| 1043 // ---------------------------------------------------------------------------- | 1090 // ---------------------------------------------------------------------------- |
| 1044 | 1091 |
| 1045 int32_t AudioDeviceModuleImpl::StereoPlayoutIsAvailable(bool* available) const { | 1092 int32_t AudioDeviceModuleImpl::StereoPlayoutIsAvailable(bool* available) const { |
| 1093 LOG(INFO) << __FUNCTION__; |
| 1046 CHECK_INITIALIZED(); | 1094 CHECK_INITIALIZED(); |
| 1047 | 1095 |
| 1048 bool isAvailable(0); | 1096 bool isAvailable(0); |
| 1049 | 1097 |
| 1050 if (_ptrAudioDevice->StereoPlayoutIsAvailable(isAvailable) == -1) { | 1098 if (_ptrAudioDevice->StereoPlayoutIsAvailable(isAvailable) == -1) { |
| 1051 return -1; | 1099 return -1; |
| 1052 } | 1100 } |
| 1053 | 1101 |
| 1054 *available = isAvailable; | 1102 *available = isAvailable; |
| 1055 | 1103 |
| 1056 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: available=%d", | 1104 if (isAvailable) { |
| 1057 *available); | 1105 LOG(INFO) << __FUNCTION__ << " output: available"; |
| 1106 } else { |
| 1107 LOG(INFO) << __FUNCTION__ << " output: not available"; |
| 1108 } |
| 1058 return (0); | 1109 return (0); |
| 1059 } | 1110 } |
| 1060 | 1111 |
| 1061 // ---------------------------------------------------------------------------- | 1112 // ---------------------------------------------------------------------------- |
| 1062 // SetStereoPlayout | 1113 // SetStereoPlayout |
| 1063 // ---------------------------------------------------------------------------- | 1114 // ---------------------------------------------------------------------------- |
| 1064 | 1115 |
| 1065 int32_t AudioDeviceModuleImpl::SetStereoPlayout(bool enable) { | 1116 int32_t AudioDeviceModuleImpl::SetStereoPlayout(bool enable) { |
| 1117 LOG(INFO) << __FUNCTION__ << "(" << enable << ")"; |
| 1066 CHECK_INITIALIZED(); | 1118 CHECK_INITIALIZED(); |
| 1067 | 1119 |
| 1068 if (_ptrAudioDevice->PlayoutIsInitialized()) { | 1120 if (_ptrAudioDevice->PlayoutIsInitialized()) { |
| 1069 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, | 1121 LOG(LERROR) |
| 1070 "unable to set stereo mode while playing side is initialized"); | 1122 << "unable to set stereo mode while playing side is initialized"; |
| 1071 return -1; | 1123 return -1; |
| 1072 } | 1124 } |
| 1073 | 1125 |
| 1074 if (_ptrAudioDevice->SetStereoPlayout(enable)) { | 1126 if (_ptrAudioDevice->SetStereoPlayout(enable)) { |
| 1075 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, | 1127 LOG(WARNING) << "stereo playout is not supported"; |
| 1076 "stereo playout is not supported"); | |
| 1077 return -1; | 1128 return -1; |
| 1078 } | 1129 } |
| 1079 | 1130 |
| 1080 int8_t nChannels(1); | 1131 int8_t nChannels(1); |
| 1081 if (enable) { | 1132 if (enable) { |
| 1082 nChannels = 2; | 1133 nChannels = 2; |
| 1083 } | 1134 } |
| 1084 _audioDeviceBuffer.SetPlayoutChannels(nChannels); | 1135 _audioDeviceBuffer.SetPlayoutChannels(nChannels); |
| 1085 | 1136 |
| 1086 return 0; | 1137 return 0; |
| 1087 } | 1138 } |
| 1088 | 1139 |
| 1089 // ---------------------------------------------------------------------------- | 1140 // ---------------------------------------------------------------------------- |
| 1090 // StereoPlayout | 1141 // StereoPlayout |
| 1091 // ---------------------------------------------------------------------------- | 1142 // ---------------------------------------------------------------------------- |
| 1092 | 1143 |
| 1093 int32_t AudioDeviceModuleImpl::StereoPlayout(bool* enabled) const { | 1144 int32_t AudioDeviceModuleImpl::StereoPlayout(bool* enabled) const { |
| 1145 LOG(INFO) << __FUNCTION__; |
| 1094 CHECK_INITIALIZED(); | 1146 CHECK_INITIALIZED(); |
| 1095 | 1147 |
| 1096 bool stereo(false); | 1148 bool stereo(false); |
| 1097 | 1149 |
| 1098 if (_ptrAudioDevice->StereoPlayout(stereo) == -1) { | 1150 if (_ptrAudioDevice->StereoPlayout(stereo) == -1) { |
| 1099 return -1; | 1151 return -1; |
| 1100 } | 1152 } |
| 1101 | 1153 |
| 1102 *enabled = stereo; | 1154 *enabled = stereo; |
| 1103 | 1155 |
| 1104 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: enabled=%u", | 1156 if (stereo) { |
| 1105 *enabled); | 1157 LOG(INFO) << __FUNCTION__ << " output: enabled"; |
| 1158 } else { |
| 1159 LOG(INFO) << __FUNCTION__ << " output: not enabled"; |
| 1160 } |
| 1106 return (0); | 1161 return (0); |
| 1107 } | 1162 } |
| 1108 | 1163 |
| 1109 // ---------------------------------------------------------------------------- | 1164 // ---------------------------------------------------------------------------- |
| 1110 // SetAGC | 1165 // SetAGC |
| 1111 // ---------------------------------------------------------------------------- | 1166 // ---------------------------------------------------------------------------- |
| 1112 | 1167 |
| 1113 int32_t AudioDeviceModuleImpl::SetAGC(bool enable) { | 1168 int32_t AudioDeviceModuleImpl::SetAGC(bool enable) { |
| 1169 LOG(INFO) << __FUNCTION__ << "(" << enable << ")"; |
| 1114 CHECK_INITIALIZED(); | 1170 CHECK_INITIALIZED(); |
| 1115 return (_ptrAudioDevice->SetAGC(enable)); | 1171 return (_ptrAudioDevice->SetAGC(enable)); |
| 1116 } | 1172 } |
| 1117 | 1173 |
| 1118 // ---------------------------------------------------------------------------- | 1174 // ---------------------------------------------------------------------------- |
| 1119 // AGC | 1175 // AGC |
| 1120 // ---------------------------------------------------------------------------- | 1176 // ---------------------------------------------------------------------------- |
| 1121 | 1177 |
| 1122 bool AudioDeviceModuleImpl::AGC() const { | 1178 bool AudioDeviceModuleImpl::AGC() const { |
| 1179 LOG(INFO) << __FUNCTION__; |
| 1123 CHECK_INITIALIZED_BOOL(); | 1180 CHECK_INITIALIZED_BOOL(); |
| 1124 return (_ptrAudioDevice->AGC()); | 1181 return (_ptrAudioDevice->AGC()); |
| 1125 } | 1182 } |
| 1126 | 1183 |
| 1127 // ---------------------------------------------------------------------------- | 1184 // ---------------------------------------------------------------------------- |
| 1128 // PlayoutIsAvailable | 1185 // PlayoutIsAvailable |
| 1129 // ---------------------------------------------------------------------------- | 1186 // ---------------------------------------------------------------------------- |
| 1130 | 1187 |
| 1131 int32_t AudioDeviceModuleImpl::PlayoutIsAvailable(bool* available) { | 1188 int32_t AudioDeviceModuleImpl::PlayoutIsAvailable(bool* available) { |
| 1189 LOG(INFO) << __FUNCTION__; |
| 1132 CHECK_INITIALIZED(); | 1190 CHECK_INITIALIZED(); |
| 1133 | 1191 |
| 1134 bool isAvailable(0); | 1192 bool isAvailable(0); |
| 1135 | 1193 |
| 1136 if (_ptrAudioDevice->PlayoutIsAvailable(isAvailable) == -1) { | 1194 if (_ptrAudioDevice->PlayoutIsAvailable(isAvailable) == -1) { |
| 1137 return -1; | 1195 return -1; |
| 1138 } | 1196 } |
| 1139 | 1197 |
| 1140 *available = isAvailable; | 1198 *available = isAvailable; |
| 1141 | 1199 |
| 1142 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: available=%d", | 1200 if (isAvailable) { |
| 1143 *available); | 1201 LOG(INFO) << __FUNCTION__ << " output: available"; |
| 1202 } else { |
| 1203 LOG(INFO) << __FUNCTION__ << " output: not available"; |
| 1204 } |
| 1144 return (0); | 1205 return (0); |
| 1145 } | 1206 } |
| 1146 | 1207 |
| 1147 // ---------------------------------------------------------------------------- | 1208 // ---------------------------------------------------------------------------- |
| 1148 // RecordingIsAvailable | 1209 // RecordingIsAvailable |
| 1149 // ---------------------------------------------------------------------------- | 1210 // ---------------------------------------------------------------------------- |
| 1150 | 1211 |
| 1151 int32_t AudioDeviceModuleImpl::RecordingIsAvailable(bool* available) { | 1212 int32_t AudioDeviceModuleImpl::RecordingIsAvailable(bool* available) { |
| 1213 LOG(INFO) << __FUNCTION__; |
| 1152 CHECK_INITIALIZED(); | 1214 CHECK_INITIALIZED(); |
| 1153 | 1215 |
| 1154 bool isAvailable(0); | 1216 bool isAvailable(0); |
| 1155 | 1217 |
| 1156 if (_ptrAudioDevice->RecordingIsAvailable(isAvailable) == -1) { | 1218 if (_ptrAudioDevice->RecordingIsAvailable(isAvailable) == -1) { |
| 1157 return -1; | 1219 return -1; |
| 1158 } | 1220 } |
| 1159 | 1221 |
| 1160 *available = isAvailable; | 1222 *available = isAvailable; |
| 1161 | 1223 |
| 1162 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: available=%d", | 1224 if (isAvailable) { |
| 1163 *available); | 1225 LOG(INFO) << __FUNCTION__ << " output: available"; |
| 1226 } else { |
| 1227 LOG(INFO) << __FUNCTION__ << " output: not available"; |
| 1228 } |
| 1164 return (0); | 1229 return (0); |
| 1165 } | 1230 } |
| 1166 | 1231 |
| 1167 // ---------------------------------------------------------------------------- | 1232 // ---------------------------------------------------------------------------- |
| 1168 // MaxMicrophoneVolume | 1233 // MaxMicrophoneVolume |
| 1169 // ---------------------------------------------------------------------------- | 1234 // ---------------------------------------------------------------------------- |
| 1170 | 1235 |
| 1171 int32_t AudioDeviceModuleImpl::MaxMicrophoneVolume(uint32_t* maxVolume) const { | 1236 int32_t AudioDeviceModuleImpl::MaxMicrophoneVolume(uint32_t* maxVolume) const { |
| 1172 WEBRTC_TRACE(kTraceStream, kTraceAudioDevice, _id, "%s", __FUNCTION__); | 1237 LOG(INFO) << __FUNCTION__; |
| 1173 CHECK_INITIALIZED(); | 1238 CHECK_INITIALIZED(); |
| 1174 | 1239 |
| 1175 uint32_t maxVol(0); | 1240 uint32_t maxVol(0); |
| 1176 | 1241 |
| 1177 if (_ptrAudioDevice->MaxMicrophoneVolume(maxVol) == -1) { | 1242 if (_ptrAudioDevice->MaxMicrophoneVolume(maxVol) == -1) { |
| 1178 return -1; | 1243 return -1; |
| 1179 } | 1244 } |
| 1180 | 1245 |
| 1181 *maxVolume = maxVol; | 1246 *maxVolume = maxVol; |
| 1182 | 1247 |
| 1183 WEBRTC_TRACE(kTraceStream, kTraceAudioDevice, _id, "output: maxVolume=%d", | 1248 LOG(INFO) << __FUNCTION__ << " output: = " << *maxVolume; |
| 1184 *maxVolume); | |
| 1185 return (0); | 1249 return (0); |
| 1186 } | 1250 } |
| 1187 | 1251 |
| 1188 // ---------------------------------------------------------------------------- | 1252 // ---------------------------------------------------------------------------- |
| 1189 // MinMicrophoneVolume | 1253 // MinMicrophoneVolume |
| 1190 // ---------------------------------------------------------------------------- | 1254 // ---------------------------------------------------------------------------- |
| 1191 | 1255 |
| 1192 int32_t AudioDeviceModuleImpl::MinMicrophoneVolume(uint32_t* minVolume) const { | 1256 int32_t AudioDeviceModuleImpl::MinMicrophoneVolume(uint32_t* minVolume) const { |
| 1257 LOG(INFO) << __FUNCTION__; |
| 1193 CHECK_INITIALIZED(); | 1258 CHECK_INITIALIZED(); |
| 1194 | 1259 |
| 1195 uint32_t minVol(0); | 1260 uint32_t minVol(0); |
| 1196 | 1261 |
| 1197 if (_ptrAudioDevice->MinMicrophoneVolume(minVol) == -1) { | 1262 if (_ptrAudioDevice->MinMicrophoneVolume(minVol) == -1) { |
| 1198 return -1; | 1263 return -1; |
| 1199 } | 1264 } |
| 1200 | 1265 |
| 1201 *minVolume = minVol; | 1266 *minVolume = minVol; |
| 1202 | 1267 |
| 1203 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: minVolume=%u", | 1268 LOG(INFO) << __FUNCTION__ << " output: = " << *minVolume; |
| 1204 *minVolume); | |
| 1205 return (0); | 1269 return (0); |
| 1206 } | 1270 } |
| 1207 | 1271 |
| 1208 // ---------------------------------------------------------------------------- | 1272 // ---------------------------------------------------------------------------- |
| 1209 // MicrophoneVolumeStepSize | 1273 // MicrophoneVolumeStepSize |
| 1210 // ---------------------------------------------------------------------------- | 1274 // ---------------------------------------------------------------------------- |
| 1211 | 1275 |
| 1212 int32_t AudioDeviceModuleImpl::MicrophoneVolumeStepSize( | 1276 int32_t AudioDeviceModuleImpl::MicrophoneVolumeStepSize( |
| 1213 uint16_t* stepSize) const { | 1277 uint16_t* stepSize) const { |
| 1278 LOG(INFO) << __FUNCTION__; |
| 1214 CHECK_INITIALIZED(); | 1279 CHECK_INITIALIZED(); |
| 1215 | 1280 |
| 1216 uint16_t delta(0); | 1281 uint16_t delta(0); |
| 1217 | 1282 |
| 1218 if (_ptrAudioDevice->MicrophoneVolumeStepSize(delta) == -1) { | 1283 if (_ptrAudioDevice->MicrophoneVolumeStepSize(delta) == -1) { |
| 1219 return -1; | 1284 return -1; |
| 1220 } | 1285 } |
| 1221 | 1286 |
| 1222 *stepSize = delta; | 1287 *stepSize = delta; |
| 1223 | 1288 |
| 1224 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: stepSize=%u", | 1289 LOG(INFO) << __FUNCTION__ << " output: " << *stepSize; |
| 1225 *stepSize); | |
| 1226 return (0); | 1290 return (0); |
| 1227 } | 1291 } |
| 1228 | 1292 |
| 1229 // ---------------------------------------------------------------------------- | 1293 // ---------------------------------------------------------------------------- |
| 1230 // PlayoutDevices | 1294 // PlayoutDevices |
| 1231 // ---------------------------------------------------------------------------- | 1295 // ---------------------------------------------------------------------------- |
| 1232 | 1296 |
| 1233 int16_t AudioDeviceModuleImpl::PlayoutDevices() { | 1297 int16_t AudioDeviceModuleImpl::PlayoutDevices() { |
| 1298 LOG(INFO) << __FUNCTION__; |
| 1234 CHECK_INITIALIZED(); | 1299 CHECK_INITIALIZED(); |
| 1235 | 1300 |
| 1236 uint16_t nPlayoutDevices = _ptrAudioDevice->PlayoutDevices(); | 1301 uint16_t nPlayoutDevices = _ptrAudioDevice->PlayoutDevices(); |
| 1237 | 1302 |
| 1238 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, | 1303 LOG(INFO) << __FUNCTION__ << " output: " << nPlayoutDevices; |
| 1239 "output: #playout devices=%d", nPlayoutDevices); | |
| 1240 return ((int16_t)(nPlayoutDevices)); | 1304 return ((int16_t)(nPlayoutDevices)); |
| 1241 } | 1305 } |
| 1242 | 1306 |
| 1243 // ---------------------------------------------------------------------------- | 1307 // ---------------------------------------------------------------------------- |
| 1244 // SetPlayoutDevice I (II) | 1308 // SetPlayoutDevice I (II) |
| 1245 // ---------------------------------------------------------------------------- | 1309 // ---------------------------------------------------------------------------- |
| 1246 | 1310 |
| 1247 int32_t AudioDeviceModuleImpl::SetPlayoutDevice(uint16_t index) { | 1311 int32_t AudioDeviceModuleImpl::SetPlayoutDevice(uint16_t index) { |
| 1312 LOG(INFO) << __FUNCTION__ << "(" << index << ")"; |
| 1248 CHECK_INITIALIZED(); | 1313 CHECK_INITIALIZED(); |
| 1249 return (_ptrAudioDevice->SetPlayoutDevice(index)); | 1314 return (_ptrAudioDevice->SetPlayoutDevice(index)); |
| 1250 } | 1315 } |
| 1251 | 1316 |
| 1252 // ---------------------------------------------------------------------------- | 1317 // ---------------------------------------------------------------------------- |
| 1253 // SetPlayoutDevice II (II) | 1318 // SetPlayoutDevice II (II) |
| 1254 // ---------------------------------------------------------------------------- | 1319 // ---------------------------------------------------------------------------- |
| 1255 | 1320 |
| 1256 int32_t AudioDeviceModuleImpl::SetPlayoutDevice(WindowsDeviceType device) { | 1321 int32_t AudioDeviceModuleImpl::SetPlayoutDevice(WindowsDeviceType device) { |
| 1257 if (device == kDefaultDevice) { | 1322 if (device == kDefaultDevice) { |
| 1258 } else { | 1323 } else { |
| 1259 } | 1324 } |
| 1325 LOG(INFO) << __FUNCTION__; |
| 1260 CHECK_INITIALIZED(); | 1326 CHECK_INITIALIZED(); |
| 1261 | 1327 |
| 1262 return (_ptrAudioDevice->SetPlayoutDevice(device)); | 1328 return (_ptrAudioDevice->SetPlayoutDevice(device)); |
| 1263 } | 1329 } |
| 1264 | 1330 |
| 1265 // ---------------------------------------------------------------------------- | 1331 // ---------------------------------------------------------------------------- |
| 1266 // PlayoutDeviceName | 1332 // PlayoutDeviceName |
| 1267 // ---------------------------------------------------------------------------- | 1333 // ---------------------------------------------------------------------------- |
| 1268 | 1334 |
| 1269 int32_t AudioDeviceModuleImpl::PlayoutDeviceName( | 1335 int32_t AudioDeviceModuleImpl::PlayoutDeviceName( |
| 1270 uint16_t index, | 1336 uint16_t index, |
| 1271 char name[kAdmMaxDeviceNameSize], | 1337 char name[kAdmMaxDeviceNameSize], |
| 1272 char guid[kAdmMaxGuidSize]) { | 1338 char guid[kAdmMaxGuidSize]) { |
| 1339 LOG(INFO) << __FUNCTION__ << "(" << index << ", ...)"; |
| 1273 CHECK_INITIALIZED(); | 1340 CHECK_INITIALIZED(); |
| 1274 | 1341 |
| 1275 if (name == NULL) { | 1342 if (name == NULL) { |
| 1276 _lastError = kAdmErrArgument; | 1343 _lastError = kAdmErrArgument; |
| 1277 return -1; | 1344 return -1; |
| 1278 } | 1345 } |
| 1279 | 1346 |
| 1280 if (_ptrAudioDevice->PlayoutDeviceName(index, name, guid) == -1) { | 1347 if (_ptrAudioDevice->PlayoutDeviceName(index, name, guid) == -1) { |
| 1281 return -1; | 1348 return -1; |
| 1282 } | 1349 } |
| 1283 | 1350 |
| 1284 if (name != NULL) { | 1351 if (name != NULL) { |
| 1285 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: name=%s", | 1352 LOG(INFO) << __FUNCTION__ << " output: name = " << name; |
| 1286 name); | |
| 1287 } | 1353 } |
| 1288 if (guid != NULL) { | 1354 if (guid != NULL) { |
| 1289 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: guid=%s", | 1355 LOG(INFO) << __FUNCTION__ << " output: guid = " << guid; |
| 1290 guid); | |
| 1291 } | 1356 } |
| 1292 | 1357 |
| 1293 return (0); | 1358 return (0); |
| 1294 } | 1359 } |
| 1295 | 1360 |
| 1296 // ---------------------------------------------------------------------------- | 1361 // ---------------------------------------------------------------------------- |
| 1297 // RecordingDeviceName | 1362 // RecordingDeviceName |
| 1298 // ---------------------------------------------------------------------------- | 1363 // ---------------------------------------------------------------------------- |
| 1299 | 1364 |
| 1300 int32_t AudioDeviceModuleImpl::RecordingDeviceName( | 1365 int32_t AudioDeviceModuleImpl::RecordingDeviceName( |
| 1301 uint16_t index, | 1366 uint16_t index, |
| 1302 char name[kAdmMaxDeviceNameSize], | 1367 char name[kAdmMaxDeviceNameSize], |
| 1303 char guid[kAdmMaxGuidSize]) { | 1368 char guid[kAdmMaxGuidSize]) { |
| 1369 LOG(INFO) << __FUNCTION__ << "(" << index << ", ...)"; |
| 1304 CHECK_INITIALIZED(); | 1370 CHECK_INITIALIZED(); |
| 1305 | 1371 |
| 1306 if (name == NULL) { | 1372 if (name == NULL) { |
| 1307 _lastError = kAdmErrArgument; | 1373 _lastError = kAdmErrArgument; |
| 1308 return -1; | 1374 return -1; |
| 1309 } | 1375 } |
| 1310 | 1376 |
| 1311 if (_ptrAudioDevice->RecordingDeviceName(index, name, guid) == -1) { | 1377 if (_ptrAudioDevice->RecordingDeviceName(index, name, guid) == -1) { |
| 1312 return -1; | 1378 return -1; |
| 1313 } | 1379 } |
| 1314 | 1380 |
| 1315 if (name != NULL) { | 1381 if (name != NULL) { |
| 1316 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: name=%s", | 1382 LOG(INFO) << __FUNCTION__ << " output: name = " << name; |
| 1317 name); | |
| 1318 } | 1383 } |
| 1319 if (guid != NULL) { | 1384 if (guid != NULL) { |
| 1320 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: guid=%s", | 1385 LOG(INFO) << __FUNCTION__ << " output: guid = " << guid; |
| 1321 guid); | |
| 1322 } | 1386 } |
| 1323 | 1387 |
| 1324 return (0); | 1388 return (0); |
| 1325 } | 1389 } |
| 1326 | 1390 |
| 1327 // ---------------------------------------------------------------------------- | 1391 // ---------------------------------------------------------------------------- |
| 1328 // RecordingDevices | 1392 // RecordingDevices |
| 1329 // ---------------------------------------------------------------------------- | 1393 // ---------------------------------------------------------------------------- |
| 1330 | 1394 |
| 1331 int16_t AudioDeviceModuleImpl::RecordingDevices() { | 1395 int16_t AudioDeviceModuleImpl::RecordingDevices() { |
| 1396 LOG(INFO) << __FUNCTION__; |
| 1332 CHECK_INITIALIZED(); | 1397 CHECK_INITIALIZED(); |
| 1333 | 1398 |
| 1334 uint16_t nRecordingDevices = _ptrAudioDevice->RecordingDevices(); | 1399 uint16_t nRecordingDevices = _ptrAudioDevice->RecordingDevices(); |
| 1335 | 1400 |
| 1336 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, | 1401 LOG(INFO) << __FUNCTION__ << " output: " << nRecordingDevices; |
| 1337 "output: #recording devices=%d", nRecordingDevices); | |
| 1338 return ((int16_t)nRecordingDevices); | 1402 return ((int16_t)nRecordingDevices); |
| 1339 } | 1403 } |
| 1340 | 1404 |
| 1341 // ---------------------------------------------------------------------------- | 1405 // ---------------------------------------------------------------------------- |
| 1342 // SetRecordingDevice I (II) | 1406 // SetRecordingDevice I (II) |
| 1343 // ---------------------------------------------------------------------------- | 1407 // ---------------------------------------------------------------------------- |
| 1344 | 1408 |
| 1345 int32_t AudioDeviceModuleImpl::SetRecordingDevice(uint16_t index) { | 1409 int32_t AudioDeviceModuleImpl::SetRecordingDevice(uint16_t index) { |
| 1410 LOG(INFO) << __FUNCTION__ << "(" << index << ")"; |
| 1346 CHECK_INITIALIZED(); | 1411 CHECK_INITIALIZED(); |
| 1347 return (_ptrAudioDevice->SetRecordingDevice(index)); | 1412 return (_ptrAudioDevice->SetRecordingDevice(index)); |
| 1348 } | 1413 } |
| 1349 | 1414 |
| 1350 // ---------------------------------------------------------------------------- | 1415 // ---------------------------------------------------------------------------- |
| 1351 // SetRecordingDevice II (II) | 1416 // SetRecordingDevice II (II) |
| 1352 // ---------------------------------------------------------------------------- | 1417 // ---------------------------------------------------------------------------- |
| 1353 | 1418 |
| 1354 int32_t AudioDeviceModuleImpl::SetRecordingDevice(WindowsDeviceType device) { | 1419 int32_t AudioDeviceModuleImpl::SetRecordingDevice(WindowsDeviceType device) { |
| 1355 if (device == kDefaultDevice) { | 1420 if (device == kDefaultDevice) { |
| 1356 } else { | 1421 } else { |
| 1357 } | 1422 } |
| 1423 LOG(INFO) << __FUNCTION__; |
| 1358 CHECK_INITIALIZED(); | 1424 CHECK_INITIALIZED(); |
| 1359 | 1425 |
| 1360 return (_ptrAudioDevice->SetRecordingDevice(device)); | 1426 return (_ptrAudioDevice->SetRecordingDevice(device)); |
| 1361 } | 1427 } |
| 1362 | 1428 |
| 1363 // ---------------------------------------------------------------------------- | 1429 // ---------------------------------------------------------------------------- |
| 1364 // InitPlayout | 1430 // InitPlayout |
| 1365 // ---------------------------------------------------------------------------- | 1431 // ---------------------------------------------------------------------------- |
| 1366 | 1432 |
| 1367 int32_t AudioDeviceModuleImpl::InitPlayout() { | 1433 int32_t AudioDeviceModuleImpl::InitPlayout() { |
| 1434 LOG(INFO) << __FUNCTION__; |
| 1368 CHECK_INITIALIZED(); | 1435 CHECK_INITIALIZED(); |
| 1369 _audioDeviceBuffer.InitPlayout(); | 1436 _audioDeviceBuffer.InitPlayout(); |
| 1370 return (_ptrAudioDevice->InitPlayout()); | 1437 return (_ptrAudioDevice->InitPlayout()); |
| 1371 } | 1438 } |
| 1372 | 1439 |
| 1373 // ---------------------------------------------------------------------------- | 1440 // ---------------------------------------------------------------------------- |
| 1374 // InitRecording | 1441 // InitRecording |
| 1375 // ---------------------------------------------------------------------------- | 1442 // ---------------------------------------------------------------------------- |
| 1376 | 1443 |
| 1377 int32_t AudioDeviceModuleImpl::InitRecording() { | 1444 int32_t AudioDeviceModuleImpl::InitRecording() { |
| 1378 TRACE_EVENT0("webrtc", "AudioDeviceModuleImpl::InitRecording"); | 1445 LOG(INFO) << __FUNCTION__; |
| 1379 CHECK_INITIALIZED(); | 1446 CHECK_INITIALIZED(); |
| 1380 _audioDeviceBuffer.InitRecording(); | 1447 _audioDeviceBuffer.InitRecording(); |
| 1381 return (_ptrAudioDevice->InitRecording()); | 1448 return (_ptrAudioDevice->InitRecording()); |
| 1382 } | 1449 } |
| 1383 | 1450 |
| 1384 // ---------------------------------------------------------------------------- | 1451 // ---------------------------------------------------------------------------- |
| 1385 // PlayoutIsInitialized | 1452 // PlayoutIsInitialized |
| 1386 // ---------------------------------------------------------------------------- | 1453 // ---------------------------------------------------------------------------- |
| 1387 | 1454 |
| 1388 bool AudioDeviceModuleImpl::PlayoutIsInitialized() const { | 1455 bool AudioDeviceModuleImpl::PlayoutIsInitialized() const { |
| 1456 LOG(INFO) << __FUNCTION__; |
| 1389 CHECK_INITIALIZED_BOOL(); | 1457 CHECK_INITIALIZED_BOOL(); |
| 1390 return (_ptrAudioDevice->PlayoutIsInitialized()); | 1458 return (_ptrAudioDevice->PlayoutIsInitialized()); |
| 1391 } | 1459 } |
| 1392 | 1460 |
| 1393 // ---------------------------------------------------------------------------- | 1461 // ---------------------------------------------------------------------------- |
| 1394 // RecordingIsInitialized | 1462 // RecordingIsInitialized |
| 1395 // ---------------------------------------------------------------------------- | 1463 // ---------------------------------------------------------------------------- |
| 1396 | 1464 |
| 1397 bool AudioDeviceModuleImpl::RecordingIsInitialized() const { | 1465 bool AudioDeviceModuleImpl::RecordingIsInitialized() const { |
| 1466 LOG(INFO) << __FUNCTION__; |
| 1398 CHECK_INITIALIZED_BOOL(); | 1467 CHECK_INITIALIZED_BOOL(); |
| 1399 return (_ptrAudioDevice->RecordingIsInitialized()); | 1468 return (_ptrAudioDevice->RecordingIsInitialized()); |
| 1400 } | 1469 } |
| 1401 | 1470 |
| 1402 // ---------------------------------------------------------------------------- | 1471 // ---------------------------------------------------------------------------- |
| 1403 // StartPlayout | 1472 // StartPlayout |
| 1404 // ---------------------------------------------------------------------------- | 1473 // ---------------------------------------------------------------------------- |
| 1405 | 1474 |
| 1406 int32_t AudioDeviceModuleImpl::StartPlayout() { | 1475 int32_t AudioDeviceModuleImpl::StartPlayout() { |
| 1476 LOG(INFO) << __FUNCTION__; |
| 1407 CHECK_INITIALIZED(); | 1477 CHECK_INITIALIZED(); |
| 1408 return (_ptrAudioDevice->StartPlayout()); | 1478 return (_ptrAudioDevice->StartPlayout()); |
| 1409 } | 1479 } |
| 1410 | 1480 |
| 1411 // ---------------------------------------------------------------------------- | 1481 // ---------------------------------------------------------------------------- |
| 1412 // StopPlayout | 1482 // StopPlayout |
| 1413 // ---------------------------------------------------------------------------- | 1483 // ---------------------------------------------------------------------------- |
| 1414 | 1484 |
| 1415 int32_t AudioDeviceModuleImpl::StopPlayout() { | 1485 int32_t AudioDeviceModuleImpl::StopPlayout() { |
| 1486 LOG(INFO) << __FUNCTION__; |
| 1416 CHECK_INITIALIZED(); | 1487 CHECK_INITIALIZED(); |
| 1417 return (_ptrAudioDevice->StopPlayout()); | 1488 return (_ptrAudioDevice->StopPlayout()); |
| 1418 } | 1489 } |
| 1419 | 1490 |
| 1420 // ---------------------------------------------------------------------------- | 1491 // ---------------------------------------------------------------------------- |
| 1421 // Playing | 1492 // Playing |
| 1422 // ---------------------------------------------------------------------------- | 1493 // ---------------------------------------------------------------------------- |
| 1423 | 1494 |
| 1424 bool AudioDeviceModuleImpl::Playing() const { | 1495 bool AudioDeviceModuleImpl::Playing() const { |
| 1496 LOG(INFO) << __FUNCTION__; |
| 1425 CHECK_INITIALIZED_BOOL(); | 1497 CHECK_INITIALIZED_BOOL(); |
| 1426 return (_ptrAudioDevice->Playing()); | 1498 return (_ptrAudioDevice->Playing()); |
| 1427 } | 1499 } |
| 1428 | 1500 |
| 1429 // ---------------------------------------------------------------------------- | 1501 // ---------------------------------------------------------------------------- |
| 1430 // StartRecording | 1502 // StartRecording |
| 1431 // ---------------------------------------------------------------------------- | 1503 // ---------------------------------------------------------------------------- |
| 1432 | 1504 |
| 1433 int32_t AudioDeviceModuleImpl::StartRecording() { | 1505 int32_t AudioDeviceModuleImpl::StartRecording() { |
| 1434 TRACE_EVENT0("webrtc", "AudioDeviceModuleImpl::StartRecording"); | 1506 LOG(INFO) << __FUNCTION__; |
| 1435 CHECK_INITIALIZED(); | 1507 CHECK_INITIALIZED(); |
| 1436 return (_ptrAudioDevice->StartRecording()); | 1508 return (_ptrAudioDevice->StartRecording()); |
| 1437 } | 1509 } |
| 1438 // ---------------------------------------------------------------------------- | 1510 // ---------------------------------------------------------------------------- |
| 1439 // StopRecording | 1511 // StopRecording |
| 1440 // ---------------------------------------------------------------------------- | 1512 // ---------------------------------------------------------------------------- |
| 1441 | 1513 |
| 1442 int32_t AudioDeviceModuleImpl::StopRecording() { | 1514 int32_t AudioDeviceModuleImpl::StopRecording() { |
| 1515 LOG(INFO) << __FUNCTION__; |
| 1443 CHECK_INITIALIZED(); | 1516 CHECK_INITIALIZED(); |
| 1444 return (_ptrAudioDevice->StopRecording()); | 1517 return (_ptrAudioDevice->StopRecording()); |
| 1445 } | 1518 } |
| 1446 | 1519 |
| 1447 // ---------------------------------------------------------------------------- | 1520 // ---------------------------------------------------------------------------- |
| 1448 // Recording | 1521 // Recording |
| 1449 // ---------------------------------------------------------------------------- | 1522 // ---------------------------------------------------------------------------- |
| 1450 | 1523 |
| 1451 bool AudioDeviceModuleImpl::Recording() const { | 1524 bool AudioDeviceModuleImpl::Recording() const { |
| 1525 LOG(INFO) << __FUNCTION__; |
| 1452 CHECK_INITIALIZED_BOOL(); | 1526 CHECK_INITIALIZED_BOOL(); |
| 1453 return (_ptrAudioDevice->Recording()); | 1527 return (_ptrAudioDevice->Recording()); |
| 1454 } | 1528 } |
| 1455 | 1529 |
| 1456 // ---------------------------------------------------------------------------- | 1530 // ---------------------------------------------------------------------------- |
| 1457 // RegisterEventObserver | 1531 // RegisterEventObserver |
| 1458 // ---------------------------------------------------------------------------- | 1532 // ---------------------------------------------------------------------------- |
| 1459 | 1533 |
| 1460 int32_t AudioDeviceModuleImpl::RegisterEventObserver( | 1534 int32_t AudioDeviceModuleImpl::RegisterEventObserver( |
| 1461 AudioDeviceObserver* eventCallback) { | 1535 AudioDeviceObserver* eventCallback) { |
| 1536 LOG(INFO) << __FUNCTION__; |
| 1462 CriticalSectionScoped lock(&_critSectEventCb); | 1537 CriticalSectionScoped lock(&_critSectEventCb); |
| 1463 _ptrCbAudioDeviceObserver = eventCallback; | 1538 _ptrCbAudioDeviceObserver = eventCallback; |
| 1464 | 1539 |
| 1465 return 0; | 1540 return 0; |
| 1466 } | 1541 } |
| 1467 | 1542 |
| 1468 // ---------------------------------------------------------------------------- | 1543 // ---------------------------------------------------------------------------- |
| 1469 // RegisterAudioCallback | 1544 // RegisterAudioCallback |
| 1470 // ---------------------------------------------------------------------------- | 1545 // ---------------------------------------------------------------------------- |
| 1471 | 1546 |
| 1472 int32_t AudioDeviceModuleImpl::RegisterAudioCallback( | 1547 int32_t AudioDeviceModuleImpl::RegisterAudioCallback( |
| 1473 AudioTransport* audioCallback) { | 1548 AudioTransport* audioCallback) { |
| 1549 LOG(INFO) << __FUNCTION__; |
| 1474 CriticalSectionScoped lock(&_critSectAudioCb); | 1550 CriticalSectionScoped lock(&_critSectAudioCb); |
| 1475 _audioDeviceBuffer.RegisterAudioCallback(audioCallback); | 1551 _audioDeviceBuffer.RegisterAudioCallback(audioCallback); |
| 1476 | 1552 |
| 1477 return 0; | 1553 return 0; |
| 1478 } | 1554 } |
| 1479 | 1555 |
| 1480 // ---------------------------------------------------------------------------- | 1556 // ---------------------------------------------------------------------------- |
| 1481 // StartRawInputFileRecording | 1557 // StartRawInputFileRecording |
| 1482 // ---------------------------------------------------------------------------- | 1558 // ---------------------------------------------------------------------------- |
| 1483 | 1559 |
| 1484 int32_t AudioDeviceModuleImpl::StartRawInputFileRecording( | 1560 int32_t AudioDeviceModuleImpl::StartRawInputFileRecording( |
| 1485 const char pcmFileNameUTF8[kAdmMaxFileNameSize]) { | 1561 const char pcmFileNameUTF8[kAdmMaxFileNameSize]) { |
| 1562 LOG(INFO) << __FUNCTION__; |
| 1486 CHECK_INITIALIZED(); | 1563 CHECK_INITIALIZED(); |
| 1487 | 1564 |
| 1488 if (NULL == pcmFileNameUTF8) { | 1565 if (NULL == pcmFileNameUTF8) { |
| 1489 return -1; | 1566 return -1; |
| 1490 } | 1567 } |
| 1491 | 1568 |
| 1492 return (_audioDeviceBuffer.StartInputFileRecording(pcmFileNameUTF8)); | 1569 return (_audioDeviceBuffer.StartInputFileRecording(pcmFileNameUTF8)); |
| 1493 } | 1570 } |
| 1494 | 1571 |
| 1495 // ---------------------------------------------------------------------------- | 1572 // ---------------------------------------------------------------------------- |
| 1496 // StopRawInputFileRecording | 1573 // StopRawInputFileRecording |
| 1497 // ---------------------------------------------------------------------------- | 1574 // ---------------------------------------------------------------------------- |
| 1498 | 1575 |
| 1499 int32_t AudioDeviceModuleImpl::StopRawInputFileRecording() { | 1576 int32_t AudioDeviceModuleImpl::StopRawInputFileRecording() { |
| 1577 LOG(INFO) << __FUNCTION__; |
| 1500 CHECK_INITIALIZED(); | 1578 CHECK_INITIALIZED(); |
| 1501 | 1579 |
| 1502 return (_audioDeviceBuffer.StopInputFileRecording()); | 1580 return (_audioDeviceBuffer.StopInputFileRecording()); |
| 1503 } | 1581 } |
| 1504 | 1582 |
| 1505 // ---------------------------------------------------------------------------- | 1583 // ---------------------------------------------------------------------------- |
| 1506 // StartRawOutputFileRecording | 1584 // StartRawOutputFileRecording |
| 1507 // ---------------------------------------------------------------------------- | 1585 // ---------------------------------------------------------------------------- |
| 1508 | 1586 |
| 1509 int32_t AudioDeviceModuleImpl::StartRawOutputFileRecording( | 1587 int32_t AudioDeviceModuleImpl::StartRawOutputFileRecording( |
| 1510 const char pcmFileNameUTF8[kAdmMaxFileNameSize]) { | 1588 const char pcmFileNameUTF8[kAdmMaxFileNameSize]) { |
| 1589 LOG(INFO) << __FUNCTION__; |
| 1511 CHECK_INITIALIZED(); | 1590 CHECK_INITIALIZED(); |
| 1512 | 1591 |
| 1513 if (NULL == pcmFileNameUTF8) { | 1592 if (NULL == pcmFileNameUTF8) { |
| 1514 return -1; | 1593 return -1; |
| 1515 } | 1594 } |
| 1516 | 1595 |
| 1517 return (_audioDeviceBuffer.StartOutputFileRecording(pcmFileNameUTF8)); | 1596 return (_audioDeviceBuffer.StartOutputFileRecording(pcmFileNameUTF8)); |
| 1518 } | 1597 } |
| 1519 | 1598 |
| 1520 // ---------------------------------------------------------------------------- | 1599 // ---------------------------------------------------------------------------- |
| 1521 // StopRawOutputFileRecording | 1600 // StopRawOutputFileRecording |
| 1522 // ---------------------------------------------------------------------------- | 1601 // ---------------------------------------------------------------------------- |
| 1523 | 1602 |
| 1524 int32_t AudioDeviceModuleImpl::StopRawOutputFileRecording() { | 1603 int32_t AudioDeviceModuleImpl::StopRawOutputFileRecording() { |
| 1604 LOG(INFO) << __FUNCTION__; |
| 1525 CHECK_INITIALIZED(); | 1605 CHECK_INITIALIZED(); |
| 1526 | 1606 |
| 1527 return (_audioDeviceBuffer.StopOutputFileRecording()); | 1607 return (_audioDeviceBuffer.StopOutputFileRecording()); |
| 1528 } | 1608 } |
| 1529 | 1609 |
| 1530 // ---------------------------------------------------------------------------- | 1610 // ---------------------------------------------------------------------------- |
| 1531 // SetPlayoutBuffer | 1611 // SetPlayoutBuffer |
| 1532 // ---------------------------------------------------------------------------- | 1612 // ---------------------------------------------------------------------------- |
| 1533 | 1613 |
| 1534 int32_t AudioDeviceModuleImpl::SetPlayoutBuffer(const BufferType type, | 1614 int32_t AudioDeviceModuleImpl::SetPlayoutBuffer(const BufferType type, |
| 1535 uint16_t sizeMS) { | 1615 uint16_t sizeMS) { |
| 1616 if (type == kFixedBufferSize) { |
| 1617 LOG(INFO) << __FUNCTION__ << "(" |
| 1618 << "fixed buffer, " << sizeMS << "ms" |
| 1619 << ")"; |
| 1620 } else if (type == kAdaptiveBufferSize) { |
| 1621 LOG(INFO) << __FUNCTION__ << "(" |
| 1622 << "adaptive buffer, " << sizeMS << "ms" |
| 1623 << ")"; |
| 1624 } else { |
| 1625 LOG(INFO) << __FUNCTION__ << "(" |
| 1626 << "?, " << sizeMS << "ms" |
| 1627 << ")"; |
| 1628 } |
| 1536 CHECK_INITIALIZED(); | 1629 CHECK_INITIALIZED(); |
| 1537 | 1630 |
| 1538 if (_ptrAudioDevice->PlayoutIsInitialized()) { | 1631 if (_ptrAudioDevice->PlayoutIsInitialized()) { |
| 1539 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, | 1632 LOG(LERROR) << "unable to modify the playout buffer while playing side is " |
| 1540 "unable to modify the playout buffer while playing side is " | 1633 "initialized"; |
| 1541 "initialized"); | |
| 1542 return -1; | 1634 return -1; |
| 1543 } | 1635 } |
| 1544 | 1636 |
| 1545 int32_t ret(0); | 1637 int32_t ret(0); |
| 1546 | 1638 |
| 1547 if (kFixedBufferSize == type) { | 1639 if (kFixedBufferSize == type) { |
| 1548 if (sizeMS < kAdmMinPlayoutBufferSizeMs || | 1640 if (sizeMS < kAdmMinPlayoutBufferSizeMs || |
| 1549 sizeMS > kAdmMaxPlayoutBufferSizeMs) { | 1641 sizeMS > kAdmMaxPlayoutBufferSizeMs) { |
| 1550 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, | 1642 LOG(LERROR) << "size parameter is out of range"; |
| 1551 "size parameter is out of range"); | |
| 1552 return -1; | 1643 return -1; |
| 1553 } | 1644 } |
| 1554 } | 1645 } |
| 1555 | 1646 |
| 1556 if ((ret = _ptrAudioDevice->SetPlayoutBuffer(type, sizeMS)) == -1) { | 1647 if ((ret = _ptrAudioDevice->SetPlayoutBuffer(type, sizeMS)) == -1) { |
| 1557 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, | 1648 LOG(LERROR) << "failed to set the playout buffer (error: " << LastError() |
| 1558 "failed to set the playout buffer (error: %d)", LastError()); | 1649 << ")"; |
| 1559 } | 1650 } |
| 1560 | 1651 |
| 1561 return ret; | 1652 return ret; |
| 1562 } | 1653 } |
| 1563 | 1654 |
| 1564 // ---------------------------------------------------------------------------- | 1655 // ---------------------------------------------------------------------------- |
| 1565 // PlayoutBuffer | 1656 // PlayoutBuffer |
| 1566 // ---------------------------------------------------------------------------- | 1657 // ---------------------------------------------------------------------------- |
| 1567 | 1658 |
| 1568 int32_t AudioDeviceModuleImpl::PlayoutBuffer(BufferType* type, | 1659 int32_t AudioDeviceModuleImpl::PlayoutBuffer(BufferType* type, |
| 1569 uint16_t* sizeMS) const { | 1660 uint16_t* sizeMS) const { |
| 1661 LOG(INFO) << __FUNCTION__; |
| 1570 CHECK_INITIALIZED(); | 1662 CHECK_INITIALIZED(); |
| 1571 | 1663 |
| 1572 BufferType bufType; | 1664 BufferType bufType; |
| 1573 uint16_t size(0); | 1665 uint16_t size(0); |
| 1574 | 1666 |
| 1575 if (_ptrAudioDevice->PlayoutBuffer(bufType, size) == -1) { | 1667 if (_ptrAudioDevice->PlayoutBuffer(bufType, size) == -1) { |
| 1576 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, | 1668 LOG(LERROR) << "failed to retrieve the buffer type and size"; |
| 1577 "failed to retrieve the buffer type and size"); | |
| 1578 return -1; | 1669 return -1; |
| 1579 } | 1670 } |
| 1580 | 1671 |
| 1581 *type = bufType; | 1672 *type = bufType; |
| 1582 *sizeMS = size; | 1673 *sizeMS = size; |
| 1583 | 1674 |
| 1584 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, | 1675 LOG(INFO) << __FUNCTION__ << " output: type = " << *type |
| 1585 "output: type=%u, sizeMS=%u", *type, *sizeMS); | 1676 << ", sizeMS = " << *sizeMS; |
| 1586 return (0); | 1677 return (0); |
| 1587 } | 1678 } |
| 1588 | 1679 |
| 1589 // ---------------------------------------------------------------------------- | 1680 // ---------------------------------------------------------------------------- |
| 1590 // PlayoutDelay | 1681 // PlayoutDelay |
| 1591 // ---------------------------------------------------------------------------- | 1682 // ---------------------------------------------------------------------------- |
| 1592 | 1683 |
| 1593 int32_t AudioDeviceModuleImpl::PlayoutDelay(uint16_t* delayMS) const { | 1684 int32_t AudioDeviceModuleImpl::PlayoutDelay(uint16_t* delayMS) const { |
| 1594 WEBRTC_TRACE(kTraceStream, kTraceAudioDevice, _id, "%s", __FUNCTION__); | 1685 LOG(LS_VERBOSE) << __FUNCTION__; |
| 1595 CHECK_INITIALIZED(); | 1686 CHECK_INITIALIZED(); |
| 1596 | 1687 |
| 1597 uint16_t delay(0); | 1688 uint16_t delay(0); |
| 1598 | 1689 |
| 1599 if (_ptrAudioDevice->PlayoutDelay(delay) == -1) { | 1690 if (_ptrAudioDevice->PlayoutDelay(delay) == -1) { |
| 1600 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, | 1691 LOG(LERROR) << "failed to retrieve the playout delay"; |
| 1601 "failed to retrieve the playout delay"); | |
| 1602 return -1; | 1692 return -1; |
| 1603 } | 1693 } |
| 1604 | 1694 |
| 1605 *delayMS = delay; | 1695 *delayMS = delay; |
| 1606 | 1696 |
| 1607 WEBRTC_TRACE(kTraceStream, kTraceAudioDevice, _id, "output: delayMS=%u", | 1697 LOG(LS_VERBOSE) << __FUNCTION__ << " output: delayMS = " << *delayMS; |
| 1608 *delayMS); | |
| 1609 return (0); | 1698 return (0); |
| 1610 } | 1699 } |
| 1611 | 1700 |
| 1612 // ---------------------------------------------------------------------------- | 1701 // ---------------------------------------------------------------------------- |
| 1613 // RecordingDelay | 1702 // RecordingDelay |
| 1614 // ---------------------------------------------------------------------------- | 1703 // ---------------------------------------------------------------------------- |
| 1615 | 1704 |
| 1616 int32_t AudioDeviceModuleImpl::RecordingDelay(uint16_t* delayMS) const { | 1705 int32_t AudioDeviceModuleImpl::RecordingDelay(uint16_t* delayMS) const { |
| 1617 WEBRTC_TRACE(kTraceStream, kTraceAudioDevice, _id, "%s", __FUNCTION__); | 1706 LOG(INFO) << __FUNCTION__; |
| 1618 CHECK_INITIALIZED(); | 1707 CHECK_INITIALIZED(); |
| 1619 | 1708 |
| 1620 uint16_t delay(0); | 1709 uint16_t delay(0); |
| 1621 | 1710 |
| 1622 if (_ptrAudioDevice->RecordingDelay(delay) == -1) { | 1711 if (_ptrAudioDevice->RecordingDelay(delay) == -1) { |
| 1623 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, | 1712 LOG(LERROR) << "failed to retrieve the recording delay"; |
| 1624 "failed to retrieve the recording delay"); | |
| 1625 return -1; | 1713 return -1; |
| 1626 } | 1714 } |
| 1627 | 1715 |
| 1628 *delayMS = delay; | 1716 *delayMS = delay; |
| 1629 | 1717 |
| 1630 WEBRTC_TRACE(kTraceStream, kTraceAudioDevice, _id, "output: delayMS=%u", | 1718 LOG(INFO) << __FUNCTION__ << " output: delayMS = " << *delayMS; |
| 1631 *delayMS); | |
| 1632 return (0); | 1719 return (0); |
| 1633 } | 1720 } |
| 1634 | 1721 |
| 1635 // ---------------------------------------------------------------------------- | 1722 // ---------------------------------------------------------------------------- |
| 1636 // CPULoad | 1723 // CPULoad |
| 1637 // ---------------------------------------------------------------------------- | 1724 // ---------------------------------------------------------------------------- |
| 1638 | 1725 |
| 1639 int32_t AudioDeviceModuleImpl::CPULoad(uint16_t* load) const { | 1726 int32_t AudioDeviceModuleImpl::CPULoad(uint16_t* load) const { |
| 1727 LOG(INFO) << __FUNCTION__; |
| 1640 CHECK_INITIALIZED(); | 1728 CHECK_INITIALIZED(); |
| 1641 | 1729 |
| 1642 uint16_t cpuLoad(0); | 1730 uint16_t cpuLoad(0); |
| 1643 | 1731 |
| 1644 if (_ptrAudioDevice->CPULoad(cpuLoad) == -1) { | 1732 if (_ptrAudioDevice->CPULoad(cpuLoad) == -1) { |
| 1645 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, | 1733 LOG(LERROR) << "failed to retrieve the CPU load"; |
| 1646 "failed to retrieve the CPU load"); | |
| 1647 return -1; | 1734 return -1; |
| 1648 } | 1735 } |
| 1649 | 1736 |
| 1650 *load = cpuLoad; | 1737 *load = cpuLoad; |
| 1651 | 1738 |
| 1652 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: load=%u", | 1739 LOG(INFO) << __FUNCTION__ << " output: load = " << *load; |
| 1653 *load); | |
| 1654 return (0); | 1740 return (0); |
| 1655 } | 1741 } |
| 1656 | 1742 |
| 1657 // ---------------------------------------------------------------------------- | 1743 // ---------------------------------------------------------------------------- |
| 1658 // SetRecordingSampleRate | 1744 // SetRecordingSampleRate |
| 1659 // ---------------------------------------------------------------------------- | 1745 // ---------------------------------------------------------------------------- |
| 1660 | 1746 |
| 1661 int32_t AudioDeviceModuleImpl::SetRecordingSampleRate( | 1747 int32_t AudioDeviceModuleImpl::SetRecordingSampleRate( |
| 1662 const uint32_t samplesPerSec) { | 1748 const uint32_t samplesPerSec) { |
| 1749 LOG(INFO) << __FUNCTION__ << "(" << samplesPerSec << ")"; |
| 1663 CHECK_INITIALIZED(); | 1750 CHECK_INITIALIZED(); |
| 1664 | 1751 |
| 1665 if (_ptrAudioDevice->SetRecordingSampleRate(samplesPerSec) != 0) { | 1752 if (_ptrAudioDevice->SetRecordingSampleRate(samplesPerSec) != 0) { |
| 1666 return -1; | 1753 return -1; |
| 1667 } | 1754 } |
| 1668 | 1755 |
| 1669 return (0); | 1756 return (0); |
| 1670 } | 1757 } |
| 1671 | 1758 |
| 1672 // ---------------------------------------------------------------------------- | 1759 // ---------------------------------------------------------------------------- |
| 1673 // RecordingSampleRate | 1760 // RecordingSampleRate |
| 1674 // ---------------------------------------------------------------------------- | 1761 // ---------------------------------------------------------------------------- |
| 1675 | 1762 |
| 1676 int32_t AudioDeviceModuleImpl::RecordingSampleRate( | 1763 int32_t AudioDeviceModuleImpl::RecordingSampleRate( |
| 1677 uint32_t* samplesPerSec) const { | 1764 uint32_t* samplesPerSec) const { |
| 1765 LOG(INFO) << __FUNCTION__; |
| 1678 CHECK_INITIALIZED(); | 1766 CHECK_INITIALIZED(); |
| 1679 | 1767 |
| 1680 int32_t sampleRate = _audioDeviceBuffer.RecordingSampleRate(); | 1768 int32_t sampleRate = _audioDeviceBuffer.RecordingSampleRate(); |
| 1681 | 1769 |
| 1682 if (sampleRate == -1) { | 1770 if (sampleRate == -1) { |
| 1683 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, | 1771 LOG(LERROR) << "failed to retrieve the sample rate"; |
| 1684 "failed to retrieve the sample rate"); | |
| 1685 return -1; | 1772 return -1; |
| 1686 } | 1773 } |
| 1687 | 1774 |
| 1688 *samplesPerSec = sampleRate; | 1775 *samplesPerSec = sampleRate; |
| 1689 | 1776 |
| 1690 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, | 1777 LOG(INFO) << __FUNCTION__ << " output: samplesPerSec = " << *samplesPerSec; |
| 1691 "output: samplesPerSec=%u", *samplesPerSec); | |
| 1692 return (0); | 1778 return (0); |
| 1693 } | 1779 } |
| 1694 | 1780 |
| 1695 // ---------------------------------------------------------------------------- | 1781 // ---------------------------------------------------------------------------- |
| 1696 // SetPlayoutSampleRate | 1782 // SetPlayoutSampleRate |
| 1697 // ---------------------------------------------------------------------------- | 1783 // ---------------------------------------------------------------------------- |
| 1698 | 1784 |
| 1699 int32_t AudioDeviceModuleImpl::SetPlayoutSampleRate( | 1785 int32_t AudioDeviceModuleImpl::SetPlayoutSampleRate( |
| 1700 const uint32_t samplesPerSec) { | 1786 const uint32_t samplesPerSec) { |
| 1787 LOG(INFO) << __FUNCTION__ << "(" << samplesPerSec << ")"; |
| 1701 CHECK_INITIALIZED(); | 1788 CHECK_INITIALIZED(); |
| 1702 | 1789 |
| 1703 if (_ptrAudioDevice->SetPlayoutSampleRate(samplesPerSec) != 0) { | 1790 if (_ptrAudioDevice->SetPlayoutSampleRate(samplesPerSec) != 0) { |
| 1704 return -1; | 1791 return -1; |
| 1705 } | 1792 } |
| 1706 | 1793 |
| 1707 return (0); | 1794 return (0); |
| 1708 } | 1795 } |
| 1709 | 1796 |
| 1710 // ---------------------------------------------------------------------------- | 1797 // ---------------------------------------------------------------------------- |
| 1711 // PlayoutSampleRate | 1798 // PlayoutSampleRate |
| 1712 // ---------------------------------------------------------------------------- | 1799 // ---------------------------------------------------------------------------- |
| 1713 | 1800 |
| 1714 int32_t AudioDeviceModuleImpl::PlayoutSampleRate( | 1801 int32_t AudioDeviceModuleImpl::PlayoutSampleRate( |
| 1715 uint32_t* samplesPerSec) const { | 1802 uint32_t* samplesPerSec) const { |
| 1803 LOG(INFO) << __FUNCTION__; |
| 1716 CHECK_INITIALIZED(); | 1804 CHECK_INITIALIZED(); |
| 1717 | 1805 |
| 1718 int32_t sampleRate = _audioDeviceBuffer.PlayoutSampleRate(); | 1806 int32_t sampleRate = _audioDeviceBuffer.PlayoutSampleRate(); |
| 1719 | 1807 |
| 1720 if (sampleRate == -1) { | 1808 if (sampleRate == -1) { |
| 1721 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, | 1809 LOG(LERROR) << "failed to retrieve the sample rate"; |
| 1722 "failed to retrieve the sample rate"); | |
| 1723 return -1; | 1810 return -1; |
| 1724 } | 1811 } |
| 1725 | 1812 |
| 1726 *samplesPerSec = sampleRate; | 1813 *samplesPerSec = sampleRate; |
| 1727 | 1814 |
| 1728 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, | 1815 LOG(INFO) << __FUNCTION__ << " output: samplesPerSec = " << *samplesPerSec; |
| 1729 "output: samplesPerSec=%u", *samplesPerSec); | |
| 1730 return (0); | 1816 return (0); |
| 1731 } | 1817 } |
| 1732 | 1818 |
| 1733 // ---------------------------------------------------------------------------- | 1819 // ---------------------------------------------------------------------------- |
| 1734 // ResetAudioDevice | 1820 // ResetAudioDevice |
| 1735 // ---------------------------------------------------------------------------- | 1821 // ---------------------------------------------------------------------------- |
| 1736 | 1822 |
| 1737 int32_t AudioDeviceModuleImpl::ResetAudioDevice() { | 1823 int32_t AudioDeviceModuleImpl::ResetAudioDevice() { |
| 1824 LOG(INFO) << __FUNCTION__; |
| 1738 CHECK_INITIALIZED(); | 1825 CHECK_INITIALIZED(); |
| 1739 | 1826 |
| 1740 if (_ptrAudioDevice->ResetAudioDevice() == -1) { | 1827 if (_ptrAudioDevice->ResetAudioDevice() == -1) { |
| 1741 return -1; | 1828 return -1; |
| 1742 } | 1829 } |
| 1743 | 1830 |
| 1744 return (0); | 1831 return (0); |
| 1745 } | 1832 } |
| 1746 | 1833 |
| 1747 // ---------------------------------------------------------------------------- | 1834 // ---------------------------------------------------------------------------- |
| 1748 // SetLoudspeakerStatus | 1835 // SetLoudspeakerStatus |
| 1749 // ---------------------------------------------------------------------------- | 1836 // ---------------------------------------------------------------------------- |
| 1750 | 1837 |
| 1751 int32_t AudioDeviceModuleImpl::SetLoudspeakerStatus(bool enable) { | 1838 int32_t AudioDeviceModuleImpl::SetLoudspeakerStatus(bool enable) { |
| 1839 LOG(INFO) << __FUNCTION__ << "(" << enable << ")"; |
| 1752 CHECK_INITIALIZED(); | 1840 CHECK_INITIALIZED(); |
| 1753 | 1841 |
| 1754 if (_ptrAudioDevice->SetLoudspeakerStatus(enable) != 0) { | 1842 if (_ptrAudioDevice->SetLoudspeakerStatus(enable) != 0) { |
| 1755 return -1; | 1843 return -1; |
| 1756 } | 1844 } |
| 1757 | 1845 |
| 1758 return 0; | 1846 return 0; |
| 1759 } | 1847 } |
| 1760 | 1848 |
| 1761 // ---------------------------------------------------------------------------- | 1849 // ---------------------------------------------------------------------------- |
| 1762 // GetLoudspeakerStatus | 1850 // GetLoudspeakerStatus |
| 1763 // ---------------------------------------------------------------------------- | 1851 // ---------------------------------------------------------------------------- |
| 1764 | 1852 |
| 1765 int32_t AudioDeviceModuleImpl::GetLoudspeakerStatus(bool* enabled) const { | 1853 int32_t AudioDeviceModuleImpl::GetLoudspeakerStatus(bool* enabled) const { |
| 1854 LOG(INFO) << __FUNCTION__; |
| 1766 CHECK_INITIALIZED(); | 1855 CHECK_INITIALIZED(); |
| 1856 int32_t ok = 0; |
| 1767 if (_ptrAudioDevice->GetLoudspeakerStatus(*enabled) != 0) { | 1857 if (_ptrAudioDevice->GetLoudspeakerStatus(*enabled) != 0) { |
| 1768 return -1; | 1858 ok = -1; |
| 1769 } | 1859 } |
| 1770 return 0; | 1860 LOG(INFO) << __FUNCTION__ << " output: " << ok; |
| 1861 return ok; |
| 1771 } | 1862 } |
| 1772 | 1863 |
| 1773 bool AudioDeviceModuleImpl::BuiltInAECIsEnabled() const { | 1864 bool AudioDeviceModuleImpl::BuiltInAECIsEnabled() const { |
| 1865 LOG(INFO) << __FUNCTION__; |
| 1774 CHECK_INITIALIZED_BOOL(); | 1866 CHECK_INITIALIZED_BOOL(); |
| 1775 return _ptrAudioDevice->BuiltInAECIsEnabled(); | 1867 bool isEnabled = _ptrAudioDevice->BuiltInAECIsEnabled(); |
| 1868 if (isEnabled) { |
| 1869 LOG(INFO) << __FUNCTION__ << " output: enabled"; |
| 1870 } else { |
| 1871 LOG(INFO) << __FUNCTION__ << " output: not enabled"; |
| 1872 } |
| 1873 return isEnabled; |
| 1776 } | 1874 } |
| 1777 | 1875 |
| 1778 bool AudioDeviceModuleImpl::BuiltInAECIsAvailable() const { | 1876 bool AudioDeviceModuleImpl::BuiltInAECIsAvailable() const { |
| 1877 LOG(INFO) << __FUNCTION__; |
| 1779 CHECK_INITIALIZED_BOOL(); | 1878 CHECK_INITIALIZED_BOOL(); |
| 1780 return _ptrAudioDevice->BuiltInAECIsAvailable(); | 1879 bool isAvailable = _ptrAudioDevice->BuiltInAECIsAvailable(); |
| 1880 if (isAvailable) { |
| 1881 LOG(INFO) << __FUNCTION__ << " output: available"; |
| 1882 } else { |
| 1883 LOG(INFO) << __FUNCTION__ << " output: not available"; |
| 1884 } |
| 1885 return isAvailable; |
| 1781 } | 1886 } |
| 1782 | 1887 |
| 1783 int32_t AudioDeviceModuleImpl::EnableBuiltInAEC(bool enable) { | 1888 int32_t AudioDeviceModuleImpl::EnableBuiltInAEC(bool enable) { |
| 1889 LOG(INFO) << __FUNCTION__ << "(" << enable << ")"; |
| 1784 CHECK_INITIALIZED(); | 1890 CHECK_INITIALIZED(); |
| 1785 return _ptrAudioDevice->EnableBuiltInAEC(enable); | 1891 int32_t ok = _ptrAudioDevice->EnableBuiltInAEC(enable); |
| 1892 LOG(INFO) << __FUNCTION__ << " output: " << ok; |
| 1893 return ok; |
| 1786 } | 1894 } |
| 1787 | 1895 |
| 1788 bool AudioDeviceModuleImpl::BuiltInAGCIsAvailable() const { | 1896 bool AudioDeviceModuleImpl::BuiltInAGCIsAvailable() const { |
| 1897 LOG(INFO) << __FUNCTION__; |
| 1789 CHECK_INITIALIZED_BOOL(); | 1898 CHECK_INITIALIZED_BOOL(); |
| 1790 return _ptrAudioDevice->BuiltInAGCIsAvailable(); | 1899 bool isAvailable = _ptrAudioDevice->BuiltInAGCIsAvailable(); |
| 1900 if (isAvailable) { |
| 1901 LOG(INFO) << __FUNCTION__ << " output: available"; |
| 1902 } else { |
| 1903 LOG(INFO) << __FUNCTION__ << " output: not available"; |
| 1904 } |
| 1905 return isAvailable; |
| 1791 } | 1906 } |
| 1792 | 1907 |
| 1793 int32_t AudioDeviceModuleImpl::EnableBuiltInAGC(bool enable) { | 1908 int32_t AudioDeviceModuleImpl::EnableBuiltInAGC(bool enable) { |
| 1909 LOG(INFO) << __FUNCTION__ << "(" << enable << ")"; |
| 1794 CHECK_INITIALIZED(); | 1910 CHECK_INITIALIZED(); |
| 1795 return _ptrAudioDevice->EnableBuiltInAGC(enable); | 1911 int32_t ok = _ptrAudioDevice->EnableBuiltInAGC(enable); |
| 1912 LOG(INFO) << __FUNCTION__ << " output: " << ok; |
| 1913 return ok; |
| 1796 } | 1914 } |
| 1797 | 1915 |
| 1798 bool AudioDeviceModuleImpl::BuiltInNSIsAvailable() const { | 1916 bool AudioDeviceModuleImpl::BuiltInNSIsAvailable() const { |
| 1917 LOG(INFO) << __FUNCTION__; |
| 1799 CHECK_INITIALIZED_BOOL(); | 1918 CHECK_INITIALIZED_BOOL(); |
| 1800 return _ptrAudioDevice->BuiltInNSIsAvailable(); | 1919 bool isAvailable = _ptrAudioDevice->BuiltInNSIsAvailable(); |
| 1920 if (isAvailable) { |
| 1921 LOG(INFO) << __FUNCTION__ << " output: available"; |
| 1922 } else { |
| 1923 LOG(INFO) << __FUNCTION__ << " output: not available"; |
| 1924 } |
| 1925 return isAvailable; |
| 1801 } | 1926 } |
| 1802 | 1927 |
| 1803 int32_t AudioDeviceModuleImpl::EnableBuiltInNS(bool enable) { | 1928 int32_t AudioDeviceModuleImpl::EnableBuiltInNS(bool enable) { |
| 1929 LOG(INFO) << __FUNCTION__ << "(" << enable << ")"; |
| 1804 CHECK_INITIALIZED(); | 1930 CHECK_INITIALIZED(); |
| 1805 return _ptrAudioDevice->EnableBuiltInNS(enable); | 1931 int32_t ok = _ptrAudioDevice->EnableBuiltInNS(enable); |
| 1932 LOG(INFO) << __FUNCTION__ << " output: " << ok; |
| 1933 return ok; |
| 1806 } | 1934 } |
| 1807 | 1935 |
| 1808 int AudioDeviceModuleImpl::GetPlayoutAudioParameters( | 1936 int AudioDeviceModuleImpl::GetPlayoutAudioParameters( |
| 1809 AudioParameters* params) const { | 1937 AudioParameters* params) const { |
| 1810 return _ptrAudioDevice->GetPlayoutAudioParameters(params); | 1938 LOG(INFO) << __FUNCTION__; |
| 1939 int r = _ptrAudioDevice->GetPlayoutAudioParameters(params); |
| 1940 LOG(INFO) << __FUNCTION__ << " output: " << r; |
| 1941 return r; |
| 1811 } | 1942 } |
| 1812 | 1943 |
| 1813 int AudioDeviceModuleImpl::GetRecordAudioParameters( | 1944 int AudioDeviceModuleImpl::GetRecordAudioParameters( |
| 1814 AudioParameters* params) const { | 1945 AudioParameters* params) const { |
| 1815 return _ptrAudioDevice->GetRecordAudioParameters(params); | 1946 LOG(INFO) << __FUNCTION__; |
| 1947 int r = _ptrAudioDevice->GetRecordAudioParameters(params); |
| 1948 LOG(INFO) << __FUNCTION__ << " output: " << r; |
| 1949 return r; |
| 1816 } | 1950 } |
| 1817 | 1951 |
| 1818 // ============================================================================ | 1952 // ============================================================================ |
| 1819 // Private Methods | 1953 // Private Methods |
| 1820 // ============================================================================ | 1954 // ============================================================================ |
| 1821 | 1955 |
| 1822 // ---------------------------------------------------------------------------- | 1956 // ---------------------------------------------------------------------------- |
| 1823 // Platform | 1957 // Platform |
| 1824 // ---------------------------------------------------------------------------- | 1958 // ---------------------------------------------------------------------------- |
| 1825 | 1959 |
| 1826 AudioDeviceModuleImpl::PlatformType AudioDeviceModuleImpl::Platform() const { | 1960 AudioDeviceModuleImpl::PlatformType AudioDeviceModuleImpl::Platform() const { |
| 1961 LOG(INFO) << __FUNCTION__; |
| 1827 return _platformType; | 1962 return _platformType; |
| 1828 } | 1963 } |
| 1829 | 1964 |
| 1830 // ---------------------------------------------------------------------------- | 1965 // ---------------------------------------------------------------------------- |
| 1831 // PlatformAudioLayer | 1966 // PlatformAudioLayer |
| 1832 // ---------------------------------------------------------------------------- | 1967 // ---------------------------------------------------------------------------- |
| 1833 | 1968 |
| 1834 AudioDeviceModule::AudioLayer AudioDeviceModuleImpl::PlatformAudioLayer() | 1969 AudioDeviceModule::AudioLayer AudioDeviceModuleImpl::PlatformAudioLayer() |
| 1835 const { | 1970 const { |
| 1971 LOG(INFO) << __FUNCTION__; |
| 1836 return _platformAudioLayer; | 1972 return _platformAudioLayer; |
| 1837 } | 1973 } |
| 1838 | 1974 |
| 1839 } // namespace webrtc | 1975 } // namespace webrtc |
| OLD | NEW |