Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Side by Side Diff: webrtc/modules/audio_device/audio_device_impl.cc

Issue 2091803002: Logging and tracing of audio devices on Andriod. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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) << "AudioDeviceModule::Create";
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
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
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(INFO) << __FUNCTION__;
henrika_webrtc 2016/06/27 07:42:54 Could you please check using AppRTCDemo that these
Max Morin WebRTC 2016/06/27 13:05:47 Done.
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(INFO) << __FUNCTION__;
henrika_webrtc 2016/06/27 07:42:54 Could you please check using AppRTCDemo that these
Max Morin WebRTC 2016/06/27 13:05:46 Done.
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__ << ", output: " << _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 LOG(INFO) << "output: available = " << *available;
572 *available);
573 return (0); 559 return (0);
574 } 560 }
575 561
576 // ---------------------------------------------------------------------------- 562 // ----------------------------------------------------------------------------
577 // SetSpeakerVolume 563 // SetSpeakerVolume
578 // ---------------------------------------------------------------------------- 564 // ----------------------------------------------------------------------------
579 565
580 int32_t AudioDeviceModuleImpl::SetSpeakerVolume(uint32_t volume) { 566 int32_t AudioDeviceModuleImpl::SetSpeakerVolume(uint32_t volume) {
567 LOG(INFO) << __FUNCTION__;
581 CHECK_INITIALIZED(); 568 CHECK_INITIALIZED();
582 return (_ptrAudioDevice->SetSpeakerVolume(volume)); 569 return (_ptrAudioDevice->SetSpeakerVolume(volume));
583 } 570 }
584 571
585 // ---------------------------------------------------------------------------- 572 // ----------------------------------------------------------------------------
586 // SpeakerVolume 573 // SpeakerVolume
587 // ---------------------------------------------------------------------------- 574 // ----------------------------------------------------------------------------
588 575
589 int32_t AudioDeviceModuleImpl::SpeakerVolume(uint32_t* volume) const { 576 int32_t AudioDeviceModuleImpl::SpeakerVolume(uint32_t* volume) const {
577 LOG(INFO) << __FUNCTION__;
590 CHECK_INITIALIZED(); 578 CHECK_INITIALIZED();
591 579
592 uint32_t level(0); 580 uint32_t level(0);
593 581
594 if (_ptrAudioDevice->SpeakerVolume(level) == -1) { 582 if (_ptrAudioDevice->SpeakerVolume(level) == -1) {
595 return -1; 583 return -1;
596 } 584 }
597 585
598 *volume = level; 586 *volume = level;
599 587
600 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: volume=%u", 588 LOG(INFO) << "output: volume = " << *volume;
601 *volume);
602 return (0); 589 return (0);
603 } 590 }
604 591
605 // ---------------------------------------------------------------------------- 592 // ----------------------------------------------------------------------------
606 // SetWaveOutVolume 593 // SetWaveOutVolume
607 // ---------------------------------------------------------------------------- 594 // ----------------------------------------------------------------------------
608 595
609 int32_t AudioDeviceModuleImpl::SetWaveOutVolume(uint16_t volumeLeft, 596 int32_t AudioDeviceModuleImpl::SetWaveOutVolume(uint16_t volumeLeft,
610 uint16_t volumeRight) { 597 uint16_t volumeRight) {
598 LOG(INFO) << __FUNCTION__;
611 CHECK_INITIALIZED(); 599 CHECK_INITIALIZED();
612 return (_ptrAudioDevice->SetWaveOutVolume(volumeLeft, volumeRight)); 600 return (_ptrAudioDevice->SetWaveOutVolume(volumeLeft, volumeRight));
613 } 601 }
614 602
615 // ---------------------------------------------------------------------------- 603 // ----------------------------------------------------------------------------
616 // WaveOutVolume 604 // WaveOutVolume
617 // ---------------------------------------------------------------------------- 605 // ----------------------------------------------------------------------------
618 606
619 int32_t AudioDeviceModuleImpl::WaveOutVolume(uint16_t* volumeLeft, 607 int32_t AudioDeviceModuleImpl::WaveOutVolume(uint16_t* volumeLeft,
620 uint16_t* volumeRight) const { 608 uint16_t* volumeRight) const {
609 LOG(INFO) << __FUNCTION__;
621 CHECK_INITIALIZED(); 610 CHECK_INITIALIZED();
622 611
623 uint16_t volLeft(0); 612 uint16_t volLeft(0);
624 uint16_t volRight(0); 613 uint16_t volRight(0);
625 614
626 if (_ptrAudioDevice->WaveOutVolume(volLeft, volRight) == -1) { 615 if (_ptrAudioDevice->WaveOutVolume(volLeft, volRight) == -1) {
627 return -1; 616 return -1;
628 } 617 }
629 618
630 *volumeLeft = volLeft; 619 *volumeLeft = volLeft;
631 *volumeRight = volRight; 620 *volumeRight = volRight;
632 621
633 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, 622 LOG(INFO) << "outputs: volumeLeft = " << *volumeLeft
634 "outputs: volumeLeft=%u, volumeRight=%u", *volumeLeft, 623 << ", volumeRight = " << *volumeRight;
635 *volumeRight);
636 624
637 return (0); 625 return (0);
638 } 626 }
639 627
640 // ---------------------------------------------------------------------------- 628 // ----------------------------------------------------------------------------
641 // SpeakerIsInitialized 629 // SpeakerIsInitialized
642 // ---------------------------------------------------------------------------- 630 // ----------------------------------------------------------------------------
643 631
644 bool AudioDeviceModuleImpl::SpeakerIsInitialized() const { 632 bool AudioDeviceModuleImpl::SpeakerIsInitialized() const {
633 LOG(INFO) << __FUNCTION__;
645 CHECK_INITIALIZED_BOOL(); 634 CHECK_INITIALIZED_BOOL();
646 635
647 bool isInitialized = _ptrAudioDevice->SpeakerIsInitialized(); 636 bool isInitialized = _ptrAudioDevice->SpeakerIsInitialized();
648 637
649 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: %d", 638 LOG(INFO) << "output: " << isInitialized;
650 isInitialized);
651 return (isInitialized); 639 return (isInitialized);
652 } 640 }
653 641
654 // ---------------------------------------------------------------------------- 642 // ----------------------------------------------------------------------------
655 // MicrophoneIsInitialized 643 // MicrophoneIsInitialized
656 // ---------------------------------------------------------------------------- 644 // ----------------------------------------------------------------------------
657 645
658 bool AudioDeviceModuleImpl::MicrophoneIsInitialized() const { 646 bool AudioDeviceModuleImpl::MicrophoneIsInitialized() const {
647 LOG(INFO) << __FUNCTION__;
659 CHECK_INITIALIZED_BOOL(); 648 CHECK_INITIALIZED_BOOL();
660 649
661 bool isInitialized = _ptrAudioDevice->MicrophoneIsInitialized(); 650 bool isInitialized = _ptrAudioDevice->MicrophoneIsInitialized();
662 651
663 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: %d", 652 LOG(INFO) << "output: " << isInitialized;
664 isInitialized);
665 return (isInitialized); 653 return (isInitialized);
666 } 654 }
667 655
668 // ---------------------------------------------------------------------------- 656 // ----------------------------------------------------------------------------
669 // MaxSpeakerVolume 657 // MaxSpeakerVolume
670 // ---------------------------------------------------------------------------- 658 // ----------------------------------------------------------------------------
671 659
672 int32_t AudioDeviceModuleImpl::MaxSpeakerVolume(uint32_t* maxVolume) const { 660 int32_t AudioDeviceModuleImpl::MaxSpeakerVolume(uint32_t* maxVolume) const {
661 LOG(INFO) << __FUNCTION__;
673 CHECK_INITIALIZED(); 662 CHECK_INITIALIZED();
674 663
675 uint32_t maxVol(0); 664 uint32_t maxVol(0);
676 665
677 if (_ptrAudioDevice->MaxSpeakerVolume(maxVol) == -1) { 666 if (_ptrAudioDevice->MaxSpeakerVolume(maxVol) == -1) {
678 return -1; 667 return -1;
679 } 668 }
680 669
681 *maxVolume = maxVol; 670 *maxVolume = maxVol;
682 671
683 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: maxVolume=%d", 672 LOG(INFO) << "output: maxVolume = " << *maxVolume;
684 *maxVolume);
685 return (0); 673 return (0);
686 } 674 }
687 675
688 // ---------------------------------------------------------------------------- 676 // ----------------------------------------------------------------------------
689 // MinSpeakerVolume 677 // MinSpeakerVolume
690 // ---------------------------------------------------------------------------- 678 // ----------------------------------------------------------------------------
691 679
692 int32_t AudioDeviceModuleImpl::MinSpeakerVolume(uint32_t* minVolume) const { 680 int32_t AudioDeviceModuleImpl::MinSpeakerVolume(uint32_t* minVolume) const {
681 LOG(INFO) << __FUNCTION__;
693 CHECK_INITIALIZED(); 682 CHECK_INITIALIZED();
694 683
695 uint32_t minVol(0); 684 uint32_t minVol(0);
696 685
697 if (_ptrAudioDevice->MinSpeakerVolume(minVol) == -1) { 686 if (_ptrAudioDevice->MinSpeakerVolume(minVol) == -1) {
698 return -1; 687 return -1;
699 } 688 }
700 689
701 *minVolume = minVol; 690 *minVolume = minVol;
702 691
703 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: minVolume=%u", 692 LOG(INFO) << "output: minVolume = " << *minVolume;
704 *minVolume);
705 return (0); 693 return (0);
706 } 694 }
707 695
708 // ---------------------------------------------------------------------------- 696 // ----------------------------------------------------------------------------
709 // SpeakerVolumeStepSize 697 // SpeakerVolumeStepSize
710 // ---------------------------------------------------------------------------- 698 // ----------------------------------------------------------------------------
711 699
712 int32_t AudioDeviceModuleImpl::SpeakerVolumeStepSize(uint16_t* stepSize) const { 700 int32_t AudioDeviceModuleImpl::SpeakerVolumeStepSize(uint16_t* stepSize) const {
701 LOG(INFO) << __FUNCTION__;
713 CHECK_INITIALIZED(); 702 CHECK_INITIALIZED();
714 703
715 uint16_t delta(0); 704 uint16_t delta(0);
716 705
717 if (_ptrAudioDevice->SpeakerVolumeStepSize(delta) == -1) { 706 if (_ptrAudioDevice->SpeakerVolumeStepSize(delta) == -1) {
718 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, 707 LOG(LERROR) << "failed to retrieve the speaker-volume step size";
719 "failed to retrieve the speaker-volume step size");
720 return -1; 708 return -1;
721 } 709 }
722 710
723 *stepSize = delta; 711 *stepSize = delta;
724 712
725 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: stepSize=%u", 713 LOG(INFO) << "output: stepSize = " << *stepSize;
726 *stepSize);
727 return (0); 714 return (0);
728 } 715 }
729 716
730 // ---------------------------------------------------------------------------- 717 // ----------------------------------------------------------------------------
731 // SpeakerMuteIsAvailable 718 // SpeakerMuteIsAvailable
732 // ---------------------------------------------------------------------------- 719 // ----------------------------------------------------------------------------
733 720
734 int32_t AudioDeviceModuleImpl::SpeakerMuteIsAvailable(bool* available) { 721 int32_t AudioDeviceModuleImpl::SpeakerMuteIsAvailable(bool* available) {
722 LOG(INFO) << __FUNCTION__;
735 CHECK_INITIALIZED(); 723 CHECK_INITIALIZED();
736 724
737 bool isAvailable(0); 725 bool isAvailable(0);
738 726
739 if (_ptrAudioDevice->SpeakerMuteIsAvailable(isAvailable) == -1) { 727 if (_ptrAudioDevice->SpeakerMuteIsAvailable(isAvailable) == -1) {
740 return -1; 728 return -1;
741 } 729 }
742 730
743 *available = isAvailable; 731 *available = isAvailable;
744 732
745 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: available=%d", 733 LOG(INFO) << "output: available = " << *available;
746 *available);
747 return (0); 734 return (0);
748 } 735 }
749 736
750 // ---------------------------------------------------------------------------- 737 // ----------------------------------------------------------------------------
751 // SetSpeakerMute 738 // SetSpeakerMute
752 // ---------------------------------------------------------------------------- 739 // ----------------------------------------------------------------------------
753 740
754 int32_t AudioDeviceModuleImpl::SetSpeakerMute(bool enable) { 741 int32_t AudioDeviceModuleImpl::SetSpeakerMute(bool enable) {
742 LOG(INFO) << __FUNCTION__;
755 CHECK_INITIALIZED(); 743 CHECK_INITIALIZED();
756 return (_ptrAudioDevice->SetSpeakerMute(enable)); 744 return (_ptrAudioDevice->SetSpeakerMute(enable));
757 } 745 }
758 746
759 // ---------------------------------------------------------------------------- 747 // ----------------------------------------------------------------------------
760 // SpeakerMute 748 // SpeakerMute
761 // ---------------------------------------------------------------------------- 749 // ----------------------------------------------------------------------------
762 750
763 int32_t AudioDeviceModuleImpl::SpeakerMute(bool* enabled) const { 751 int32_t AudioDeviceModuleImpl::SpeakerMute(bool* enabled) const {
752 LOG(INFO) << __FUNCTION__;
764 CHECK_INITIALIZED(); 753 CHECK_INITIALIZED();
765 754
766 bool muted(false); 755 bool muted(false);
767 756
768 if (_ptrAudioDevice->SpeakerMute(muted) == -1) { 757 if (_ptrAudioDevice->SpeakerMute(muted) == -1) {
769 return -1; 758 return -1;
770 } 759 }
771 760
772 *enabled = muted; 761 *enabled = muted;
773 762
774 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: enabled=%u", 763 LOG(INFO) << "output: enabled = " << *enabled;
775 *enabled);
776 return (0); 764 return (0);
777 } 765 }
778 766
779 // ---------------------------------------------------------------------------- 767 // ----------------------------------------------------------------------------
780 // MicrophoneMuteIsAvailable 768 // MicrophoneMuteIsAvailable
781 // ---------------------------------------------------------------------------- 769 // ----------------------------------------------------------------------------
782 770
783 int32_t AudioDeviceModuleImpl::MicrophoneMuteIsAvailable(bool* available) { 771 int32_t AudioDeviceModuleImpl::MicrophoneMuteIsAvailable(bool* available) {
772 LOG(INFO) << __FUNCTION__;
784 CHECK_INITIALIZED(); 773 CHECK_INITIALIZED();
785 774
786 bool isAvailable(0); 775 bool isAvailable(0);
787 776
788 if (_ptrAudioDevice->MicrophoneMuteIsAvailable(isAvailable) == -1) { 777 if (_ptrAudioDevice->MicrophoneMuteIsAvailable(isAvailable) == -1) {
789 return -1; 778 return -1;
790 } 779 }
791 780
792 *available = isAvailable; 781 *available = isAvailable;
793 782
794 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: available=%d", 783 LOG(INFO) << "output: available = " << *available;
795 *available);
796 return (0); 784 return (0);
797 } 785 }
798 786
799 // ---------------------------------------------------------------------------- 787 // ----------------------------------------------------------------------------
800 // SetMicrophoneMute 788 // SetMicrophoneMute
801 // ---------------------------------------------------------------------------- 789 // ----------------------------------------------------------------------------
802 790
803 int32_t AudioDeviceModuleImpl::SetMicrophoneMute(bool enable) { 791 int32_t AudioDeviceModuleImpl::SetMicrophoneMute(bool enable) {
792 LOG(INFO) << __FUNCTION__;
804 CHECK_INITIALIZED(); 793 CHECK_INITIALIZED();
805 return (_ptrAudioDevice->SetMicrophoneMute(enable)); 794 return (_ptrAudioDevice->SetMicrophoneMute(enable));
806 } 795 }
807 796
808 // ---------------------------------------------------------------------------- 797 // ----------------------------------------------------------------------------
809 // MicrophoneMute 798 // MicrophoneMute
810 // ---------------------------------------------------------------------------- 799 // ----------------------------------------------------------------------------
811 800
812 int32_t AudioDeviceModuleImpl::MicrophoneMute(bool* enabled) const { 801 int32_t AudioDeviceModuleImpl::MicrophoneMute(bool* enabled) const {
802 LOG(INFO) << __FUNCTION__;
813 CHECK_INITIALIZED(); 803 CHECK_INITIALIZED();
814 804
815 bool muted(false); 805 bool muted(false);
816 806
817 if (_ptrAudioDevice->MicrophoneMute(muted) == -1) { 807 if (_ptrAudioDevice->MicrophoneMute(muted) == -1) {
818 return -1; 808 return -1;
819 } 809 }
820 810
821 *enabled = muted; 811 *enabled = muted;
822 812
823 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: enabled=%u", 813 LOG(INFO) << "output: enabled = " << *enabled;
824 *enabled);
825 return (0); 814 return (0);
826 } 815 }
827 816
828 // ---------------------------------------------------------------------------- 817 // ----------------------------------------------------------------------------
829 // MicrophoneBoostIsAvailable 818 // MicrophoneBoostIsAvailable
830 // ---------------------------------------------------------------------------- 819 // ----------------------------------------------------------------------------
831 820
832 int32_t AudioDeviceModuleImpl::MicrophoneBoostIsAvailable(bool* available) { 821 int32_t AudioDeviceModuleImpl::MicrophoneBoostIsAvailable(bool* available) {
822 LOG(INFO) << __FUNCTION__;
833 CHECK_INITIALIZED(); 823 CHECK_INITIALIZED();
834 824
835 bool isAvailable(0); 825 bool isAvailable(0);
836 826
837 if (_ptrAudioDevice->MicrophoneBoostIsAvailable(isAvailable) == -1) { 827 if (_ptrAudioDevice->MicrophoneBoostIsAvailable(isAvailable) == -1) {
838 return -1; 828 return -1;
839 } 829 }
840 830
841 *available = isAvailable; 831 *available = isAvailable;
842 832
843 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: available=%d", 833 LOG(INFO) << "output: available = " << *available;
844 *available);
845 return (0); 834 return (0);
846 } 835 }
847 836
848 // ---------------------------------------------------------------------------- 837 // ----------------------------------------------------------------------------
849 // SetMicrophoneBoost 838 // SetMicrophoneBoost
850 // ---------------------------------------------------------------------------- 839 // ----------------------------------------------------------------------------
851 840
852 int32_t AudioDeviceModuleImpl::SetMicrophoneBoost(bool enable) { 841 int32_t AudioDeviceModuleImpl::SetMicrophoneBoost(bool enable) {
842 LOG(INFO) << __FUNCTION__;
853 CHECK_INITIALIZED(); 843 CHECK_INITIALIZED();
854 return (_ptrAudioDevice->SetMicrophoneBoost(enable)); 844 return (_ptrAudioDevice->SetMicrophoneBoost(enable));
855 } 845 }
856 846
857 // ---------------------------------------------------------------------------- 847 // ----------------------------------------------------------------------------
858 // MicrophoneBoost 848 // MicrophoneBoost
859 // ---------------------------------------------------------------------------- 849 // ----------------------------------------------------------------------------
860 850
861 int32_t AudioDeviceModuleImpl::MicrophoneBoost(bool* enabled) const { 851 int32_t AudioDeviceModuleImpl::MicrophoneBoost(bool* enabled) const {
852 LOG(INFO) << __FUNCTION__;
862 CHECK_INITIALIZED(); 853 CHECK_INITIALIZED();
863 854
864 bool onOff(false); 855 bool onOff(false);
865 856
866 if (_ptrAudioDevice->MicrophoneBoost(onOff) == -1) { 857 if (_ptrAudioDevice->MicrophoneBoost(onOff) == -1) {
867 return -1; 858 return -1;
868 } 859 }
869 860
870 *enabled = onOff; 861 *enabled = onOff;
871 862
872 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: enabled=%u", 863 LOG(INFO) << "output: enabled = " << *enabled;
873 *enabled);
874 return (0); 864 return (0);
875 } 865 }
876 866
877 // ---------------------------------------------------------------------------- 867 // ----------------------------------------------------------------------------
878 // MicrophoneVolumeIsAvailable 868 // MicrophoneVolumeIsAvailable
879 // ---------------------------------------------------------------------------- 869 // ----------------------------------------------------------------------------
880 870
881 int32_t AudioDeviceModuleImpl::MicrophoneVolumeIsAvailable(bool* available) { 871 int32_t AudioDeviceModuleImpl::MicrophoneVolumeIsAvailable(bool* available) {
872 LOG(INFO) << __FUNCTION__;
882 CHECK_INITIALIZED(); 873 CHECK_INITIALIZED();
883 874
884 bool isAvailable(0); 875 bool isAvailable(0);
885 876
886 if (_ptrAudioDevice->MicrophoneVolumeIsAvailable(isAvailable) == -1) { 877 if (_ptrAudioDevice->MicrophoneVolumeIsAvailable(isAvailable) == -1) {
887 return -1; 878 return -1;
888 } 879 }
889 880
890 *available = isAvailable; 881 *available = isAvailable;
891 882
892 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: available=%d", 883 LOG(INFO) << "output: available = " << *available;
893 *available);
894 return (0); 884 return (0);
895 } 885 }
896 886
897 // ---------------------------------------------------------------------------- 887 // ----------------------------------------------------------------------------
898 // SetMicrophoneVolume 888 // SetMicrophoneVolume
899 // ---------------------------------------------------------------------------- 889 // ----------------------------------------------------------------------------
900 890
901 int32_t AudioDeviceModuleImpl::SetMicrophoneVolume(uint32_t volume) { 891 int32_t AudioDeviceModuleImpl::SetMicrophoneVolume(uint32_t volume) {
892 LOG(INFO) << __FUNCTION__;
902 CHECK_INITIALIZED(); 893 CHECK_INITIALIZED();
903 return (_ptrAudioDevice->SetMicrophoneVolume(volume)); 894 return (_ptrAudioDevice->SetMicrophoneVolume(volume));
904 } 895 }
905 896
906 // ---------------------------------------------------------------------------- 897 // ----------------------------------------------------------------------------
907 // MicrophoneVolume 898 // MicrophoneVolume
908 // ---------------------------------------------------------------------------- 899 // ----------------------------------------------------------------------------
909 900
910 int32_t AudioDeviceModuleImpl::MicrophoneVolume(uint32_t* volume) const { 901 int32_t AudioDeviceModuleImpl::MicrophoneVolume(uint32_t* volume) const {
911 WEBRTC_TRACE(kTraceStream, kTraceAudioDevice, _id, "%s", __FUNCTION__); 902 LOG(INFO) << __FUNCTION__;
912 CHECK_INITIALIZED(); 903 CHECK_INITIALIZED();
913 904
914 uint32_t level(0); 905 uint32_t level(0);
915 906
916 if (_ptrAudioDevice->MicrophoneVolume(level) == -1) { 907 if (_ptrAudioDevice->MicrophoneVolume(level) == -1) {
917 return -1; 908 return -1;
918 } 909 }
919 910
920 *volume = level; 911 *volume = level;
921 912
922 WEBRTC_TRACE(kTraceStream, kTraceAudioDevice, _id, "output: volume=%u", 913 LOG(INFO) << "output: volume = " << *volume;
923 *volume);
924 return (0); 914 return (0);
925 } 915 }
926 916
927 // ---------------------------------------------------------------------------- 917 // ----------------------------------------------------------------------------
928 // StereoRecordingIsAvailable 918 // StereoRecordingIsAvailable
929 // ---------------------------------------------------------------------------- 919 // ----------------------------------------------------------------------------
930 920
931 int32_t AudioDeviceModuleImpl::StereoRecordingIsAvailable( 921 int32_t AudioDeviceModuleImpl::StereoRecordingIsAvailable(
932 bool* available) const { 922 bool* available) const {
923 LOG(INFO) << __FUNCTION__;
933 CHECK_INITIALIZED(); 924 CHECK_INITIALIZED();
934 925
935 bool isAvailable(0); 926 bool isAvailable(0);
936 927
937 if (_ptrAudioDevice->StereoRecordingIsAvailable(isAvailable) == -1) { 928 if (_ptrAudioDevice->StereoRecordingIsAvailable(isAvailable) == -1) {
938 return -1; 929 return -1;
939 } 930 }
940 931
941 *available = isAvailable; 932 *available = isAvailable;
942 933
943 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: available=%d", 934 LOG(INFO) << "output: available = " << *available;
944 *available);
945 return (0); 935 return (0);
946 } 936 }
947 937
948 // ---------------------------------------------------------------------------- 938 // ----------------------------------------------------------------------------
949 // SetStereoRecording 939 // SetStereoRecording
950 // ---------------------------------------------------------------------------- 940 // ----------------------------------------------------------------------------
951 941
952 int32_t AudioDeviceModuleImpl::SetStereoRecording(bool enable) { 942 int32_t AudioDeviceModuleImpl::SetStereoRecording(bool enable) {
943 LOG(INFO) << __FUNCTION__;
953 CHECK_INITIALIZED(); 944 CHECK_INITIALIZED();
954 945
955 if (_ptrAudioDevice->RecordingIsInitialized()) { 946 if (_ptrAudioDevice->RecordingIsInitialized()) {
956 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, 947 LOG(WARNING) << "recording in stereo is not supported";
957 "recording in stereo is not supported");
958 return -1; 948 return -1;
959 } 949 }
960 950
961 if (_ptrAudioDevice->SetStereoRecording(enable) == -1) { 951 if (_ptrAudioDevice->SetStereoRecording(enable) == -1) {
962 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, 952 LOG(WARNING) << "failed to enable stereo recording";
963 "failed to enable stereo recording");
964 return -1; 953 return -1;
965 } 954 }
966 955
967 int8_t nChannels(1); 956 int8_t nChannels(1);
968 if (enable) { 957 if (enable) {
969 nChannels = 2; 958 nChannels = 2;
970 } 959 }
971 _audioDeviceBuffer.SetRecordingChannels(nChannels); 960 _audioDeviceBuffer.SetRecordingChannels(nChannels);
972 961
973 return 0; 962 return 0;
974 } 963 }
975 964
976 // ---------------------------------------------------------------------------- 965 // ----------------------------------------------------------------------------
977 // StereoRecording 966 // StereoRecording
978 // ---------------------------------------------------------------------------- 967 // ----------------------------------------------------------------------------
979 968
980 int32_t AudioDeviceModuleImpl::StereoRecording(bool* enabled) const { 969 int32_t AudioDeviceModuleImpl::StereoRecording(bool* enabled) const {
970 LOG(INFO) << __FUNCTION__;
981 CHECK_INITIALIZED(); 971 CHECK_INITIALIZED();
982 972
983 bool stereo(false); 973 bool stereo(false);
984 974
985 if (_ptrAudioDevice->StereoRecording(stereo) == -1) { 975 if (_ptrAudioDevice->StereoRecording(stereo) == -1) {
986 return -1; 976 return -1;
987 } 977 }
988 978
989 *enabled = stereo; 979 *enabled = stereo;
990 980
991 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: enabled=%u", 981 LOG(INFO) << "output: enabled = " << *enabled;
992 *enabled);
993 return (0); 982 return (0);
994 } 983 }
995 984
996 // ---------------------------------------------------------------------------- 985 // ----------------------------------------------------------------------------
997 // SetRecordingChannel 986 // SetRecordingChannel
998 // ---------------------------------------------------------------------------- 987 // ----------------------------------------------------------------------------
999 988
1000 int32_t AudioDeviceModuleImpl::SetRecordingChannel(const ChannelType channel) { 989 int32_t AudioDeviceModuleImpl::SetRecordingChannel(const ChannelType channel) {
1001 if (channel == kChannelBoth) { 990 if (channel == kChannelBoth) {
1002 } else if (channel == kChannelLeft) { 991 } else if (channel == kChannelLeft) {
1003 } else { 992 } else {
1004 } 993 }
994 LOG(INFO) << __FUNCTION__;
1005 CHECK_INITIALIZED(); 995 CHECK_INITIALIZED();
1006 996
1007 bool stereo(false); 997 bool stereo(false);
1008 998
1009 if (_ptrAudioDevice->StereoRecording(stereo) == -1) { 999 if (_ptrAudioDevice->StereoRecording(stereo) == -1) {
1010 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, 1000 LOG(WARNING) << "recording in stereo is not supported";
1011 "recording in stereo is not supported");
1012 return -1; 1001 return -1;
1013 } 1002 }
1014 1003
1015 return (_audioDeviceBuffer.SetRecordingChannel(channel)); 1004 return (_audioDeviceBuffer.SetRecordingChannel(channel));
1016 } 1005 }
1017 1006
1018 // ---------------------------------------------------------------------------- 1007 // ----------------------------------------------------------------------------
1019 // RecordingChannel 1008 // RecordingChannel
1020 // ---------------------------------------------------------------------------- 1009 // ----------------------------------------------------------------------------
1021 1010
1022 int32_t AudioDeviceModuleImpl::RecordingChannel(ChannelType* channel) const { 1011 int32_t AudioDeviceModuleImpl::RecordingChannel(ChannelType* channel) const {
1012 LOG(INFO) << __FUNCTION__;
1023 CHECK_INITIALIZED(); 1013 CHECK_INITIALIZED();
1024 1014
1025 ChannelType chType; 1015 ChannelType chType;
1026 1016
1027 if (_audioDeviceBuffer.RecordingChannel(chType) == -1) { 1017 if (_audioDeviceBuffer.RecordingChannel(chType) == -1) {
1028 return -1; 1018 return -1;
1029 } 1019 }
1030 1020
1031 *channel = chType; 1021 *channel = chType;
1032 1022
1033 if (*channel == kChannelBoth) { 1023 if (*channel == kChannelBoth) {
1034 } else if (*channel == kChannelLeft) { 1024 } else if (*channel == kChannelLeft) {
1035 } else { 1025 } else {
1036 } 1026 }
1037 1027
1038 return (0); 1028 return (0);
1039 } 1029 }
1040 1030
1041 // ---------------------------------------------------------------------------- 1031 // ----------------------------------------------------------------------------
1042 // StereoPlayoutIsAvailable 1032 // StereoPlayoutIsAvailable
1043 // ---------------------------------------------------------------------------- 1033 // ----------------------------------------------------------------------------
1044 1034
1045 int32_t AudioDeviceModuleImpl::StereoPlayoutIsAvailable(bool* available) const { 1035 int32_t AudioDeviceModuleImpl::StereoPlayoutIsAvailable(bool* available) const {
1036 LOG(INFO) << __FUNCTION__;
1046 CHECK_INITIALIZED(); 1037 CHECK_INITIALIZED();
1047 1038
1048 bool isAvailable(0); 1039 bool isAvailable(0);
1049 1040
1050 if (_ptrAudioDevice->StereoPlayoutIsAvailable(isAvailable) == -1) { 1041 if (_ptrAudioDevice->StereoPlayoutIsAvailable(isAvailable) == -1) {
1051 return -1; 1042 return -1;
1052 } 1043 }
1053 1044
1054 *available = isAvailable; 1045 *available = isAvailable;
1055 1046
1056 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: available=%d", 1047 LOG(INFO) << "output: available = " << *available;
1057 *available);
1058 return (0); 1048 return (0);
1059 } 1049 }
1060 1050
1061 // ---------------------------------------------------------------------------- 1051 // ----------------------------------------------------------------------------
1062 // SetStereoPlayout 1052 // SetStereoPlayout
1063 // ---------------------------------------------------------------------------- 1053 // ----------------------------------------------------------------------------
1064 1054
1065 int32_t AudioDeviceModuleImpl::SetStereoPlayout(bool enable) { 1055 int32_t AudioDeviceModuleImpl::SetStereoPlayout(bool enable) {
1056 LOG(INFO) << __FUNCTION__;
1066 CHECK_INITIALIZED(); 1057 CHECK_INITIALIZED();
1067 1058
1068 if (_ptrAudioDevice->PlayoutIsInitialized()) { 1059 if (_ptrAudioDevice->PlayoutIsInitialized()) {
1069 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, 1060 LOG(LERROR)
1070 "unable to set stereo mode while playing side is initialized"); 1061 << "unable to set stereo mode while playing side is initialized";
1071 return -1; 1062 return -1;
1072 } 1063 }
1073 1064
1074 if (_ptrAudioDevice->SetStereoPlayout(enable)) { 1065 if (_ptrAudioDevice->SetStereoPlayout(enable)) {
1075 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, 1066 LOG(WARNING) << "stereo playout is not supported";
1076 "stereo playout is not supported");
1077 return -1; 1067 return -1;
1078 } 1068 }
1079 1069
1080 int8_t nChannels(1); 1070 int8_t nChannels(1);
1081 if (enable) { 1071 if (enable) {
1082 nChannels = 2; 1072 nChannels = 2;
1083 } 1073 }
1084 _audioDeviceBuffer.SetPlayoutChannels(nChannels); 1074 _audioDeviceBuffer.SetPlayoutChannels(nChannels);
1085 1075
1086 return 0; 1076 return 0;
1087 } 1077 }
1088 1078
1089 // ---------------------------------------------------------------------------- 1079 // ----------------------------------------------------------------------------
1090 // StereoPlayout 1080 // StereoPlayout
1091 // ---------------------------------------------------------------------------- 1081 // ----------------------------------------------------------------------------
1092 1082
1093 int32_t AudioDeviceModuleImpl::StereoPlayout(bool* enabled) const { 1083 int32_t AudioDeviceModuleImpl::StereoPlayout(bool* enabled) const {
1084 LOG(INFO) << __FUNCTION__;
1094 CHECK_INITIALIZED(); 1085 CHECK_INITIALIZED();
1095 1086
1096 bool stereo(false); 1087 bool stereo(false);
1097 1088
1098 if (_ptrAudioDevice->StereoPlayout(stereo) == -1) { 1089 if (_ptrAudioDevice->StereoPlayout(stereo) == -1) {
1099 return -1; 1090 return -1;
1100 } 1091 }
1101 1092
1102 *enabled = stereo; 1093 *enabled = stereo;
1103 1094
1104 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: enabled=%u", 1095 LOG(INFO) << "output: enabled = " << *enabled;
1105 *enabled);
1106 return (0); 1096 return (0);
1107 } 1097 }
1108 1098
1109 // ---------------------------------------------------------------------------- 1099 // ----------------------------------------------------------------------------
1110 // SetAGC 1100 // SetAGC
1111 // ---------------------------------------------------------------------------- 1101 // ----------------------------------------------------------------------------
1112 1102
1113 int32_t AudioDeviceModuleImpl::SetAGC(bool enable) { 1103 int32_t AudioDeviceModuleImpl::SetAGC(bool enable) {
1104 LOG(INFO) << __FUNCTION__;
1114 CHECK_INITIALIZED(); 1105 CHECK_INITIALIZED();
1115 return (_ptrAudioDevice->SetAGC(enable)); 1106 return (_ptrAudioDevice->SetAGC(enable));
1116 } 1107 }
1117 1108
1118 // ---------------------------------------------------------------------------- 1109 // ----------------------------------------------------------------------------
1119 // AGC 1110 // AGC
1120 // ---------------------------------------------------------------------------- 1111 // ----------------------------------------------------------------------------
1121 1112
1122 bool AudioDeviceModuleImpl::AGC() const { 1113 bool AudioDeviceModuleImpl::AGC() const {
1114 LOG(INFO) << __FUNCTION__;
1123 CHECK_INITIALIZED_BOOL(); 1115 CHECK_INITIALIZED_BOOL();
1124 return (_ptrAudioDevice->AGC()); 1116 return (_ptrAudioDevice->AGC());
1125 } 1117 }
1126 1118
1127 // ---------------------------------------------------------------------------- 1119 // ----------------------------------------------------------------------------
1128 // PlayoutIsAvailable 1120 // PlayoutIsAvailable
1129 // ---------------------------------------------------------------------------- 1121 // ----------------------------------------------------------------------------
1130 1122
1131 int32_t AudioDeviceModuleImpl::PlayoutIsAvailable(bool* available) { 1123 int32_t AudioDeviceModuleImpl::PlayoutIsAvailable(bool* available) {
1124 LOG(INFO) << __FUNCTION__;
1132 CHECK_INITIALIZED(); 1125 CHECK_INITIALIZED();
1133 1126
1134 bool isAvailable(0); 1127 bool isAvailable(0);
1135 1128
1136 if (_ptrAudioDevice->PlayoutIsAvailable(isAvailable) == -1) { 1129 if (_ptrAudioDevice->PlayoutIsAvailable(isAvailable) == -1) {
1137 return -1; 1130 return -1;
1138 } 1131 }
1139 1132
1140 *available = isAvailable; 1133 *available = isAvailable;
1141 1134
1142 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: available=%d", 1135 LOG(INFO) << "output: available = " << *available;
1143 *available);
1144 return (0); 1136 return (0);
1145 } 1137 }
1146 1138
1147 // ---------------------------------------------------------------------------- 1139 // ----------------------------------------------------------------------------
1148 // RecordingIsAvailable 1140 // RecordingIsAvailable
1149 // ---------------------------------------------------------------------------- 1141 // ----------------------------------------------------------------------------
1150 1142
1151 int32_t AudioDeviceModuleImpl::RecordingIsAvailable(bool* available) { 1143 int32_t AudioDeviceModuleImpl::RecordingIsAvailable(bool* available) {
1144 LOG(INFO) << __FUNCTION__;
1152 CHECK_INITIALIZED(); 1145 CHECK_INITIALIZED();
1153 1146
1154 bool isAvailable(0); 1147 bool isAvailable(0);
1155 1148
1156 if (_ptrAudioDevice->RecordingIsAvailable(isAvailable) == -1) { 1149 if (_ptrAudioDevice->RecordingIsAvailable(isAvailable) == -1) {
1157 return -1; 1150 return -1;
1158 } 1151 }
1159 1152
1160 *available = isAvailable; 1153 *available = isAvailable;
1161 1154
1162 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: available=%d", 1155 LOG(INFO) << "output: available = " << *available;
1163 *available);
1164 return (0); 1156 return (0);
1165 } 1157 }
1166 1158
1167 // ---------------------------------------------------------------------------- 1159 // ----------------------------------------------------------------------------
1168 // MaxMicrophoneVolume 1160 // MaxMicrophoneVolume
1169 // ---------------------------------------------------------------------------- 1161 // ----------------------------------------------------------------------------
1170 1162
1171 int32_t AudioDeviceModuleImpl::MaxMicrophoneVolume(uint32_t* maxVolume) const { 1163 int32_t AudioDeviceModuleImpl::MaxMicrophoneVolume(uint32_t* maxVolume) const {
1172 WEBRTC_TRACE(kTraceStream, kTraceAudioDevice, _id, "%s", __FUNCTION__); 1164 LOG(INFO) << __FUNCTION__;
1173 CHECK_INITIALIZED(); 1165 CHECK_INITIALIZED();
1174 1166
1175 uint32_t maxVol(0); 1167 uint32_t maxVol(0);
1176 1168
1177 if (_ptrAudioDevice->MaxMicrophoneVolume(maxVol) == -1) { 1169 if (_ptrAudioDevice->MaxMicrophoneVolume(maxVol) == -1) {
1178 return -1; 1170 return -1;
1179 } 1171 }
1180 1172
1181 *maxVolume = maxVol; 1173 *maxVolume = maxVol;
1182 1174
1183 WEBRTC_TRACE(kTraceStream, kTraceAudioDevice, _id, "output: maxVolume=%d", 1175 LOG(INFO) << "output: maxVolume = " << *maxVolume;
1184 *maxVolume);
1185 return (0); 1176 return (0);
1186 } 1177 }
1187 1178
1188 // ---------------------------------------------------------------------------- 1179 // ----------------------------------------------------------------------------
1189 // MinMicrophoneVolume 1180 // MinMicrophoneVolume
1190 // ---------------------------------------------------------------------------- 1181 // ----------------------------------------------------------------------------
1191 1182
1192 int32_t AudioDeviceModuleImpl::MinMicrophoneVolume(uint32_t* minVolume) const { 1183 int32_t AudioDeviceModuleImpl::MinMicrophoneVolume(uint32_t* minVolume) const {
1184 LOG(INFO) << __FUNCTION__;
1193 CHECK_INITIALIZED(); 1185 CHECK_INITIALIZED();
1194 1186
1195 uint32_t minVol(0); 1187 uint32_t minVol(0);
1196 1188
1197 if (_ptrAudioDevice->MinMicrophoneVolume(minVol) == -1) { 1189 if (_ptrAudioDevice->MinMicrophoneVolume(minVol) == -1) {
1198 return -1; 1190 return -1;
1199 } 1191 }
1200 1192
1201 *minVolume = minVol; 1193 *minVolume = minVol;
1202 1194
1203 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: minVolume=%u", 1195 LOG(INFO) << "output: minVolume = " << *minVolume;
1204 *minVolume);
1205 return (0); 1196 return (0);
1206 } 1197 }
1207 1198
1208 // ---------------------------------------------------------------------------- 1199 // ----------------------------------------------------------------------------
1209 // MicrophoneVolumeStepSize 1200 // MicrophoneVolumeStepSize
1210 // ---------------------------------------------------------------------------- 1201 // ----------------------------------------------------------------------------
1211 1202
1212 int32_t AudioDeviceModuleImpl::MicrophoneVolumeStepSize( 1203 int32_t AudioDeviceModuleImpl::MicrophoneVolumeStepSize(
1213 uint16_t* stepSize) const { 1204 uint16_t* stepSize) const {
1205 LOG(INFO) << __FUNCTION__;
1214 CHECK_INITIALIZED(); 1206 CHECK_INITIALIZED();
1215 1207
1216 uint16_t delta(0); 1208 uint16_t delta(0);
1217 1209
1218 if (_ptrAudioDevice->MicrophoneVolumeStepSize(delta) == -1) { 1210 if (_ptrAudioDevice->MicrophoneVolumeStepSize(delta) == -1) {
1219 return -1; 1211 return -1;
1220 } 1212 }
1221 1213
1222 *stepSize = delta; 1214 *stepSize = delta;
1223 1215
1224 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: stepSize=%u", 1216 LOG(INFO) << "output: stepSize = " << *stepSize;
1225 *stepSize);
1226 return (0); 1217 return (0);
1227 } 1218 }
1228 1219
1229 // ---------------------------------------------------------------------------- 1220 // ----------------------------------------------------------------------------
1230 // PlayoutDevices 1221 // PlayoutDevices
1231 // ---------------------------------------------------------------------------- 1222 // ----------------------------------------------------------------------------
1232 1223
1233 int16_t AudioDeviceModuleImpl::PlayoutDevices() { 1224 int16_t AudioDeviceModuleImpl::PlayoutDevices() {
1225 LOG(INFO) << __FUNCTION__;
1234 CHECK_INITIALIZED(); 1226 CHECK_INITIALIZED();
1235 1227
1236 uint16_t nPlayoutDevices = _ptrAudioDevice->PlayoutDevices(); 1228 uint16_t nPlayoutDevices = _ptrAudioDevice->PlayoutDevices();
1237 1229
1238 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, 1230 LOG(INFO) << "output: #playout devices = " << nPlayoutDevices;
1239 "output: #playout devices=%d", nPlayoutDevices);
1240 return ((int16_t)(nPlayoutDevices)); 1231 return ((int16_t)(nPlayoutDevices));
1241 } 1232 }
1242 1233
1243 // ---------------------------------------------------------------------------- 1234 // ----------------------------------------------------------------------------
1244 // SetPlayoutDevice I (II) 1235 // SetPlayoutDevice I (II)
1245 // ---------------------------------------------------------------------------- 1236 // ----------------------------------------------------------------------------
1246 1237
1247 int32_t AudioDeviceModuleImpl::SetPlayoutDevice(uint16_t index) { 1238 int32_t AudioDeviceModuleImpl::SetPlayoutDevice(uint16_t index) {
1239 LOG(INFO) << __FUNCTION__;
1248 CHECK_INITIALIZED(); 1240 CHECK_INITIALIZED();
1249 return (_ptrAudioDevice->SetPlayoutDevice(index)); 1241 return (_ptrAudioDevice->SetPlayoutDevice(index));
1250 } 1242 }
1251 1243
1252 // ---------------------------------------------------------------------------- 1244 // ----------------------------------------------------------------------------
1253 // SetPlayoutDevice II (II) 1245 // SetPlayoutDevice II (II)
1254 // ---------------------------------------------------------------------------- 1246 // ----------------------------------------------------------------------------
1255 1247
1256 int32_t AudioDeviceModuleImpl::SetPlayoutDevice(WindowsDeviceType device) { 1248 int32_t AudioDeviceModuleImpl::SetPlayoutDevice(WindowsDeviceType device) {
1257 if (device == kDefaultDevice) { 1249 if (device == kDefaultDevice) {
1258 } else { 1250 } else {
1259 } 1251 }
1252 LOG(INFO) << __FUNCTION__;
1260 CHECK_INITIALIZED(); 1253 CHECK_INITIALIZED();
1261 1254
1262 return (_ptrAudioDevice->SetPlayoutDevice(device)); 1255 return (_ptrAudioDevice->SetPlayoutDevice(device));
1263 } 1256 }
1264 1257
1265 // ---------------------------------------------------------------------------- 1258 // ----------------------------------------------------------------------------
1266 // PlayoutDeviceName 1259 // PlayoutDeviceName
1267 // ---------------------------------------------------------------------------- 1260 // ----------------------------------------------------------------------------
1268 1261
1269 int32_t AudioDeviceModuleImpl::PlayoutDeviceName( 1262 int32_t AudioDeviceModuleImpl::PlayoutDeviceName(
1270 uint16_t index, 1263 uint16_t index,
1271 char name[kAdmMaxDeviceNameSize], 1264 char name[kAdmMaxDeviceNameSize],
1272 char guid[kAdmMaxGuidSize]) { 1265 char guid[kAdmMaxGuidSize]) {
1266 LOG(INFO) << __FUNCTION__;
1273 CHECK_INITIALIZED(); 1267 CHECK_INITIALIZED();
1274 1268
1275 if (name == NULL) { 1269 if (name == NULL) {
1276 _lastError = kAdmErrArgument; 1270 _lastError = kAdmErrArgument;
1277 return -1; 1271 return -1;
1278 } 1272 }
1279 1273
1280 if (_ptrAudioDevice->PlayoutDeviceName(index, name, guid) == -1) { 1274 if (_ptrAudioDevice->PlayoutDeviceName(index, name, guid) == -1) {
1281 return -1; 1275 return -1;
1282 } 1276 }
1283 1277
1284 if (name != NULL) { 1278 if (name != NULL) {
1285 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: name=%s", 1279 LOG(INFO) << "output: name = " << name;
1286 name);
1287 } 1280 }
1288 if (guid != NULL) { 1281 if (guid != NULL) {
1289 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: guid=%s", 1282 LOG(INFO) << "output: guid = " << guid;
1290 guid);
1291 } 1283 }
1292 1284
1293 return (0); 1285 return (0);
1294 } 1286 }
1295 1287
1296 // ---------------------------------------------------------------------------- 1288 // ----------------------------------------------------------------------------
1297 // RecordingDeviceName 1289 // RecordingDeviceName
1298 // ---------------------------------------------------------------------------- 1290 // ----------------------------------------------------------------------------
1299 1291
1300 int32_t AudioDeviceModuleImpl::RecordingDeviceName( 1292 int32_t AudioDeviceModuleImpl::RecordingDeviceName(
1301 uint16_t index, 1293 uint16_t index,
1302 char name[kAdmMaxDeviceNameSize], 1294 char name[kAdmMaxDeviceNameSize],
1303 char guid[kAdmMaxGuidSize]) { 1295 char guid[kAdmMaxGuidSize]) {
1296 LOG(INFO) << __FUNCTION__;
1304 CHECK_INITIALIZED(); 1297 CHECK_INITIALIZED();
1305 1298
1306 if (name == NULL) { 1299 if (name == NULL) {
1307 _lastError = kAdmErrArgument; 1300 _lastError = kAdmErrArgument;
1308 return -1; 1301 return -1;
1309 } 1302 }
1310 1303
1311 if (_ptrAudioDevice->RecordingDeviceName(index, name, guid) == -1) { 1304 if (_ptrAudioDevice->RecordingDeviceName(index, name, guid) == -1) {
1312 return -1; 1305 return -1;
1313 } 1306 }
1314 1307
1315 if (name != NULL) { 1308 if (name != NULL) {
1316 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: name=%s", 1309 LOG(INFO) << "output: name = " << name;
1317 name);
1318 } 1310 }
1319 if (guid != NULL) { 1311 if (guid != NULL) {
1320 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: guid=%s", 1312 LOG(INFO) << "output: guid = " << guid;
1321 guid);
1322 } 1313 }
1323 1314
1324 return (0); 1315 return (0);
1325 } 1316 }
1326 1317
1327 // ---------------------------------------------------------------------------- 1318 // ----------------------------------------------------------------------------
1328 // RecordingDevices 1319 // RecordingDevices
1329 // ---------------------------------------------------------------------------- 1320 // ----------------------------------------------------------------------------
1330 1321
1331 int16_t AudioDeviceModuleImpl::RecordingDevices() { 1322 int16_t AudioDeviceModuleImpl::RecordingDevices() {
1323 LOG(INFO) << __FUNCTION__;
1332 CHECK_INITIALIZED(); 1324 CHECK_INITIALIZED();
1333 1325
1334 uint16_t nRecordingDevices = _ptrAudioDevice->RecordingDevices(); 1326 uint16_t nRecordingDevices = _ptrAudioDevice->RecordingDevices();
1335 1327
1336 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, 1328 LOG(INFO) << "output: #recording devices = " << nRecordingDevices;
1337 "output: #recording devices=%d", nRecordingDevices);
1338 return ((int16_t)nRecordingDevices); 1329 return ((int16_t)nRecordingDevices);
1339 } 1330 }
1340 1331
1341 // ---------------------------------------------------------------------------- 1332 // ----------------------------------------------------------------------------
1342 // SetRecordingDevice I (II) 1333 // SetRecordingDevice I (II)
1343 // ---------------------------------------------------------------------------- 1334 // ----------------------------------------------------------------------------
1344 1335
1345 int32_t AudioDeviceModuleImpl::SetRecordingDevice(uint16_t index) { 1336 int32_t AudioDeviceModuleImpl::SetRecordingDevice(uint16_t index) {
1337 LOG(INFO) << __FUNCTION__;
1346 CHECK_INITIALIZED(); 1338 CHECK_INITIALIZED();
1347 return (_ptrAudioDevice->SetRecordingDevice(index)); 1339 return (_ptrAudioDevice->SetRecordingDevice(index));
1348 } 1340 }
1349 1341
1350 // ---------------------------------------------------------------------------- 1342 // ----------------------------------------------------------------------------
1351 // SetRecordingDevice II (II) 1343 // SetRecordingDevice II (II)
1352 // ---------------------------------------------------------------------------- 1344 // ----------------------------------------------------------------------------
1353 1345
1354 int32_t AudioDeviceModuleImpl::SetRecordingDevice(WindowsDeviceType device) { 1346 int32_t AudioDeviceModuleImpl::SetRecordingDevice(WindowsDeviceType device) {
1355 if (device == kDefaultDevice) { 1347 if (device == kDefaultDevice) {
1356 } else { 1348 } else {
1357 } 1349 }
1350 LOG(INFO) << __FUNCTION__;
1358 CHECK_INITIALIZED(); 1351 CHECK_INITIALIZED();
1359 1352
1360 return (_ptrAudioDevice->SetRecordingDevice(device)); 1353 return (_ptrAudioDevice->SetRecordingDevice(device));
1361 } 1354 }
1362 1355
1363 // ---------------------------------------------------------------------------- 1356 // ----------------------------------------------------------------------------
1364 // InitPlayout 1357 // InitPlayout
1365 // ---------------------------------------------------------------------------- 1358 // ----------------------------------------------------------------------------
1366 1359
1367 int32_t AudioDeviceModuleImpl::InitPlayout() { 1360 int32_t AudioDeviceModuleImpl::InitPlayout() {
1361 LOG(INFO) << __FUNCTION__;
1368 CHECK_INITIALIZED(); 1362 CHECK_INITIALIZED();
1369 _audioDeviceBuffer.InitPlayout(); 1363 _audioDeviceBuffer.InitPlayout();
1370 return (_ptrAudioDevice->InitPlayout()); 1364 return (_ptrAudioDevice->InitPlayout());
1371 } 1365 }
1372 1366
1373 // ---------------------------------------------------------------------------- 1367 // ----------------------------------------------------------------------------
1374 // InitRecording 1368 // InitRecording
1375 // ---------------------------------------------------------------------------- 1369 // ----------------------------------------------------------------------------
1376 1370
1377 int32_t AudioDeviceModuleImpl::InitRecording() { 1371 int32_t AudioDeviceModuleImpl::InitRecording() {
1378 TRACE_EVENT0("webrtc", "AudioDeviceModuleImpl::InitRecording"); 1372 LOG(INFO) << __FUNCTION__;
1379 CHECK_INITIALIZED(); 1373 CHECK_INITIALIZED();
1380 _audioDeviceBuffer.InitRecording(); 1374 _audioDeviceBuffer.InitRecording();
1381 return (_ptrAudioDevice->InitRecording()); 1375 return (_ptrAudioDevice->InitRecording());
1382 } 1376 }
1383 1377
1384 // ---------------------------------------------------------------------------- 1378 // ----------------------------------------------------------------------------
1385 // PlayoutIsInitialized 1379 // PlayoutIsInitialized
1386 // ---------------------------------------------------------------------------- 1380 // ----------------------------------------------------------------------------
1387 1381
1388 bool AudioDeviceModuleImpl::PlayoutIsInitialized() const { 1382 bool AudioDeviceModuleImpl::PlayoutIsInitialized() const {
1383 LOG(INFO) << __FUNCTION__;
1389 CHECK_INITIALIZED_BOOL(); 1384 CHECK_INITIALIZED_BOOL();
1390 return (_ptrAudioDevice->PlayoutIsInitialized()); 1385 return (_ptrAudioDevice->PlayoutIsInitialized());
1391 } 1386 }
1392 1387
1393 // ---------------------------------------------------------------------------- 1388 // ----------------------------------------------------------------------------
1394 // RecordingIsInitialized 1389 // RecordingIsInitialized
1395 // ---------------------------------------------------------------------------- 1390 // ----------------------------------------------------------------------------
1396 1391
1397 bool AudioDeviceModuleImpl::RecordingIsInitialized() const { 1392 bool AudioDeviceModuleImpl::RecordingIsInitialized() const {
1393 LOG(INFO) << __FUNCTION__;
1398 CHECK_INITIALIZED_BOOL(); 1394 CHECK_INITIALIZED_BOOL();
1399 return (_ptrAudioDevice->RecordingIsInitialized()); 1395 return (_ptrAudioDevice->RecordingIsInitialized());
1400 } 1396 }
1401 1397
1402 // ---------------------------------------------------------------------------- 1398 // ----------------------------------------------------------------------------
1403 // StartPlayout 1399 // StartPlayout
1404 // ---------------------------------------------------------------------------- 1400 // ----------------------------------------------------------------------------
1405 1401
1406 int32_t AudioDeviceModuleImpl::StartPlayout() { 1402 int32_t AudioDeviceModuleImpl::StartPlayout() {
1403 LOG(INFO) << __FUNCTION__;
1407 CHECK_INITIALIZED(); 1404 CHECK_INITIALIZED();
1408 return (_ptrAudioDevice->StartPlayout()); 1405 return (_ptrAudioDevice->StartPlayout());
1409 } 1406 }
1410 1407
1411 // ---------------------------------------------------------------------------- 1408 // ----------------------------------------------------------------------------
1412 // StopPlayout 1409 // StopPlayout
1413 // ---------------------------------------------------------------------------- 1410 // ----------------------------------------------------------------------------
1414 1411
1415 int32_t AudioDeviceModuleImpl::StopPlayout() { 1412 int32_t AudioDeviceModuleImpl::StopPlayout() {
1413 LOG(INFO) << __FUNCTION__;
1416 CHECK_INITIALIZED(); 1414 CHECK_INITIALIZED();
1417 return (_ptrAudioDevice->StopPlayout()); 1415 return (_ptrAudioDevice->StopPlayout());
1418 } 1416 }
1419 1417
1420 // ---------------------------------------------------------------------------- 1418 // ----------------------------------------------------------------------------
1421 // Playing 1419 // Playing
1422 // ---------------------------------------------------------------------------- 1420 // ----------------------------------------------------------------------------
1423 1421
1424 bool AudioDeviceModuleImpl::Playing() const { 1422 bool AudioDeviceModuleImpl::Playing() const {
1423 LOG(INFO) << __FUNCTION__;
1425 CHECK_INITIALIZED_BOOL(); 1424 CHECK_INITIALIZED_BOOL();
1426 return (_ptrAudioDevice->Playing()); 1425 return (_ptrAudioDevice->Playing());
1427 } 1426 }
1428 1427
1429 // ---------------------------------------------------------------------------- 1428 // ----------------------------------------------------------------------------
1430 // StartRecording 1429 // StartRecording
1431 // ---------------------------------------------------------------------------- 1430 // ----------------------------------------------------------------------------
1432 1431
1433 int32_t AudioDeviceModuleImpl::StartRecording() { 1432 int32_t AudioDeviceModuleImpl::StartRecording() {
1434 TRACE_EVENT0("webrtc", "AudioDeviceModuleImpl::StartRecording"); 1433 LOG(INFO) << __FUNCTION__;
1435 CHECK_INITIALIZED(); 1434 CHECK_INITIALIZED();
1436 return (_ptrAudioDevice->StartRecording()); 1435 return (_ptrAudioDevice->StartRecording());
1437 } 1436 }
1438 // ---------------------------------------------------------------------------- 1437 // ----------------------------------------------------------------------------
1439 // StopRecording 1438 // StopRecording
1440 // ---------------------------------------------------------------------------- 1439 // ----------------------------------------------------------------------------
1441 1440
1442 int32_t AudioDeviceModuleImpl::StopRecording() { 1441 int32_t AudioDeviceModuleImpl::StopRecording() {
1442 LOG(INFO) << __FUNCTION__;
1443 CHECK_INITIALIZED(); 1443 CHECK_INITIALIZED();
1444 return (_ptrAudioDevice->StopRecording()); 1444 return (_ptrAudioDevice->StopRecording());
1445 } 1445 }
1446 1446
1447 // ---------------------------------------------------------------------------- 1447 // ----------------------------------------------------------------------------
1448 // Recording 1448 // Recording
1449 // ---------------------------------------------------------------------------- 1449 // ----------------------------------------------------------------------------
1450 1450
1451 bool AudioDeviceModuleImpl::Recording() const { 1451 bool AudioDeviceModuleImpl::Recording() const {
1452 LOG(INFO) << __FUNCTION__;
1452 CHECK_INITIALIZED_BOOL(); 1453 CHECK_INITIALIZED_BOOL();
1453 return (_ptrAudioDevice->Recording()); 1454 return (_ptrAudioDevice->Recording());
1454 } 1455 }
1455 1456
1456 // ---------------------------------------------------------------------------- 1457 // ----------------------------------------------------------------------------
1457 // RegisterEventObserver 1458 // RegisterEventObserver
1458 // ---------------------------------------------------------------------------- 1459 // ----------------------------------------------------------------------------
1459 1460
1460 int32_t AudioDeviceModuleImpl::RegisterEventObserver( 1461 int32_t AudioDeviceModuleImpl::RegisterEventObserver(
1461 AudioDeviceObserver* eventCallback) { 1462 AudioDeviceObserver* eventCallback) {
1463 LOG(INFO) << __FUNCTION__;
1462 CriticalSectionScoped lock(&_critSectEventCb); 1464 CriticalSectionScoped lock(&_critSectEventCb);
1463 _ptrCbAudioDeviceObserver = eventCallback; 1465 _ptrCbAudioDeviceObserver = eventCallback;
1464 1466
1465 return 0; 1467 return 0;
1466 } 1468 }
1467 1469
1468 // ---------------------------------------------------------------------------- 1470 // ----------------------------------------------------------------------------
1469 // RegisterAudioCallback 1471 // RegisterAudioCallback
1470 // ---------------------------------------------------------------------------- 1472 // ----------------------------------------------------------------------------
1471 1473
1472 int32_t AudioDeviceModuleImpl::RegisterAudioCallback( 1474 int32_t AudioDeviceModuleImpl::RegisterAudioCallback(
1473 AudioTransport* audioCallback) { 1475 AudioTransport* audioCallback) {
1476 LOG(INFO) << __FUNCTION__;
1474 CriticalSectionScoped lock(&_critSectAudioCb); 1477 CriticalSectionScoped lock(&_critSectAudioCb);
1475 _audioDeviceBuffer.RegisterAudioCallback(audioCallback); 1478 _audioDeviceBuffer.RegisterAudioCallback(audioCallback);
1476 1479
1477 return 0; 1480 return 0;
1478 } 1481 }
1479 1482
1480 // ---------------------------------------------------------------------------- 1483 // ----------------------------------------------------------------------------
1481 // StartRawInputFileRecording 1484 // StartRawInputFileRecording
1482 // ---------------------------------------------------------------------------- 1485 // ----------------------------------------------------------------------------
1483 1486
1484 int32_t AudioDeviceModuleImpl::StartRawInputFileRecording( 1487 int32_t AudioDeviceModuleImpl::StartRawInputFileRecording(
1485 const char pcmFileNameUTF8[kAdmMaxFileNameSize]) { 1488 const char pcmFileNameUTF8[kAdmMaxFileNameSize]) {
1489 LOG(INFO) << __FUNCTION__;
1486 CHECK_INITIALIZED(); 1490 CHECK_INITIALIZED();
1487 1491
1488 if (NULL == pcmFileNameUTF8) { 1492 if (NULL == pcmFileNameUTF8) {
1489 return -1; 1493 return -1;
1490 } 1494 }
1491 1495
1492 return (_audioDeviceBuffer.StartInputFileRecording(pcmFileNameUTF8)); 1496 return (_audioDeviceBuffer.StartInputFileRecording(pcmFileNameUTF8));
1493 } 1497 }
1494 1498
1495 // ---------------------------------------------------------------------------- 1499 // ----------------------------------------------------------------------------
1496 // StopRawInputFileRecording 1500 // StopRawInputFileRecording
1497 // ---------------------------------------------------------------------------- 1501 // ----------------------------------------------------------------------------
1498 1502
1499 int32_t AudioDeviceModuleImpl::StopRawInputFileRecording() { 1503 int32_t AudioDeviceModuleImpl::StopRawInputFileRecording() {
1504 LOG(INFO) << __FUNCTION__;
1500 CHECK_INITIALIZED(); 1505 CHECK_INITIALIZED();
1501 1506
1502 return (_audioDeviceBuffer.StopInputFileRecording()); 1507 return (_audioDeviceBuffer.StopInputFileRecording());
1503 } 1508 }
1504 1509
1505 // ---------------------------------------------------------------------------- 1510 // ----------------------------------------------------------------------------
1506 // StartRawOutputFileRecording 1511 // StartRawOutputFileRecording
1507 // ---------------------------------------------------------------------------- 1512 // ----------------------------------------------------------------------------
1508 1513
1509 int32_t AudioDeviceModuleImpl::StartRawOutputFileRecording( 1514 int32_t AudioDeviceModuleImpl::StartRawOutputFileRecording(
1510 const char pcmFileNameUTF8[kAdmMaxFileNameSize]) { 1515 const char pcmFileNameUTF8[kAdmMaxFileNameSize]) {
1516 LOG(INFO) << __FUNCTION__;
1511 CHECK_INITIALIZED(); 1517 CHECK_INITIALIZED();
1512 1518
1513 if (NULL == pcmFileNameUTF8) { 1519 if (NULL == pcmFileNameUTF8) {
1514 return -1; 1520 return -1;
1515 } 1521 }
1516 1522
1517 return (_audioDeviceBuffer.StartOutputFileRecording(pcmFileNameUTF8)); 1523 return (_audioDeviceBuffer.StartOutputFileRecording(pcmFileNameUTF8));
1518 } 1524 }
1519 1525
1520 // ---------------------------------------------------------------------------- 1526 // ----------------------------------------------------------------------------
1521 // StopRawOutputFileRecording 1527 // StopRawOutputFileRecording
1522 // ---------------------------------------------------------------------------- 1528 // ----------------------------------------------------------------------------
1523 1529
1524 int32_t AudioDeviceModuleImpl::StopRawOutputFileRecording() { 1530 int32_t AudioDeviceModuleImpl::StopRawOutputFileRecording() {
1531 LOG(INFO) << __FUNCTION__;
1525 CHECK_INITIALIZED(); 1532 CHECK_INITIALIZED();
1526 1533
1527 return (_audioDeviceBuffer.StopOutputFileRecording()); 1534 return (_audioDeviceBuffer.StopOutputFileRecording());
1528 } 1535 }
1529 1536
1530 // ---------------------------------------------------------------------------- 1537 // ----------------------------------------------------------------------------
1531 // SetPlayoutBuffer 1538 // SetPlayoutBuffer
1532 // ---------------------------------------------------------------------------- 1539 // ----------------------------------------------------------------------------
1533 1540
1534 int32_t AudioDeviceModuleImpl::SetPlayoutBuffer(const BufferType type, 1541 int32_t AudioDeviceModuleImpl::SetPlayoutBuffer(const BufferType type,
1535 uint16_t sizeMS) { 1542 uint16_t sizeMS) {
1543 LOG(INFO) << __FUNCTION__;
1536 CHECK_INITIALIZED(); 1544 CHECK_INITIALIZED();
1537 1545
1538 if (_ptrAudioDevice->PlayoutIsInitialized()) { 1546 if (_ptrAudioDevice->PlayoutIsInitialized()) {
1539 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, 1547 LOG(LERROR) << "unable to modify the playout buffer while playing side is "
1540 "unable to modify the playout buffer while playing side is " 1548 "initialized";
1541 "initialized");
1542 return -1; 1549 return -1;
1543 } 1550 }
1544 1551
1545 int32_t ret(0); 1552 int32_t ret(0);
1546 1553
1547 if (kFixedBufferSize == type) { 1554 if (kFixedBufferSize == type) {
1548 if (sizeMS < kAdmMinPlayoutBufferSizeMs || 1555 if (sizeMS < kAdmMinPlayoutBufferSizeMs ||
1549 sizeMS > kAdmMaxPlayoutBufferSizeMs) { 1556 sizeMS > kAdmMaxPlayoutBufferSizeMs) {
1550 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, 1557 LOG(LERROR) << "size parameter is out of range";
1551 "size parameter is out of range");
1552 return -1; 1558 return -1;
1553 } 1559 }
1554 } 1560 }
1555 1561
1556 if ((ret = _ptrAudioDevice->SetPlayoutBuffer(type, sizeMS)) == -1) { 1562 if ((ret = _ptrAudioDevice->SetPlayoutBuffer(type, sizeMS)) == -1) {
1557 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, 1563 LOG(LERROR) << "failed to set the playout buffer (error: " << LastError()
1558 "failed to set the playout buffer (error: %d)", LastError()); 1564 << ")";
1559 } 1565 }
1560 1566
1561 return ret; 1567 return ret;
1562 } 1568 }
1563 1569
1564 // ---------------------------------------------------------------------------- 1570 // ----------------------------------------------------------------------------
1565 // PlayoutBuffer 1571 // PlayoutBuffer
1566 // ---------------------------------------------------------------------------- 1572 // ----------------------------------------------------------------------------
1567 1573
1568 int32_t AudioDeviceModuleImpl::PlayoutBuffer(BufferType* type, 1574 int32_t AudioDeviceModuleImpl::PlayoutBuffer(BufferType* type,
1569 uint16_t* sizeMS) const { 1575 uint16_t* sizeMS) const {
1576 LOG(INFO) << __FUNCTION__;
1570 CHECK_INITIALIZED(); 1577 CHECK_INITIALIZED();
1571 1578
1572 BufferType bufType; 1579 BufferType bufType;
1573 uint16_t size(0); 1580 uint16_t size(0);
1574 1581
1575 if (_ptrAudioDevice->PlayoutBuffer(bufType, size) == -1) { 1582 if (_ptrAudioDevice->PlayoutBuffer(bufType, size) == -1) {
1576 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, 1583 LOG(LERROR) << "failed to retrieve the buffer type and size";
1577 "failed to retrieve the buffer type and size");
1578 return -1; 1584 return -1;
1579 } 1585 }
1580 1586
1581 *type = bufType; 1587 *type = bufType;
1582 *sizeMS = size; 1588 *sizeMS = size;
1583 1589
1584 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, 1590 LOG(INFO) << "output: type = " << *type << ", sizeMS = " << *sizeMS;
1585 "output: type=%u, sizeMS=%u", *type, *sizeMS);
1586 return (0); 1591 return (0);
1587 } 1592 }
1588 1593
1589 // ---------------------------------------------------------------------------- 1594 // ----------------------------------------------------------------------------
1590 // PlayoutDelay 1595 // PlayoutDelay
1591 // ---------------------------------------------------------------------------- 1596 // ----------------------------------------------------------------------------
1592 1597
1593 int32_t AudioDeviceModuleImpl::PlayoutDelay(uint16_t* delayMS) const { 1598 int32_t AudioDeviceModuleImpl::PlayoutDelay(uint16_t* delayMS) const {
1594 WEBRTC_TRACE(kTraceStream, kTraceAudioDevice, _id, "%s", __FUNCTION__); 1599 LOG(LS_VERBOSE) << __FUNCTION__;
1595 CHECK_INITIALIZED(); 1600 CHECK_INITIALIZED();
1596 1601
1597 uint16_t delay(0); 1602 uint16_t delay(0);
1598 1603
1599 if (_ptrAudioDevice->PlayoutDelay(delay) == -1) { 1604 if (_ptrAudioDevice->PlayoutDelay(delay) == -1) {
1600 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, 1605 LOG(LERROR) << "failed to retrieve the playout delay";
1601 "failed to retrieve the playout delay");
1602 return -1; 1606 return -1;
1603 } 1607 }
1604 1608
1605 *delayMS = delay; 1609 *delayMS = delay;
1606 1610
1607 WEBRTC_TRACE(kTraceStream, kTraceAudioDevice, _id, "output: delayMS=%u", 1611 LOG(LS_VERBOSE) << "output: delayMS = " << *delayMS;
1608 *delayMS);
1609 return (0); 1612 return (0);
1610 } 1613 }
1611 1614
1612 // ---------------------------------------------------------------------------- 1615 // ----------------------------------------------------------------------------
1613 // RecordingDelay 1616 // RecordingDelay
1614 // ---------------------------------------------------------------------------- 1617 // ----------------------------------------------------------------------------
1615 1618
1616 int32_t AudioDeviceModuleImpl::RecordingDelay(uint16_t* delayMS) const { 1619 int32_t AudioDeviceModuleImpl::RecordingDelay(uint16_t* delayMS) const {
1617 WEBRTC_TRACE(kTraceStream, kTraceAudioDevice, _id, "%s", __FUNCTION__); 1620 LOG(INFO) << __FUNCTION__;
1618 CHECK_INITIALIZED(); 1621 CHECK_INITIALIZED();
1619 1622
1620 uint16_t delay(0); 1623 uint16_t delay(0);
1621 1624
1622 if (_ptrAudioDevice->RecordingDelay(delay) == -1) { 1625 if (_ptrAudioDevice->RecordingDelay(delay) == -1) {
1623 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, 1626 LOG(LERROR) << "failed to retrieve the recording delay";
1624 "failed to retrieve the recording delay");
1625 return -1; 1627 return -1;
1626 } 1628 }
1627 1629
1628 *delayMS = delay; 1630 *delayMS = delay;
1629 1631
1630 WEBRTC_TRACE(kTraceStream, kTraceAudioDevice, _id, "output: delayMS=%u", 1632 LOG(INFO) << "output: delayMS = " << *delayMS;
1631 *delayMS);
1632 return (0); 1633 return (0);
1633 } 1634 }
1634 1635
1635 // ---------------------------------------------------------------------------- 1636 // ----------------------------------------------------------------------------
1636 // CPULoad 1637 // CPULoad
1637 // ---------------------------------------------------------------------------- 1638 // ----------------------------------------------------------------------------
1638 1639
1639 int32_t AudioDeviceModuleImpl::CPULoad(uint16_t* load) const { 1640 int32_t AudioDeviceModuleImpl::CPULoad(uint16_t* load) const {
1641 LOG(INFO) << __FUNCTION__;
1640 CHECK_INITIALIZED(); 1642 CHECK_INITIALIZED();
1641 1643
1642 uint16_t cpuLoad(0); 1644 uint16_t cpuLoad(0);
1643 1645
1644 if (_ptrAudioDevice->CPULoad(cpuLoad) == -1) { 1646 if (_ptrAudioDevice->CPULoad(cpuLoad) == -1) {
1645 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, 1647 LOG(LERROR) << "failed to retrieve the CPU load";
1646 "failed to retrieve the CPU load");
1647 return -1; 1648 return -1;
1648 } 1649 }
1649 1650
1650 *load = cpuLoad; 1651 *load = cpuLoad;
1651 1652
1652 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: load=%u", 1653 LOG(INFO) << "output: load = " << *load;
1653 *load);
1654 return (0); 1654 return (0);
1655 } 1655 }
1656 1656
1657 // ---------------------------------------------------------------------------- 1657 // ----------------------------------------------------------------------------
1658 // SetRecordingSampleRate 1658 // SetRecordingSampleRate
1659 // ---------------------------------------------------------------------------- 1659 // ----------------------------------------------------------------------------
1660 1660
1661 int32_t AudioDeviceModuleImpl::SetRecordingSampleRate( 1661 int32_t AudioDeviceModuleImpl::SetRecordingSampleRate(
1662 const uint32_t samplesPerSec) { 1662 const uint32_t samplesPerSec) {
1663 LOG(INFO) << __FUNCTION__;
1663 CHECK_INITIALIZED(); 1664 CHECK_INITIALIZED();
1664 1665
1665 if (_ptrAudioDevice->SetRecordingSampleRate(samplesPerSec) != 0) { 1666 if (_ptrAudioDevice->SetRecordingSampleRate(samplesPerSec) != 0) {
1666 return -1; 1667 return -1;
1667 } 1668 }
1668 1669
1669 return (0); 1670 return (0);
1670 } 1671 }
1671 1672
1672 // ---------------------------------------------------------------------------- 1673 // ----------------------------------------------------------------------------
1673 // RecordingSampleRate 1674 // RecordingSampleRate
1674 // ---------------------------------------------------------------------------- 1675 // ----------------------------------------------------------------------------
1675 1676
1676 int32_t AudioDeviceModuleImpl::RecordingSampleRate( 1677 int32_t AudioDeviceModuleImpl::RecordingSampleRate(
1677 uint32_t* samplesPerSec) const { 1678 uint32_t* samplesPerSec) const {
1679 LOG(INFO) << __FUNCTION__;
1678 CHECK_INITIALIZED(); 1680 CHECK_INITIALIZED();
1679 1681
1680 int32_t sampleRate = _audioDeviceBuffer.RecordingSampleRate(); 1682 int32_t sampleRate = _audioDeviceBuffer.RecordingSampleRate();
1681 1683
1682 if (sampleRate == -1) { 1684 if (sampleRate == -1) {
1683 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, 1685 LOG(LERROR) << "failed to retrieve the sample rate";
1684 "failed to retrieve the sample rate");
1685 return -1; 1686 return -1;
1686 } 1687 }
1687 1688
1688 *samplesPerSec = sampleRate; 1689 *samplesPerSec = sampleRate;
1689 1690
1690 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, 1691 LOG(INFO) << "output: samplesPerSec = " << *samplesPerSec;
1691 "output: samplesPerSec=%u", *samplesPerSec);
1692 return (0); 1692 return (0);
1693 } 1693 }
1694 1694
1695 // ---------------------------------------------------------------------------- 1695 // ----------------------------------------------------------------------------
1696 // SetPlayoutSampleRate 1696 // SetPlayoutSampleRate
1697 // ---------------------------------------------------------------------------- 1697 // ----------------------------------------------------------------------------
1698 1698
1699 int32_t AudioDeviceModuleImpl::SetPlayoutSampleRate( 1699 int32_t AudioDeviceModuleImpl::SetPlayoutSampleRate(
1700 const uint32_t samplesPerSec) { 1700 const uint32_t samplesPerSec) {
1701 LOG(INFO) << __FUNCTION__;
1701 CHECK_INITIALIZED(); 1702 CHECK_INITIALIZED();
1702 1703
1703 if (_ptrAudioDevice->SetPlayoutSampleRate(samplesPerSec) != 0) { 1704 if (_ptrAudioDevice->SetPlayoutSampleRate(samplesPerSec) != 0) {
1704 return -1; 1705 return -1;
1705 } 1706 }
1706 1707
1707 return (0); 1708 return (0);
1708 } 1709 }
1709 1710
1710 // ---------------------------------------------------------------------------- 1711 // ----------------------------------------------------------------------------
1711 // PlayoutSampleRate 1712 // PlayoutSampleRate
1712 // ---------------------------------------------------------------------------- 1713 // ----------------------------------------------------------------------------
1713 1714
1714 int32_t AudioDeviceModuleImpl::PlayoutSampleRate( 1715 int32_t AudioDeviceModuleImpl::PlayoutSampleRate(
1715 uint32_t* samplesPerSec) const { 1716 uint32_t* samplesPerSec) const {
1717 LOG(INFO) << __FUNCTION__;
1716 CHECK_INITIALIZED(); 1718 CHECK_INITIALIZED();
1717 1719
1718 int32_t sampleRate = _audioDeviceBuffer.PlayoutSampleRate(); 1720 int32_t sampleRate = _audioDeviceBuffer.PlayoutSampleRate();
1719 1721
1720 if (sampleRate == -1) { 1722 if (sampleRate == -1) {
1721 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, 1723 LOG(LERROR) << "failed to retrieve the sample rate";
1722 "failed to retrieve the sample rate");
1723 return -1; 1724 return -1;
1724 } 1725 }
1725 1726
1726 *samplesPerSec = sampleRate; 1727 *samplesPerSec = sampleRate;
1727 1728
1728 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, 1729 LOG(INFO) << "output: samplesPerSec = " << *samplesPerSec;
1729 "output: samplesPerSec=%u", *samplesPerSec);
1730 return (0); 1730 return (0);
1731 } 1731 }
1732 1732
1733 // ---------------------------------------------------------------------------- 1733 // ----------------------------------------------------------------------------
1734 // ResetAudioDevice 1734 // ResetAudioDevice
1735 // ---------------------------------------------------------------------------- 1735 // ----------------------------------------------------------------------------
1736 1736
1737 int32_t AudioDeviceModuleImpl::ResetAudioDevice() { 1737 int32_t AudioDeviceModuleImpl::ResetAudioDevice() {
1738 LOG(INFO) << __FUNCTION__;
1738 CHECK_INITIALIZED(); 1739 CHECK_INITIALIZED();
1739 1740
1740 if (_ptrAudioDevice->ResetAudioDevice() == -1) { 1741 if (_ptrAudioDevice->ResetAudioDevice() == -1) {
1741 return -1; 1742 return -1;
1742 } 1743 }
1743 1744
1744 return (0); 1745 return (0);
1745 } 1746 }
1746 1747
1747 // ---------------------------------------------------------------------------- 1748 // ----------------------------------------------------------------------------
1748 // SetLoudspeakerStatus 1749 // SetLoudspeakerStatus
1749 // ---------------------------------------------------------------------------- 1750 // ----------------------------------------------------------------------------
1750 1751
1751 int32_t AudioDeviceModuleImpl::SetLoudspeakerStatus(bool enable) { 1752 int32_t AudioDeviceModuleImpl::SetLoudspeakerStatus(bool enable) {
1753 LOG(INFO) << __FUNCTION__;
1752 CHECK_INITIALIZED(); 1754 CHECK_INITIALIZED();
1753 1755
1754 if (_ptrAudioDevice->SetLoudspeakerStatus(enable) != 0) { 1756 if (_ptrAudioDevice->SetLoudspeakerStatus(enable) != 0) {
1755 return -1; 1757 return -1;
1756 } 1758 }
1757 1759
1758 return 0; 1760 return 0;
1759 } 1761 }
1760 1762
1761 // ---------------------------------------------------------------------------- 1763 // ----------------------------------------------------------------------------
1762 // GetLoudspeakerStatus 1764 // GetLoudspeakerStatus
1763 // ---------------------------------------------------------------------------- 1765 // ----------------------------------------------------------------------------
1764 1766
1765 int32_t AudioDeviceModuleImpl::GetLoudspeakerStatus(bool* enabled) const { 1767 int32_t AudioDeviceModuleImpl::GetLoudspeakerStatus(bool* enabled) const {
1768 LOG(INFO) << __FUNCTION__;
henrika_webrtc 2016/06/27 07:42:54 Please log the result as well. Same for all below.
Max Morin WebRTC 2016/06/27 13:05:47 Done.
1766 CHECK_INITIALIZED(); 1769 CHECK_INITIALIZED();
1767 if (_ptrAudioDevice->GetLoudspeakerStatus(*enabled) != 0) { 1770 if (_ptrAudioDevice->GetLoudspeakerStatus(*enabled) != 0) {
1768 return -1; 1771 return -1;
1769 } 1772 }
1770 return 0; 1773 return 0;
1771 } 1774 }
1772 1775
1773 bool AudioDeviceModuleImpl::BuiltInAECIsEnabled() const { 1776 bool AudioDeviceModuleImpl::BuiltInAECIsEnabled() const {
1777 LOG(INFO) << __FUNCTION__;
1774 CHECK_INITIALIZED_BOOL(); 1778 CHECK_INITIALIZED_BOOL();
1775 return _ptrAudioDevice->BuiltInAECIsEnabled(); 1779 return _ptrAudioDevice->BuiltInAECIsEnabled();
1776 } 1780 }
1777 1781
1778 bool AudioDeviceModuleImpl::BuiltInAECIsAvailable() const { 1782 bool AudioDeviceModuleImpl::BuiltInAECIsAvailable() const {
1783 LOG(INFO) << __FUNCTION__;
1779 CHECK_INITIALIZED_BOOL(); 1784 CHECK_INITIALIZED_BOOL();
1780 return _ptrAudioDevice->BuiltInAECIsAvailable(); 1785 return _ptrAudioDevice->BuiltInAECIsAvailable();
1781 } 1786 }
1782 1787
1783 int32_t AudioDeviceModuleImpl::EnableBuiltInAEC(bool enable) { 1788 int32_t AudioDeviceModuleImpl::EnableBuiltInAEC(bool enable) {
1789 LOG(INFO) << __FUNCTION__;
1784 CHECK_INITIALIZED(); 1790 CHECK_INITIALIZED();
1785 return _ptrAudioDevice->EnableBuiltInAEC(enable); 1791 return _ptrAudioDevice->EnableBuiltInAEC(enable);
1786 } 1792 }
1787 1793
1788 bool AudioDeviceModuleImpl::BuiltInAGCIsAvailable() const { 1794 bool AudioDeviceModuleImpl::BuiltInAGCIsAvailable() const {
1795 LOG(INFO) << __FUNCTION__;
1789 CHECK_INITIALIZED_BOOL(); 1796 CHECK_INITIALIZED_BOOL();
1790 return _ptrAudioDevice->BuiltInAGCIsAvailable(); 1797 return _ptrAudioDevice->BuiltInAGCIsAvailable();
1791 } 1798 }
1792 1799
1793 int32_t AudioDeviceModuleImpl::EnableBuiltInAGC(bool enable) { 1800 int32_t AudioDeviceModuleImpl::EnableBuiltInAGC(bool enable) {
1801 LOG(INFO) << __FUNCTION__;
1794 CHECK_INITIALIZED(); 1802 CHECK_INITIALIZED();
1795 return _ptrAudioDevice->EnableBuiltInAGC(enable); 1803 return _ptrAudioDevice->EnableBuiltInAGC(enable);
1796 } 1804 }
1797 1805
1798 bool AudioDeviceModuleImpl::BuiltInNSIsAvailable() const { 1806 bool AudioDeviceModuleImpl::BuiltInNSIsAvailable() const {
1807 LOG(INFO) << __FUNCTION__;
1799 CHECK_INITIALIZED_BOOL(); 1808 CHECK_INITIALIZED_BOOL();
1800 return _ptrAudioDevice->BuiltInNSIsAvailable(); 1809 return _ptrAudioDevice->BuiltInNSIsAvailable();
1801 } 1810 }
1802 1811
1803 int32_t AudioDeviceModuleImpl::EnableBuiltInNS(bool enable) { 1812 int32_t AudioDeviceModuleImpl::EnableBuiltInNS(bool enable) {
1813 LOG(INFO) << __FUNCTION__;
1804 CHECK_INITIALIZED(); 1814 CHECK_INITIALIZED();
1805 return _ptrAudioDevice->EnableBuiltInNS(enable); 1815 return _ptrAudioDevice->EnableBuiltInNS(enable);
1806 } 1816 }
1807 1817
1808 int AudioDeviceModuleImpl::GetPlayoutAudioParameters( 1818 int AudioDeviceModuleImpl::GetPlayoutAudioParameters(
1809 AudioParameters* params) const { 1819 AudioParameters* params) const {
1820 LOG(INFO) << __FUNCTION__;
1810 return _ptrAudioDevice->GetPlayoutAudioParameters(params); 1821 return _ptrAudioDevice->GetPlayoutAudioParameters(params);
1811 } 1822 }
1812 1823
1813 int AudioDeviceModuleImpl::GetRecordAudioParameters( 1824 int AudioDeviceModuleImpl::GetRecordAudioParameters(
1814 AudioParameters* params) const { 1825 AudioParameters* params) const {
1826 LOG(INFO) << __FUNCTION__;
1815 return _ptrAudioDevice->GetRecordAudioParameters(params); 1827 return _ptrAudioDevice->GetRecordAudioParameters(params);
1816 } 1828 }
1817 1829
1818 // ============================================================================ 1830 // ============================================================================
1819 // Private Methods 1831 // Private Methods
1820 // ============================================================================ 1832 // ============================================================================
1821 1833
1822 // ---------------------------------------------------------------------------- 1834 // ----------------------------------------------------------------------------
1823 // Platform 1835 // Platform
1824 // ---------------------------------------------------------------------------- 1836 // ----------------------------------------------------------------------------
1825 1837
1826 AudioDeviceModuleImpl::PlatformType AudioDeviceModuleImpl::Platform() const { 1838 AudioDeviceModuleImpl::PlatformType AudioDeviceModuleImpl::Platform() const {
1839 LOG(INFO) << __FUNCTION__;
1827 return _platformType; 1840 return _platformType;
1828 } 1841 }
1829 1842
1830 // ---------------------------------------------------------------------------- 1843 // ----------------------------------------------------------------------------
1831 // PlatformAudioLayer 1844 // PlatformAudioLayer
1832 // ---------------------------------------------------------------------------- 1845 // ----------------------------------------------------------------------------
1833 1846
1834 AudioDeviceModule::AudioLayer AudioDeviceModuleImpl::PlatformAudioLayer() 1847 AudioDeviceModule::AudioLayer AudioDeviceModuleImpl::PlatformAudioLayer()
1835 const { 1848 const {
1849 LOG(INFO) << __FUNCTION__;
1836 return _platformAudioLayer; 1850 return _platformAudioLayer;
1837 } 1851 }
1838 1852
1839 } // namespace webrtc 1853 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698