blob: af3724d9cbd038df304e7611d69176ea22393bed [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
xians@webrtc.org20aabbb2012-02-20 09:17:41 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#include "modules/audio_device/audio_device_impl.h"
henrika4af73662017-10-11 13:16:17 +020012
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020013#include "modules/audio_device/audio_device_config.h"
14#include "modules/audio_device/audio_device_generic.h"
15#include "rtc_base/checks.h"
16#include "rtc_base/logging.h"
17#include "rtc_base/refcount.h"
Niels Möller84255bb2017-10-06 13:43:23 +020018#include "rtc_base/refcountedobject.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020019#include "system_wrappers/include/metrics.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000020
niklase@google.com470e71d2011-07-07 08:21:25 +000021#if defined(_WIN32)
Max Morin787eeed2016-06-23 10:42:07 +020022#if defined(WEBRTC_WINDOWS_CORE_AUDIO_BUILD)
henrika883d00f2018-03-16 10:09:49 +010023#include "modules/audio_device/win/audio_device_core_win.h"
Max Morin787eeed2016-06-23 10:42:07 +020024#endif
leozwang@google.com39f20512011-07-15 16:29:40 +000025#elif defined(WEBRTC_ANDROID)
henrikab2619892015-05-18 16:49:16 +020026#include <stdlib.h>
henrika883d00f2018-03-16 10:09:49 +010027#if defined(AUDIO_DEVICE_INCLUDE_ANDROID_AAUDIO)
28#include "modules/audio_device/android/aaudio_player.h"
29#include "modules/audio_device/android/aaudio_recorder.h"
30#endif
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020031#include "modules/audio_device/android/audio_device_template.h"
32#include "modules/audio_device/android/audio_manager.h"
33#include "modules/audio_device/android/audio_record_jni.h"
34#include "modules/audio_device/android/audio_track_jni.h"
35#include "modules/audio_device/android/opensles_player.h"
36#include "modules/audio_device/android/opensles_recorder.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000037#elif defined(WEBRTC_LINUX)
Max Morin787eeed2016-06-23 10:42:07 +020038#if defined(LINUX_ALSA)
henrika883d00f2018-03-16 10:09:49 +010039#include "modules/audio_device/linux/audio_device_alsa_linux.h"
Max Morin787eeed2016-06-23 10:42:07 +020040#endif
Tommi68898a22015-05-19 17:28:07 +020041#if defined(LINUX_PULSE)
henrika883d00f2018-03-16 10:09:49 +010042#include "modules/audio_device/linux/audio_device_pulse_linux.h"
Tommi68898a22015-05-19 17:28:07 +020043#endif
sjlee@webrtc.org414fa7f2012-09-11 17:25:46 +000044#elif defined(WEBRTC_IOS)
henrika883d00f2018-03-16 10:09:49 +010045#include "modules/audio_device/ios/audio_device_ios.h"
andrew@webrtc.orgf3b65db2012-09-06 18:17:00 +000046#elif defined(WEBRTC_MAC)
henrika883d00f2018-03-16 10:09:49 +010047#include "modules/audio_device/mac/audio_device_mac.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000048#endif
phoglund@webrtc.org8454ad12014-06-11 14:12:04 +000049#if defined(WEBRTC_DUMMY_FILE_DEVICES)
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020050#include "modules/audio_device/dummy/file_audio_device_factory.h"
phoglund@webrtc.org8454ad12014-06-11 14:12:04 +000051#endif
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020052#include "modules/audio_device/dummy/audio_device_dummy.h"
53#include "modules/audio_device/dummy/file_audio_device.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000054
henrika4af73662017-10-11 13:16:17 +020055#define CHECKinitialized_() \
Max Morin787eeed2016-06-23 10:42:07 +020056 { \
henrika4af73662017-10-11 13:16:17 +020057 if (!initialized_) { \
Max Morin787eeed2016-06-23 10:42:07 +020058 return -1; \
henrika883d00f2018-03-16 10:09:49 +010059 } \
Max Morin787eeed2016-06-23 10:42:07 +020060 }
niklase@google.com470e71d2011-07-07 08:21:25 +000061
henrika4af73662017-10-11 13:16:17 +020062#define CHECKinitialized__BOOL() \
Max Morin787eeed2016-06-23 10:42:07 +020063 { \
henrika4af73662017-10-11 13:16:17 +020064 if (!initialized_) { \
Max Morin787eeed2016-06-23 10:42:07 +020065 return false; \
henrika883d00f2018-03-16 10:09:49 +010066 } \
Max Morin787eeed2016-06-23 10:42:07 +020067 }
niklase@google.com470e71d2011-07-07 08:21:25 +000068
Peter Boström1d194412016-03-21 16:44:31 +010069namespace webrtc {
henrike@webrtc.org70efc322012-02-23 17:45:33 +000070
henrika4af73662017-10-11 13:16:17 +020071// static
Peter Boström4adbbcf2016-05-03 15:51:26 -040072rtc::scoped_refptr<AudioDeviceModule> AudioDeviceModule::Create(
Peter Boström4adbbcf2016-05-03 15:51:26 -040073 const AudioLayer audio_layer) {
Mirko Bonadei675513b2017-11-09 11:09:25 +010074 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +020075 // Create the generic reference counted (platform independent) implementation.
Max Morin787eeed2016-06-23 10:42:07 +020076 rtc::scoped_refptr<AudioDeviceModuleImpl> audioDevice(
henrika5ff64832017-10-11 15:14:51 +020077 new rtc::RefCountedObject<AudioDeviceModuleImpl>(audio_layer));
niklase@google.com470e71d2011-07-07 08:21:25 +000078
Max Morin787eeed2016-06-23 10:42:07 +020079 // Ensure that the current platform is supported.
80 if (audioDevice->CheckPlatform() == -1) {
81 return nullptr;
82 }
niklase@google.com470e71d2011-07-07 08:21:25 +000083
Max Morin787eeed2016-06-23 10:42:07 +020084 // Create the platform-dependent implementation.
85 if (audioDevice->CreatePlatformSpecificObjects() == -1) {
86 return nullptr;
87 }
niklase@google.com470e71d2011-07-07 08:21:25 +000088
henrika4af73662017-10-11 13:16:17 +020089 // Ensure that the generic audio buffer can communicate with the platform
90 // specific parts.
Max Morin787eeed2016-06-23 10:42:07 +020091 if (audioDevice->AttachAudioBuffer() == -1) {
92 return nullptr;
93 }
niklase@google.com470e71d2011-07-07 08:21:25 +000094
Max Morin787eeed2016-06-23 10:42:07 +020095 return audioDevice;
niklase@google.com470e71d2011-07-07 08:21:25 +000096}
97
henrika616e3132017-11-13 12:47:59 +010098// TODO(bugs.webrtc.org/7306): deprecated.
99rtc::scoped_refptr<AudioDeviceModule> AudioDeviceModule::Create(
100 const int32_t id,
101 const AudioLayer audio_layer) {
102 RTC_LOG(INFO) << __FUNCTION__;
103 return AudioDeviceModule::Create(audio_layer);
104}
105
henrika5ff64832017-10-11 15:14:51 +0200106AudioDeviceModuleImpl::AudioDeviceModuleImpl(const AudioLayer audioLayer)
107 : audio_layer_(audioLayer) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100108 RTC_LOG(INFO) << __FUNCTION__;
niklase@google.com470e71d2011-07-07 08:21:25 +0000109}
110
Max Morin787eeed2016-06-23 10:42:07 +0200111int32_t AudioDeviceModuleImpl::CheckPlatform() {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100112 RTC_LOG(INFO) << __FUNCTION__;
Max Morin787eeed2016-06-23 10:42:07 +0200113 // Ensure that the current platform is supported
Max Morin787eeed2016-06-23 10:42:07 +0200114 PlatformType platform(kPlatformNotSupported);
niklase@google.com470e71d2011-07-07 08:21:25 +0000115#if defined(_WIN32)
Max Morin787eeed2016-06-23 10:42:07 +0200116 platform = kPlatformWin32;
Mirko Bonadei675513b2017-11-09 11:09:25 +0100117 RTC_LOG(INFO) << "current platform is Win32";
leozwang@google.com522f42b2011-09-19 17:39:05 +0000118#elif defined(WEBRTC_ANDROID)
Max Morin787eeed2016-06-23 10:42:07 +0200119 platform = kPlatformAndroid;
Mirko Bonadei675513b2017-11-09 11:09:25 +0100120 RTC_LOG(INFO) << "current platform is Android";
niklase@google.com470e71d2011-07-07 08:21:25 +0000121#elif defined(WEBRTC_LINUX)
Max Morin787eeed2016-06-23 10:42:07 +0200122 platform = kPlatformLinux;
Mirko Bonadei675513b2017-11-09 11:09:25 +0100123 RTC_LOG(INFO) << "current platform is Linux";
sjlee@webrtc.org414fa7f2012-09-11 17:25:46 +0000124#elif defined(WEBRTC_IOS)
Max Morin787eeed2016-06-23 10:42:07 +0200125 platform = kPlatformIOS;
Mirko Bonadei675513b2017-11-09 11:09:25 +0100126 RTC_LOG(INFO) << "current platform is IOS";
andrew@webrtc.orgf3b65db2012-09-06 18:17:00 +0000127#elif defined(WEBRTC_MAC)
Max Morin787eeed2016-06-23 10:42:07 +0200128 platform = kPlatformMac;
Mirko Bonadei675513b2017-11-09 11:09:25 +0100129 RTC_LOG(INFO) << "current platform is Mac";
niklase@google.com470e71d2011-07-07 08:21:25 +0000130#endif
Max Morin787eeed2016-06-23 10:42:07 +0200131 if (platform == kPlatformNotSupported) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100132 RTC_LOG(LERROR)
133 << "current platform is not supported => this module will self "
134 "destruct!";
Max Morin787eeed2016-06-23 10:42:07 +0200135 return -1;
136 }
henrika4af73662017-10-11 13:16:17 +0200137 platform_type_ = platform;
Max Morin787eeed2016-06-23 10:42:07 +0200138 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000139}
140
Max Morin787eeed2016-06-23 10:42:07 +0200141int32_t AudioDeviceModuleImpl::CreatePlatformSpecificObjects() {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100142 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200143// Dummy ADM implementations if build flags are set.
xians@google.combf5d2ba2011-08-16 07:44:19 +0000144#if defined(WEBRTC_DUMMY_AUDIO_BUILD)
henrika5ff64832017-10-11 15:14:51 +0200145 audio_device_.reset(new AudioDeviceDummy());
Mirko Bonadei675513b2017-11-09 11:09:25 +0100146 RTC_LOG(INFO) << "Dummy Audio APIs will be utilized";
phoglund@webrtc.org8454ad12014-06-11 14:12:04 +0000147#elif defined(WEBRTC_DUMMY_FILE_DEVICES)
henrika5ff64832017-10-11 15:14:51 +0200148 audio_device_.reset(FileAudioDeviceFactory::CreateFileAudioDevice());
henrika4af73662017-10-11 13:16:17 +0200149 if (audio_device_) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100150 RTC_LOG(INFO) << "Will use file-playing dummy device.";
noahric6a355902016-08-17 15:19:50 -0700151 } else {
152 // Create a dummy device instead.
henrika5ff64832017-10-11 15:14:51 +0200153 audio_device_.reset(new AudioDeviceDummy());
Mirko Bonadei675513b2017-11-09 11:09:25 +0100154 RTC_LOG(INFO) << "Dummy Audio APIs will be utilized";
noahric6a355902016-08-17 15:19:50 -0700155 }
henrika4af73662017-10-11 13:16:17 +0200156
157// Real (non-dummy) ADM implementations.
xians@google.combf5d2ba2011-08-16 07:44:19 +0000158#else
henrika4af73662017-10-11 13:16:17 +0200159 AudioLayer audio_layer(PlatformAudioLayer());
160// Windows ADM implementation.
niklase@google.com470e71d2011-07-07 08:21:25 +0000161#if defined(WEBRTC_WINDOWS_CORE_AUDIO_BUILD)
henrika4af73662017-10-11 13:16:17 +0200162 if ((audio_layer == kWindowsCoreAudio) ||
163 (audio_layer == kPlatformDefaultAudio)) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100164 RTC_LOG(INFO) << "Attempting to use the Windows Core Audio APIs...";
Max Morin787eeed2016-06-23 10:42:07 +0200165 if (AudioDeviceWindowsCore::CoreAudioIsSupported()) {
henrika4af73662017-10-11 13:16:17 +0200166 audio_device_.reset(new AudioDeviceWindowsCore());
Mirko Bonadei675513b2017-11-09 11:09:25 +0100167 RTC_LOG(INFO) << "Windows Core Audio APIs will be utilized";
niklase@google.com470e71d2011-07-07 08:21:25 +0000168 }
Max Morin787eeed2016-06-23 10:42:07 +0200169 }
170#endif // defined(WEBRTC_WINDOWS_CORE_AUDIO_BUILD)
niklase@google.com470e71d2011-07-07 08:21:25 +0000171
henrike@webrtc.org9ee75e92013-12-11 21:42:44 +0000172#if defined(WEBRTC_ANDROID)
Max Morin787eeed2016-06-23 10:42:07 +0200173 // Create an Android audio manager.
henrika4af73662017-10-11 13:16:17 +0200174 audio_manager_android_.reset(new AudioManager());
Max Morin787eeed2016-06-23 10:42:07 +0200175 // Select best possible combination of audio layers.
henrika4af73662017-10-11 13:16:17 +0200176 if (audio_layer == kPlatformDefaultAudio) {
henrika883d00f2018-03-16 10:09:49 +0100177 if (audio_manager_android_->IsAAudioSupported()) {
178 // Use of AAudio for both playout and recording has highest priority.
179 audio_layer = kAndroidAAudioAudio;
180 } else if (audio_manager_android_->IsLowLatencyPlayoutSupported() &&
181 audio_manager_android_->IsLowLatencyRecordSupported()) {
henrika918b5542016-09-19 15:44:09 +0200182 // Use OpenSL ES for both playout and recording.
henrika4af73662017-10-11 13:16:17 +0200183 audio_layer = kAndroidOpenSLESAudio;
184 } else if (audio_manager_android_->IsLowLatencyPlayoutSupported() &&
185 !audio_manager_android_->IsLowLatencyRecordSupported()) {
henrika918b5542016-09-19 15:44:09 +0200186 // Use OpenSL ES for output on devices that only supports the
Max Morin787eeed2016-06-23 10:42:07 +0200187 // low-latency output audio path.
henrika4af73662017-10-11 13:16:17 +0200188 audio_layer = kAndroidJavaInputAndOpenSLESOutputAudio;
henrikab2619892015-05-18 16:49:16 +0200189 } else {
henrika918b5542016-09-19 15:44:09 +0200190 // Use Java-based audio in both directions when low-latency output is
191 // not supported.
henrika4af73662017-10-11 13:16:17 +0200192 audio_layer = kAndroidJavaAudio;
niklase@google.com470e71d2011-07-07 08:21:25 +0000193 }
Max Morin787eeed2016-06-23 10:42:07 +0200194 }
henrika4af73662017-10-11 13:16:17 +0200195 AudioManager* audio_manager = audio_manager_android_.get();
196 if (audio_layer == kAndroidJavaAudio) {
Max Morin787eeed2016-06-23 10:42:07 +0200197 // Java audio for both input and output audio.
henrika4af73662017-10-11 13:16:17 +0200198 audio_device_.reset(new AudioDeviceTemplate<AudioRecordJni, AudioTrackJni>(
199 audio_layer, audio_manager));
200 } else if (audio_layer == kAndroidOpenSLESAudio) {
henrika918b5542016-09-19 15:44:09 +0200201 // OpenSL ES based audio for both input and output audio.
henrika4af73662017-10-11 13:16:17 +0200202 audio_device_.reset(
203 new AudioDeviceTemplate<OpenSLESRecorder, OpenSLESPlayer>(
204 audio_layer, audio_manager));
205 } else if (audio_layer == kAndroidJavaInputAndOpenSLESOutputAudio) {
Max Morin787eeed2016-06-23 10:42:07 +0200206 // Java audio for input and OpenSL ES for output audio (i.e. mixed APIs).
207 // This combination provides low-latency output audio and at the same
208 // time support for HW AEC using the AudioRecord Java API.
henrika4af73662017-10-11 13:16:17 +0200209 audio_device_.reset(new AudioDeviceTemplate<AudioRecordJni, OpenSLESPlayer>(
210 audio_layer, audio_manager));
henrika883d00f2018-03-16 10:09:49 +0100211 } else if (audio_layer == kAndroidAAudioAudio) {
212#if defined(AUDIO_DEVICE_INCLUDE_ANDROID_AAUDIO)
213 // AAudio based audio for both input and output.
214 audio_device_.reset(new AudioDeviceTemplate<AAudioRecorder, AAudioPlayer>(
215 audio_layer, audio_manager));
216#endif
217 } else if (audio_layer == kAndroidJavaInputAndAAudioOutputAudio) {
218#if defined(AUDIO_DEVICE_INCLUDE_ANDROID_AAUDIO)
219 // Java audio for input and AAudio for output audio (i.e. mixed APIs).
220 audio_device_.reset(new AudioDeviceTemplate<AudioRecordJni, AAudioPlayer>(
221 audio_layer, audio_manager));
222#endif
Max Morin787eeed2016-06-23 10:42:07 +0200223 } else {
henrika883d00f2018-03-16 10:09:49 +0100224 RTC_LOG(LS_ERROR) << "The requested audio layer is not supported";
henrika4af73662017-10-11 13:16:17 +0200225 audio_device_.reset(nullptr);
Max Morin787eeed2016-06-23 10:42:07 +0200226 }
227// END #if defined(WEBRTC_ANDROID)
niklase@google.com470e71d2011-07-07 08:21:25 +0000228
henrika4af73662017-10-11 13:16:17 +0200229// Linux ADM implementation.
niklase@google.com470e71d2011-07-07 08:21:25 +0000230#elif defined(WEBRTC_LINUX)
henrika4af73662017-10-11 13:16:17 +0200231 if ((audio_layer == kLinuxPulseAudio) ||
232 (audio_layer == kPlatformDefaultAudio)) {
niklase@google.com470e71d2011-07-07 08:21:25 +0000233#if defined(LINUX_PULSE)
Mirko Bonadei675513b2017-11-09 11:09:25 +0100234 RTC_LOG(INFO) << "Attempting to use Linux PulseAudio APIs...";
henrika4af73662017-10-11 13:16:17 +0200235 // Linux PulseAudio implementation.
236 audio_device_.reset(new AudioDeviceLinuxPulse());
Mirko Bonadei675513b2017-11-09 11:09:25 +0100237 RTC_LOG(INFO) << "Linux PulseAudio APIs will be utilized";
niklase@google.com470e71d2011-07-07 08:21:25 +0000238#endif
239#if defined(LINUX_PULSE)
Max Morin787eeed2016-06-23 10:42:07 +0200240#endif
henrika4af73662017-10-11 13:16:17 +0200241 } else if (audio_layer == kLinuxAlsaAudio) {
niklase@google.com470e71d2011-07-07 08:21:25 +0000242#if defined(LINUX_ALSA)
henrika4af73662017-10-11 13:16:17 +0200243 // Linux ALSA implementation.
244 audio_device_.reset(new AudioDeviceLinuxALSA());
Mirko Bonadei675513b2017-11-09 11:09:25 +0100245 RTC_LOG(INFO) << "Linux ALSA APIs will be utilized.";
niklase@google.com470e71d2011-07-07 08:21:25 +0000246#endif
Max Morin787eeed2016-06-23 10:42:07 +0200247 }
niklase@google.com470e71d2011-07-07 08:21:25 +0000248#endif // #if defined(WEBRTC_LINUX)
249
henrika4af73662017-10-11 13:16:17 +0200250// iOS ADM implementation.
sjlee@webrtc.org414fa7f2012-09-11 17:25:46 +0000251#if defined(WEBRTC_IOS)
henrika4af73662017-10-11 13:16:17 +0200252 if (audio_layer == kPlatformDefaultAudio) {
253 audio_device_.reset(new AudioDeviceIOS());
Mirko Bonadei675513b2017-11-09 11:09:25 +0100254 RTC_LOG(INFO) << "iPhone Audio APIs will be utilized.";
Max Morin787eeed2016-06-23 10:42:07 +0200255 }
256// END #if defined(WEBRTC_IOS)
niklase@google.com470e71d2011-07-07 08:21:25 +0000257
henrika4af73662017-10-11 13:16:17 +0200258// Mac OS X ADM implementation.
andrew@webrtc.orgf3b65db2012-09-06 18:17:00 +0000259#elif defined(WEBRTC_MAC)
henrika4af73662017-10-11 13:16:17 +0200260 if (audio_layer == kPlatformDefaultAudio) {
261 audio_device_.reset(new AudioDeviceMac());
Mirko Bonadei675513b2017-11-09 11:09:25 +0100262 RTC_LOG(INFO) << "Mac OS X Audio APIs will be utilized.";
Max Morin787eeed2016-06-23 10:42:07 +0200263 }
andrew@webrtc.orgf3b65db2012-09-06 18:17:00 +0000264#endif // WEBRTC_MAC
niklase@google.com470e71d2011-07-07 08:21:25 +0000265
henrika4af73662017-10-11 13:16:17 +0200266 // Dummy ADM implementation.
267 if (audio_layer == kDummyAudio) {
henrika5ff64832017-10-11 15:14:51 +0200268 audio_device_.reset(new AudioDeviceDummy());
Mirko Bonadei675513b2017-11-09 11:09:25 +0100269 RTC_LOG(INFO) << "Dummy Audio APIs will be utilized.";
Max Morin787eeed2016-06-23 10:42:07 +0200270 }
xians@google.combf5d2ba2011-08-16 07:44:19 +0000271#endif // if defined(WEBRTC_DUMMY_AUDIO_BUILD)
niklase@google.com470e71d2011-07-07 08:21:25 +0000272
henrika4af73662017-10-11 13:16:17 +0200273 if (!audio_device_) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100274 RTC_LOG(LS_ERROR)
henrika4af73662017-10-11 13:16:17 +0200275 << "Failed to create the platform specific ADM implementation.";
Max Morin787eeed2016-06-23 10:42:07 +0200276 return -1;
277 }
Max Morin787eeed2016-06-23 10:42:07 +0200278 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000279}
280
Max Morin787eeed2016-06-23 10:42:07 +0200281int32_t AudioDeviceModuleImpl::AttachAudioBuffer() {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100282 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200283 audio_device_->AttachAudioBuffer(&audio_device_buffer_);
Max Morin787eeed2016-06-23 10:42:07 +0200284 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000285}
286
Max Morin787eeed2016-06-23 10:42:07 +0200287AudioDeviceModuleImpl::~AudioDeviceModuleImpl() {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100288 RTC_LOG(INFO) << __FUNCTION__;
niklase@google.com470e71d2011-07-07 08:21:25 +0000289}
290
henrikab2619892015-05-18 16:49:16 +0200291int32_t AudioDeviceModuleImpl::ActiveAudioLayer(AudioLayer* audioLayer) const {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100292 RTC_LOG(INFO) << __FUNCTION__;
henrikab2619892015-05-18 16:49:16 +0200293 AudioLayer activeAudio;
henrika4af73662017-10-11 13:16:17 +0200294 if (audio_device_->ActiveAudioLayer(activeAudio) == -1) {
henrikab2619892015-05-18 16:49:16 +0200295 return -1;
296 }
297 *audioLayer = activeAudio;
298 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000299}
300
Max Morin787eeed2016-06-23 10:42:07 +0200301int32_t AudioDeviceModuleImpl::Init() {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100302 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200303 if (initialized_)
niklase@google.com470e71d2011-07-07 08:21:25 +0000304 return 0;
henrika4af73662017-10-11 13:16:17 +0200305 RTC_CHECK(audio_device_);
306 AudioDeviceGeneric::InitStatus status = audio_device_->Init();
Max Morin84cab202016-07-01 13:35:19 +0200307 RTC_HISTOGRAM_ENUMERATION(
308 "WebRTC.Audio.InitializationResult", static_cast<int>(status),
309 static_cast<int>(AudioDeviceGeneric::InitStatus::NUM_STATUSES));
310 if (status != AudioDeviceGeneric::InitStatus::OK) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100311 RTC_LOG(LS_ERROR) << "Audio device initialization failed.";
Max Morin787eeed2016-06-23 10:42:07 +0200312 return -1;
313 }
henrika4af73662017-10-11 13:16:17 +0200314 initialized_ = true;
Max Morin787eeed2016-06-23 10:42:07 +0200315 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000316}
317
Max Morin787eeed2016-06-23 10:42:07 +0200318int32_t AudioDeviceModuleImpl::Terminate() {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100319 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200320 if (!initialized_)
niklase@google.com470e71d2011-07-07 08:21:25 +0000321 return 0;
henrika4af73662017-10-11 13:16:17 +0200322 if (audio_device_->Terminate() == -1) {
Max Morin787eeed2016-06-23 10:42:07 +0200323 return -1;
324 }
henrika4af73662017-10-11 13:16:17 +0200325 initialized_ = false;
Max Morin787eeed2016-06-23 10:42:07 +0200326 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000327}
328
Max Morin787eeed2016-06-23 10:42:07 +0200329bool AudioDeviceModuleImpl::Initialized() const {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100330 RTC_LOG(INFO) << __FUNCTION__ << ": " << initialized_;
henrika4af73662017-10-11 13:16:17 +0200331 return initialized_;
niklase@google.com470e71d2011-07-07 08:21:25 +0000332}
333
Max Morin787eeed2016-06-23 10:42:07 +0200334int32_t AudioDeviceModuleImpl::InitSpeaker() {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100335 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200336 CHECKinitialized_();
337 return audio_device_->InitSpeaker();
niklase@google.com470e71d2011-07-07 08:21:25 +0000338}
339
Max Morin787eeed2016-06-23 10:42:07 +0200340int32_t AudioDeviceModuleImpl::InitMicrophone() {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100341 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200342 CHECKinitialized_();
343 return audio_device_->InitMicrophone();
niklase@google.com470e71d2011-07-07 08:21:25 +0000344}
345
Max Morin787eeed2016-06-23 10:42:07 +0200346int32_t AudioDeviceModuleImpl::SpeakerVolumeIsAvailable(bool* available) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100347 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200348 CHECKinitialized_();
349 bool isAvailable = false;
350 if (audio_device_->SpeakerVolumeIsAvailable(isAvailable) == -1) {
Max Morin787eeed2016-06-23 10:42:07 +0200351 return -1;
352 }
Max Morin787eeed2016-06-23 10:42:07 +0200353 *available = isAvailable;
Mirko Bonadei675513b2017-11-09 11:09:25 +0100354 RTC_LOG(INFO) << "output: " << isAvailable;
henrika4af73662017-10-11 13:16:17 +0200355 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000356}
357
Max Morin787eeed2016-06-23 10:42:07 +0200358int32_t AudioDeviceModuleImpl::SetSpeakerVolume(uint32_t volume) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100359 RTC_LOG(INFO) << __FUNCTION__ << "(" << volume << ")";
henrika4af73662017-10-11 13:16:17 +0200360 CHECKinitialized_();
361 return audio_device_->SetSpeakerVolume(volume);
niklase@google.com470e71d2011-07-07 08:21:25 +0000362}
363
Max Morin787eeed2016-06-23 10:42:07 +0200364int32_t AudioDeviceModuleImpl::SpeakerVolume(uint32_t* volume) const {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100365 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200366 CHECKinitialized_();
367 uint32_t level = 0;
368 if (audio_device_->SpeakerVolume(level) == -1) {
Max Morin787eeed2016-06-23 10:42:07 +0200369 return -1;
370 }
Max Morin787eeed2016-06-23 10:42:07 +0200371 *volume = level;
Mirko Bonadei675513b2017-11-09 11:09:25 +0100372 RTC_LOG(INFO) << "output: " << *volume;
henrika4af73662017-10-11 13:16:17 +0200373 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000374}
375
Max Morin787eeed2016-06-23 10:42:07 +0200376bool AudioDeviceModuleImpl::SpeakerIsInitialized() const {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100377 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200378 CHECKinitialized__BOOL();
379 bool isInitialized = audio_device_->SpeakerIsInitialized();
Mirko Bonadei675513b2017-11-09 11:09:25 +0100380 RTC_LOG(INFO) << "output: " << isInitialized;
henrika4af73662017-10-11 13:16:17 +0200381 return isInitialized;
niklase@google.com470e71d2011-07-07 08:21:25 +0000382}
383
Max Morin787eeed2016-06-23 10:42:07 +0200384bool AudioDeviceModuleImpl::MicrophoneIsInitialized() const {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100385 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200386 CHECKinitialized__BOOL();
387 bool isInitialized = audio_device_->MicrophoneIsInitialized();
Mirko Bonadei675513b2017-11-09 11:09:25 +0100388 RTC_LOG(INFO) << "output: " << isInitialized;
henrika4af73662017-10-11 13:16:17 +0200389 return isInitialized;
niklase@google.com470e71d2011-07-07 08:21:25 +0000390}
391
Max Morin787eeed2016-06-23 10:42:07 +0200392int32_t AudioDeviceModuleImpl::MaxSpeakerVolume(uint32_t* maxVolume) const {
henrika4af73662017-10-11 13:16:17 +0200393 CHECKinitialized_();
394 uint32_t maxVol = 0;
395 if (audio_device_->MaxSpeakerVolume(maxVol) == -1) {
Max Morin787eeed2016-06-23 10:42:07 +0200396 return -1;
397 }
Max Morin787eeed2016-06-23 10:42:07 +0200398 *maxVolume = maxVol;
henrika4af73662017-10-11 13:16:17 +0200399 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000400}
401
Max Morin787eeed2016-06-23 10:42:07 +0200402int32_t AudioDeviceModuleImpl::MinSpeakerVolume(uint32_t* minVolume) const {
henrika4af73662017-10-11 13:16:17 +0200403 CHECKinitialized_();
404 uint32_t minVol = 0;
405 if (audio_device_->MinSpeakerVolume(minVol) == -1) {
Max Morin787eeed2016-06-23 10:42:07 +0200406 return -1;
407 }
Max Morin787eeed2016-06-23 10:42:07 +0200408 *minVolume = minVol;
henrika4af73662017-10-11 13:16:17 +0200409 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000410}
411
Max Morin787eeed2016-06-23 10:42:07 +0200412int32_t AudioDeviceModuleImpl::SpeakerMuteIsAvailable(bool* available) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100413 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200414 CHECKinitialized_();
Mirko Bonadei72c42502017-11-09 09:33:23 +0100415 bool isAvailable = false;
henrika4af73662017-10-11 13:16:17 +0200416 if (audio_device_->SpeakerMuteIsAvailable(isAvailable) == -1) {
Max Morin787eeed2016-06-23 10:42:07 +0200417 return -1;
418 }
Max Morin787eeed2016-06-23 10:42:07 +0200419 *available = isAvailable;
Mirko Bonadei675513b2017-11-09 11:09:25 +0100420 RTC_LOG(INFO) << "output: " << isAvailable;
henrika4af73662017-10-11 13:16:17 +0200421 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000422}
423
Max Morin787eeed2016-06-23 10:42:07 +0200424int32_t AudioDeviceModuleImpl::SetSpeakerMute(bool enable) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100425 RTC_LOG(INFO) << __FUNCTION__ << "(" << enable << ")";
henrika4af73662017-10-11 13:16:17 +0200426 CHECKinitialized_();
427 return audio_device_->SetSpeakerMute(enable);
niklase@google.com470e71d2011-07-07 08:21:25 +0000428}
429
Max Morin787eeed2016-06-23 10:42:07 +0200430int32_t AudioDeviceModuleImpl::SpeakerMute(bool* enabled) const {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100431 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200432 CHECKinitialized_();
433 bool muted = false;
434 if (audio_device_->SpeakerMute(muted) == -1) {
Max Morin787eeed2016-06-23 10:42:07 +0200435 return -1;
436 }
Max Morin787eeed2016-06-23 10:42:07 +0200437 *enabled = muted;
Mirko Bonadei675513b2017-11-09 11:09:25 +0100438 RTC_LOG(INFO) << "output: " << muted;
henrika4af73662017-10-11 13:16:17 +0200439 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000440}
441
Max Morin787eeed2016-06-23 10:42:07 +0200442int32_t AudioDeviceModuleImpl::MicrophoneMuteIsAvailable(bool* available) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100443 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200444 CHECKinitialized_();
445 bool isAvailable = false;
446 if (audio_device_->MicrophoneMuteIsAvailable(isAvailable) == -1) {
Max Morin787eeed2016-06-23 10:42:07 +0200447 return -1;
448 }
Max Morin787eeed2016-06-23 10:42:07 +0200449 *available = isAvailable;
Mirko Bonadei675513b2017-11-09 11:09:25 +0100450 RTC_LOG(INFO) << "output: " << isAvailable;
henrika4af73662017-10-11 13:16:17 +0200451 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000452}
453
Max Morin787eeed2016-06-23 10:42:07 +0200454int32_t AudioDeviceModuleImpl::SetMicrophoneMute(bool enable) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100455 RTC_LOG(INFO) << __FUNCTION__ << "(" << enable << ")";
henrika4af73662017-10-11 13:16:17 +0200456 CHECKinitialized_();
457 return (audio_device_->SetMicrophoneMute(enable));
niklase@google.com470e71d2011-07-07 08:21:25 +0000458}
459
Max Morin787eeed2016-06-23 10:42:07 +0200460int32_t AudioDeviceModuleImpl::MicrophoneMute(bool* enabled) const {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100461 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200462 CHECKinitialized_();
463 bool muted = false;
464 if (audio_device_->MicrophoneMute(muted) == -1) {
Max Morin787eeed2016-06-23 10:42:07 +0200465 return -1;
466 }
Max Morin787eeed2016-06-23 10:42:07 +0200467 *enabled = muted;
Mirko Bonadei675513b2017-11-09 11:09:25 +0100468 RTC_LOG(INFO) << "output: " << muted;
henrika4af73662017-10-11 13:16:17 +0200469 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000470}
471
Max Morin787eeed2016-06-23 10:42:07 +0200472int32_t AudioDeviceModuleImpl::MicrophoneVolumeIsAvailable(bool* available) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100473 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200474 CHECKinitialized_();
475 bool isAvailable = false;
476 if (audio_device_->MicrophoneVolumeIsAvailable(isAvailable) == -1) {
Max Morin787eeed2016-06-23 10:42:07 +0200477 return -1;
478 }
Max Morin787eeed2016-06-23 10:42:07 +0200479 *available = isAvailable;
Mirko Bonadei675513b2017-11-09 11:09:25 +0100480 RTC_LOG(INFO) << "output: " << isAvailable;
henrika4af73662017-10-11 13:16:17 +0200481 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000482}
483
Max Morin787eeed2016-06-23 10:42:07 +0200484int32_t AudioDeviceModuleImpl::SetMicrophoneVolume(uint32_t volume) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100485 RTC_LOG(INFO) << __FUNCTION__ << "(" << volume << ")";
henrika4af73662017-10-11 13:16:17 +0200486 CHECKinitialized_();
487 return (audio_device_->SetMicrophoneVolume(volume));
niklase@google.com470e71d2011-07-07 08:21:25 +0000488}
489
Max Morin787eeed2016-06-23 10:42:07 +0200490int32_t AudioDeviceModuleImpl::MicrophoneVolume(uint32_t* volume) const {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100491 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200492 CHECKinitialized_();
493 uint32_t level = 0;
494 if (audio_device_->MicrophoneVolume(level) == -1) {
Max Morin787eeed2016-06-23 10:42:07 +0200495 return -1;
496 }
Max Morin787eeed2016-06-23 10:42:07 +0200497 *volume = level;
Mirko Bonadei675513b2017-11-09 11:09:25 +0100498 RTC_LOG(INFO) << "output: " << *volume;
henrika4af73662017-10-11 13:16:17 +0200499 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000500}
501
Max Morin787eeed2016-06-23 10:42:07 +0200502int32_t AudioDeviceModuleImpl::StereoRecordingIsAvailable(
503 bool* available) const {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100504 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200505 CHECKinitialized_();
506 bool isAvailable = false;
507 if (audio_device_->StereoRecordingIsAvailable(isAvailable) == -1) {
Max Morin787eeed2016-06-23 10:42:07 +0200508 return -1;
509 }
Max Morin787eeed2016-06-23 10:42:07 +0200510 *available = isAvailable;
Mirko Bonadei675513b2017-11-09 11:09:25 +0100511 RTC_LOG(INFO) << "output: " << isAvailable;
henrika4af73662017-10-11 13:16:17 +0200512 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000513}
514
Max Morin787eeed2016-06-23 10:42:07 +0200515int32_t AudioDeviceModuleImpl::SetStereoRecording(bool enable) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100516 RTC_LOG(INFO) << __FUNCTION__ << "(" << enable << ")";
henrika4af73662017-10-11 13:16:17 +0200517 CHECKinitialized_();
518 if (audio_device_->RecordingIsInitialized()) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100519 RTC_LOG(WARNING) << "recording in stereo is not supported";
Max Morin787eeed2016-06-23 10:42:07 +0200520 return -1;
521 }
henrika4af73662017-10-11 13:16:17 +0200522 if (audio_device_->SetStereoRecording(enable) == -1) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100523 RTC_LOG(WARNING) << "failed to change stereo recording";
Max Morin787eeed2016-06-23 10:42:07 +0200524 return -1;
525 }
Max Morin787eeed2016-06-23 10:42:07 +0200526 int8_t nChannels(1);
527 if (enable) {
528 nChannels = 2;
529 }
henrika4af73662017-10-11 13:16:17 +0200530 audio_device_buffer_.SetRecordingChannels(nChannels);
Max Morin787eeed2016-06-23 10:42:07 +0200531 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000532}
533
Max Morin787eeed2016-06-23 10:42:07 +0200534int32_t AudioDeviceModuleImpl::StereoRecording(bool* enabled) const {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100535 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200536 CHECKinitialized_();
537 bool stereo = false;
538 if (audio_device_->StereoRecording(stereo) == -1) {
Max Morin787eeed2016-06-23 10:42:07 +0200539 return -1;
540 }
Max Morin787eeed2016-06-23 10:42:07 +0200541 *enabled = stereo;
Mirko Bonadei675513b2017-11-09 11:09:25 +0100542 RTC_LOG(INFO) << "output: " << stereo;
henrika4af73662017-10-11 13:16:17 +0200543 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000544}
545
Max Morin787eeed2016-06-23 10:42:07 +0200546int32_t AudioDeviceModuleImpl::StereoPlayoutIsAvailable(bool* available) const {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100547 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200548 CHECKinitialized_();
549 bool isAvailable = false;
550 if (audio_device_->StereoPlayoutIsAvailable(isAvailable) == -1) {
Max Morin787eeed2016-06-23 10:42:07 +0200551 return -1;
552 }
Max Morin787eeed2016-06-23 10:42:07 +0200553 *available = isAvailable;
Mirko Bonadei675513b2017-11-09 11:09:25 +0100554 RTC_LOG(INFO) << "output: " << isAvailable;
henrika4af73662017-10-11 13:16:17 +0200555 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000556}
557
Max Morin787eeed2016-06-23 10:42:07 +0200558int32_t AudioDeviceModuleImpl::SetStereoPlayout(bool enable) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100559 RTC_LOG(INFO) << __FUNCTION__ << "(" << enable << ")";
henrika4af73662017-10-11 13:16:17 +0200560 CHECKinitialized_();
561 if (audio_device_->PlayoutIsInitialized()) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100562 RTC_LOG(LERROR)
Max Morin098e6c52016-06-28 09:36:25 +0200563 << "unable to set stereo mode while playing side is initialized";
Max Morin787eeed2016-06-23 10:42:07 +0200564 return -1;
565 }
henrika4af73662017-10-11 13:16:17 +0200566 if (audio_device_->SetStereoPlayout(enable)) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100567 RTC_LOG(WARNING) << "stereo playout is not supported";
Max Morin787eeed2016-06-23 10:42:07 +0200568 return -1;
569 }
Max Morin787eeed2016-06-23 10:42:07 +0200570 int8_t nChannels(1);
571 if (enable) {
572 nChannels = 2;
573 }
henrika4af73662017-10-11 13:16:17 +0200574 audio_device_buffer_.SetPlayoutChannels(nChannels);
Max Morin787eeed2016-06-23 10:42:07 +0200575 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000576}
577
Max Morin787eeed2016-06-23 10:42:07 +0200578int32_t AudioDeviceModuleImpl::StereoPlayout(bool* enabled) const {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100579 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200580 CHECKinitialized_();
581 bool stereo = false;
582 if (audio_device_->StereoPlayout(stereo) == -1) {
Max Morin787eeed2016-06-23 10:42:07 +0200583 return -1;
584 }
Max Morin787eeed2016-06-23 10:42:07 +0200585 *enabled = stereo;
Mirko Bonadei675513b2017-11-09 11:09:25 +0100586 RTC_LOG(INFO) << "output: " << stereo;
henrika4af73662017-10-11 13:16:17 +0200587 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000588}
589
Max Morin787eeed2016-06-23 10:42:07 +0200590int32_t AudioDeviceModuleImpl::PlayoutIsAvailable(bool* available) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100591 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200592 CHECKinitialized_();
593 bool isAvailable = false;
594 if (audio_device_->PlayoutIsAvailable(isAvailable) == -1) {
Max Morin787eeed2016-06-23 10:42:07 +0200595 return -1;
596 }
Max Morin787eeed2016-06-23 10:42:07 +0200597 *available = isAvailable;
Mirko Bonadei675513b2017-11-09 11:09:25 +0100598 RTC_LOG(INFO) << "output: " << isAvailable;
henrika4af73662017-10-11 13:16:17 +0200599 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000600}
601
Max Morin787eeed2016-06-23 10:42:07 +0200602int32_t AudioDeviceModuleImpl::RecordingIsAvailable(bool* available) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100603 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200604 CHECKinitialized_();
605 bool isAvailable = false;
606 if (audio_device_->RecordingIsAvailable(isAvailable) == -1) {
Max Morin787eeed2016-06-23 10:42:07 +0200607 return -1;
608 }
Max Morin787eeed2016-06-23 10:42:07 +0200609 *available = isAvailable;
Mirko Bonadei675513b2017-11-09 11:09:25 +0100610 RTC_LOG(INFO) << "output: " << isAvailable;
henrika4af73662017-10-11 13:16:17 +0200611 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000612}
613
Max Morin787eeed2016-06-23 10:42:07 +0200614int32_t AudioDeviceModuleImpl::MaxMicrophoneVolume(uint32_t* maxVolume) const {
henrika4af73662017-10-11 13:16:17 +0200615 CHECKinitialized_();
Max Morin787eeed2016-06-23 10:42:07 +0200616 uint32_t maxVol(0);
henrika4af73662017-10-11 13:16:17 +0200617 if (audio_device_->MaxMicrophoneVolume(maxVol) == -1) {
Max Morin787eeed2016-06-23 10:42:07 +0200618 return -1;
619 }
Max Morin787eeed2016-06-23 10:42:07 +0200620 *maxVolume = maxVol;
henrika4af73662017-10-11 13:16:17 +0200621 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000622}
623
Max Morin787eeed2016-06-23 10:42:07 +0200624int32_t AudioDeviceModuleImpl::MinMicrophoneVolume(uint32_t* minVolume) const {
henrika4af73662017-10-11 13:16:17 +0200625 CHECKinitialized_();
Max Morin787eeed2016-06-23 10:42:07 +0200626 uint32_t minVol(0);
henrika4af73662017-10-11 13:16:17 +0200627 if (audio_device_->MinMicrophoneVolume(minVol) == -1) {
Max Morin787eeed2016-06-23 10:42:07 +0200628 return -1;
629 }
Max Morin787eeed2016-06-23 10:42:07 +0200630 *minVolume = minVol;
henrika4af73662017-10-11 13:16:17 +0200631 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000632}
633
Max Morin787eeed2016-06-23 10:42:07 +0200634int16_t AudioDeviceModuleImpl::PlayoutDevices() {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100635 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200636 CHECKinitialized_();
637 uint16_t nPlayoutDevices = audio_device_->PlayoutDevices();
Mirko Bonadei675513b2017-11-09 11:09:25 +0100638 RTC_LOG(INFO) << "output: " << nPlayoutDevices;
henrika4af73662017-10-11 13:16:17 +0200639 return (int16_t)(nPlayoutDevices);
niklase@google.com470e71d2011-07-07 08:21:25 +0000640}
641
Max Morin787eeed2016-06-23 10:42:07 +0200642int32_t AudioDeviceModuleImpl::SetPlayoutDevice(uint16_t index) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100643 RTC_LOG(INFO) << __FUNCTION__ << "(" << index << ")";
henrika4af73662017-10-11 13:16:17 +0200644 CHECKinitialized_();
645 return audio_device_->SetPlayoutDevice(index);
niklase@google.com470e71d2011-07-07 08:21:25 +0000646}
647
Max Morin787eeed2016-06-23 10:42:07 +0200648int32_t AudioDeviceModuleImpl::SetPlayoutDevice(WindowsDeviceType device) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100649 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200650 CHECKinitialized_();
651 return audio_device_->SetPlayoutDevice(device);
niklase@google.com470e71d2011-07-07 08:21:25 +0000652}
653
pbos@webrtc.org25509882013-04-09 10:30:35 +0000654int32_t AudioDeviceModuleImpl::PlayoutDeviceName(
655 uint16_t index,
leozwang@webrtc.org28f39132012-03-01 18:01:48 +0000656 char name[kAdmMaxDeviceNameSize],
Max Morin787eeed2016-06-23 10:42:07 +0200657 char guid[kAdmMaxGuidSize]) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100658 RTC_LOG(INFO) << __FUNCTION__ << "(" << index << ", ...)";
henrika4af73662017-10-11 13:16:17 +0200659 CHECKinitialized_();
Max Morin787eeed2016-06-23 10:42:07 +0200660 if (name == NULL) {
Max Morin787eeed2016-06-23 10:42:07 +0200661 return -1;
662 }
henrika4af73662017-10-11 13:16:17 +0200663 if (audio_device_->PlayoutDeviceName(index, name, guid) == -1) {
Max Morin787eeed2016-06-23 10:42:07 +0200664 return -1;
665 }
Max Morin787eeed2016-06-23 10:42:07 +0200666 if (name != NULL) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100667 RTC_LOG(INFO) << "output: name = " << name;
Max Morin787eeed2016-06-23 10:42:07 +0200668 }
669 if (guid != NULL) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100670 RTC_LOG(INFO) << "output: guid = " << guid;
Max Morin787eeed2016-06-23 10:42:07 +0200671 }
henrika4af73662017-10-11 13:16:17 +0200672 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000673}
674
pbos@webrtc.org25509882013-04-09 10:30:35 +0000675int32_t AudioDeviceModuleImpl::RecordingDeviceName(
676 uint16_t index,
leozwang@webrtc.org28f39132012-03-01 18:01:48 +0000677 char name[kAdmMaxDeviceNameSize],
Max Morin787eeed2016-06-23 10:42:07 +0200678 char guid[kAdmMaxGuidSize]) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100679 RTC_LOG(INFO) << __FUNCTION__ << "(" << index << ", ...)";
henrika4af73662017-10-11 13:16:17 +0200680 CHECKinitialized_();
Max Morin787eeed2016-06-23 10:42:07 +0200681 if (name == NULL) {
Max Morin787eeed2016-06-23 10:42:07 +0200682 return -1;
683 }
henrika4af73662017-10-11 13:16:17 +0200684 if (audio_device_->RecordingDeviceName(index, name, guid) == -1) {
Max Morin787eeed2016-06-23 10:42:07 +0200685 return -1;
686 }
Max Morin787eeed2016-06-23 10:42:07 +0200687 if (name != NULL) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100688 RTC_LOG(INFO) << "output: name = " << name;
Max Morin787eeed2016-06-23 10:42:07 +0200689 }
690 if (guid != NULL) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100691 RTC_LOG(INFO) << "output: guid = " << guid;
Max Morin787eeed2016-06-23 10:42:07 +0200692 }
henrika4af73662017-10-11 13:16:17 +0200693 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000694}
695
Max Morin787eeed2016-06-23 10:42:07 +0200696int16_t AudioDeviceModuleImpl::RecordingDevices() {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100697 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200698 CHECKinitialized_();
699 uint16_t nRecordingDevices = audio_device_->RecordingDevices();
Mirko Bonadei675513b2017-11-09 11:09:25 +0100700 RTC_LOG(INFO) << "output: " << nRecordingDevices;
henrika4af73662017-10-11 13:16:17 +0200701 return (int16_t)nRecordingDevices;
niklase@google.com470e71d2011-07-07 08:21:25 +0000702}
703
Max Morin787eeed2016-06-23 10:42:07 +0200704int32_t AudioDeviceModuleImpl::SetRecordingDevice(uint16_t index) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100705 RTC_LOG(INFO) << __FUNCTION__ << "(" << index << ")";
henrika4af73662017-10-11 13:16:17 +0200706 CHECKinitialized_();
707 return audio_device_->SetRecordingDevice(index);
niklase@google.com470e71d2011-07-07 08:21:25 +0000708}
709
Max Morin787eeed2016-06-23 10:42:07 +0200710int32_t AudioDeviceModuleImpl::SetRecordingDevice(WindowsDeviceType device) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100711 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200712 CHECKinitialized_();
713 return audio_device_->SetRecordingDevice(device);
niklase@google.com470e71d2011-07-07 08:21:25 +0000714}
715
Max Morin787eeed2016-06-23 10:42:07 +0200716int32_t AudioDeviceModuleImpl::InitPlayout() {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100717 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200718 CHECKinitialized_();
maxmorin8c695b42016-07-25 02:46:44 -0700719 if (PlayoutIsInitialized()) {
720 return 0;
721 }
henrika4af73662017-10-11 13:16:17 +0200722 int32_t result = audio_device_->InitPlayout();
Mirko Bonadei675513b2017-11-09 11:09:25 +0100723 RTC_LOG(INFO) << "output: " << result;
Max Morin84cab202016-07-01 13:35:19 +0200724 RTC_HISTOGRAM_BOOLEAN("WebRTC.Audio.InitPlayoutSuccess",
725 static_cast<int>(result == 0));
726 return result;
niklase@google.com470e71d2011-07-07 08:21:25 +0000727}
728
Max Morin787eeed2016-06-23 10:42:07 +0200729int32_t AudioDeviceModuleImpl::InitRecording() {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100730 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200731 CHECKinitialized_();
maxmorin8c695b42016-07-25 02:46:44 -0700732 if (RecordingIsInitialized()) {
733 return 0;
734 }
henrika4af73662017-10-11 13:16:17 +0200735 int32_t result = audio_device_->InitRecording();
Mirko Bonadei675513b2017-11-09 11:09:25 +0100736 RTC_LOG(INFO) << "output: " << result;
Max Morin84cab202016-07-01 13:35:19 +0200737 RTC_HISTOGRAM_BOOLEAN("WebRTC.Audio.InitRecordingSuccess",
738 static_cast<int>(result == 0));
739 return result;
niklase@google.com470e71d2011-07-07 08:21:25 +0000740}
741
Max Morin787eeed2016-06-23 10:42:07 +0200742bool AudioDeviceModuleImpl::PlayoutIsInitialized() const {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100743 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200744 CHECKinitialized__BOOL();
745 return audio_device_->PlayoutIsInitialized();
niklase@google.com470e71d2011-07-07 08:21:25 +0000746}
747
Max Morin787eeed2016-06-23 10:42:07 +0200748bool AudioDeviceModuleImpl::RecordingIsInitialized() const {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100749 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200750 CHECKinitialized__BOOL();
751 return audio_device_->RecordingIsInitialized();
niklase@google.com470e71d2011-07-07 08:21:25 +0000752}
753
Max Morin787eeed2016-06-23 10:42:07 +0200754int32_t AudioDeviceModuleImpl::StartPlayout() {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100755 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200756 CHECKinitialized_();
maxmorin8c695b42016-07-25 02:46:44 -0700757 if (Playing()) {
758 return 0;
759 }
henrika4af73662017-10-11 13:16:17 +0200760 audio_device_buffer_.StartPlayout();
761 int32_t result = audio_device_->StartPlayout();
Mirko Bonadei675513b2017-11-09 11:09:25 +0100762 RTC_LOG(INFO) << "output: " << result;
Max Morin84cab202016-07-01 13:35:19 +0200763 RTC_HISTOGRAM_BOOLEAN("WebRTC.Audio.StartPlayoutSuccess",
764 static_cast<int>(result == 0));
765 return result;
niklase@google.com470e71d2011-07-07 08:21:25 +0000766}
767
Max Morin787eeed2016-06-23 10:42:07 +0200768int32_t AudioDeviceModuleImpl::StopPlayout() {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100769 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200770 CHECKinitialized_();
771 int32_t result = audio_device_->StopPlayout();
772 audio_device_buffer_.StopPlayout();
Mirko Bonadei675513b2017-11-09 11:09:25 +0100773 RTC_LOG(INFO) << "output: " << result;
Max Morin84cab202016-07-01 13:35:19 +0200774 RTC_HISTOGRAM_BOOLEAN("WebRTC.Audio.StopPlayoutSuccess",
775 static_cast<int>(result == 0));
776 return result;
niklase@google.com470e71d2011-07-07 08:21:25 +0000777}
778
Max Morin787eeed2016-06-23 10:42:07 +0200779bool AudioDeviceModuleImpl::Playing() const {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100780 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200781 CHECKinitialized__BOOL();
782 return audio_device_->Playing();
niklase@google.com470e71d2011-07-07 08:21:25 +0000783}
784
Max Morin787eeed2016-06-23 10:42:07 +0200785int32_t AudioDeviceModuleImpl::StartRecording() {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100786 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200787 CHECKinitialized_();
maxmorin8c695b42016-07-25 02:46:44 -0700788 if (Recording()) {
789 return 0;
790 }
henrika4af73662017-10-11 13:16:17 +0200791 audio_device_buffer_.StartRecording();
792 int32_t result = audio_device_->StartRecording();
Mirko Bonadei675513b2017-11-09 11:09:25 +0100793 RTC_LOG(INFO) << "output: " << result;
Max Morin84cab202016-07-01 13:35:19 +0200794 RTC_HISTOGRAM_BOOLEAN("WebRTC.Audio.StartRecordingSuccess",
795 static_cast<int>(result == 0));
796 return result;
niklase@google.com470e71d2011-07-07 08:21:25 +0000797}
niklase@google.com470e71d2011-07-07 08:21:25 +0000798
Max Morin787eeed2016-06-23 10:42:07 +0200799int32_t AudioDeviceModuleImpl::StopRecording() {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100800 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200801 CHECKinitialized_();
802 int32_t result = audio_device_->StopRecording();
803 audio_device_buffer_.StopRecording();
Mirko Bonadei675513b2017-11-09 11:09:25 +0100804 RTC_LOG(INFO) << "output: " << result;
Max Morin84cab202016-07-01 13:35:19 +0200805 RTC_HISTOGRAM_BOOLEAN("WebRTC.Audio.StopRecordingSuccess",
806 static_cast<int>(result == 0));
807 return result;
niklase@google.com470e71d2011-07-07 08:21:25 +0000808}
809
Max Morin787eeed2016-06-23 10:42:07 +0200810bool AudioDeviceModuleImpl::Recording() const {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100811 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200812 CHECKinitialized__BOOL();
813 return audio_device_->Recording();
niklase@google.com470e71d2011-07-07 08:21:25 +0000814}
815
Max Morin787eeed2016-06-23 10:42:07 +0200816int32_t AudioDeviceModuleImpl::RegisterAudioCallback(
817 AudioTransport* audioCallback) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100818 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200819 return audio_device_buffer_.RegisterAudioCallback(audioCallback);
niklase@google.com470e71d2011-07-07 08:21:25 +0000820}
821
Max Morin787eeed2016-06-23 10:42:07 +0200822int32_t AudioDeviceModuleImpl::PlayoutDelay(uint16_t* delayMS) const {
henrika4af73662017-10-11 13:16:17 +0200823 CHECKinitialized_();
824 uint16_t delay = 0;
825 if (audio_device_->PlayoutDelay(delay) == -1) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100826 RTC_LOG(LERROR) << "failed to retrieve the playout delay";
Max Morin787eeed2016-06-23 10:42:07 +0200827 return -1;
828 }
Max Morin787eeed2016-06-23 10:42:07 +0200829 *delayMS = delay;
henrika4af73662017-10-11 13:16:17 +0200830 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000831}
832
henrika@webrtc.orga954c072014-12-09 16:22:09 +0000833bool AudioDeviceModuleImpl::BuiltInAECIsAvailable() const {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100834 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200835 CHECKinitialized__BOOL();
836 bool isAvailable = audio_device_->BuiltInAECIsAvailable();
Mirko Bonadei675513b2017-11-09 11:09:25 +0100837 RTC_LOG(INFO) << "output: " << isAvailable;
Max Morin098e6c52016-06-28 09:36:25 +0200838 return isAvailable;
henrika@webrtc.orga954c072014-12-09 16:22:09 +0000839}
840
henrikac14f5ff2015-09-23 14:08:33 +0200841int32_t AudioDeviceModuleImpl::EnableBuiltInAEC(bool enable) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100842 RTC_LOG(INFO) << __FUNCTION__ << "(" << enable << ")";
henrika4af73662017-10-11 13:16:17 +0200843 CHECKinitialized_();
844 int32_t ok = audio_device_->EnableBuiltInAEC(enable);
Mirko Bonadei675513b2017-11-09 11:09:25 +0100845 RTC_LOG(INFO) << "output: " << ok;
Max Morin098e6c52016-06-28 09:36:25 +0200846 return ok;
henrikac14f5ff2015-09-23 14:08:33 +0200847}
848
849bool AudioDeviceModuleImpl::BuiltInAGCIsAvailable() const {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100850 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200851 CHECKinitialized__BOOL();
852 bool isAvailable = audio_device_->BuiltInAGCIsAvailable();
Mirko Bonadei675513b2017-11-09 11:09:25 +0100853 RTC_LOG(INFO) << "output: " << isAvailable;
Max Morin098e6c52016-06-28 09:36:25 +0200854 return isAvailable;
henrikac14f5ff2015-09-23 14:08:33 +0200855}
856
857int32_t AudioDeviceModuleImpl::EnableBuiltInAGC(bool enable) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100858 RTC_LOG(INFO) << __FUNCTION__ << "(" << enable << ")";
henrika4af73662017-10-11 13:16:17 +0200859 CHECKinitialized_();
860 int32_t ok = audio_device_->EnableBuiltInAGC(enable);
Mirko Bonadei675513b2017-11-09 11:09:25 +0100861 RTC_LOG(INFO) << "output: " << ok;
Max Morin098e6c52016-06-28 09:36:25 +0200862 return ok;
henrikac14f5ff2015-09-23 14:08:33 +0200863}
864
865bool AudioDeviceModuleImpl::BuiltInNSIsAvailable() const {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100866 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200867 CHECKinitialized__BOOL();
868 bool isAvailable = audio_device_->BuiltInNSIsAvailable();
Mirko Bonadei675513b2017-11-09 11:09:25 +0100869 RTC_LOG(INFO) << "output: " << isAvailable;
Max Morin098e6c52016-06-28 09:36:25 +0200870 return isAvailable;
henrikac14f5ff2015-09-23 14:08:33 +0200871}
872
873int32_t AudioDeviceModuleImpl::EnableBuiltInNS(bool enable) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100874 RTC_LOG(INFO) << __FUNCTION__ << "(" << enable << ")";
henrika4af73662017-10-11 13:16:17 +0200875 CHECKinitialized_();
876 int32_t ok = audio_device_->EnableBuiltInNS(enable);
Mirko Bonadei675513b2017-11-09 11:09:25 +0100877 RTC_LOG(INFO) << "output: " << ok;
Max Morin098e6c52016-06-28 09:36:25 +0200878 return ok;
henrikac14f5ff2015-09-23 14:08:33 +0200879}
880
maxmorin88e31a32016-08-16 00:56:09 -0700881#if defined(WEBRTC_IOS)
henrikaba35d052015-07-14 17:04:08 +0200882int AudioDeviceModuleImpl::GetPlayoutAudioParameters(
883 AudioParameters* params) const {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100884 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200885 int r = audio_device_->GetPlayoutAudioParameters(params);
Mirko Bonadei675513b2017-11-09 11:09:25 +0100886 RTC_LOG(INFO) << "output: " << r;
Max Morin098e6c52016-06-28 09:36:25 +0200887 return r;
henrikaba35d052015-07-14 17:04:08 +0200888}
889
890int AudioDeviceModuleImpl::GetRecordAudioParameters(
891 AudioParameters* params) const {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100892 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200893 int r = audio_device_->GetRecordAudioParameters(params);
Mirko Bonadei675513b2017-11-09 11:09:25 +0100894 RTC_LOG(INFO) << "output: " << r;
Max Morin098e6c52016-06-28 09:36:25 +0200895 return r;
henrikaba35d052015-07-14 17:04:08 +0200896}
maxmorin88e31a32016-08-16 00:56:09 -0700897#endif // WEBRTC_IOS
henrikaba35d052015-07-14 17:04:08 +0200898
Max Morin787eeed2016-06-23 10:42:07 +0200899AudioDeviceModuleImpl::PlatformType AudioDeviceModuleImpl::Platform() const {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100900 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200901 return platform_type_;
niklase@google.com470e71d2011-07-07 08:21:25 +0000902}
903
Max Morin787eeed2016-06-23 10:42:07 +0200904AudioDeviceModule::AudioLayer AudioDeviceModuleImpl::PlatformAudioLayer()
905 const {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100906 RTC_LOG(INFO) << __FUNCTION__;
henrika4af73662017-10-11 13:16:17 +0200907 return audio_layer_;
niklase@google.com470e71d2011-07-07 08:21:25 +0000908}
909
910} // namespace webrtc