1/* 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 3 * 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 11#include "audio_device_module_ios.h" 12 13#include "api/task_queue/default_task_queue_factory.h" 14#include "modules/audio_device/audio_device_config.h" 15#include "modules/audio_device/audio_device_generic.h" 16#include "rtc_base/checks.h" 17#include "rtc_base/logging.h" 18#include "rtc_base/ref_count.h" 19#include "system_wrappers/include/metrics.h" 20 21#if defined(WEBRTC_IOS) 22#include "audio_device_ios.h" 23#endif 24 25#define CHECKinitialized_() \ 26 { \ 27 if (!initialized_) { \ 28 return -1; \ 29 }; \ 30 } 31 32#define CHECKinitialized__BOOL() \ 33 { \ 34 if (!initialized_) { \ 35 return false; \ 36 }; \ 37 } 38 39namespace webrtc { 40namespace ios_adm { 41 42AudioDeviceModuleIOS::AudioDeviceModuleIOS(bool bypass_voice_processing) 43 : bypass_voice_processing_(bypass_voice_processing), 44 task_queue_factory_(CreateDefaultTaskQueueFactory()) { 45 RTC_LOG(LS_INFO) << "current platform is IOS"; 46 RTC_LOG(LS_INFO) << "iPhone Audio APIs will be utilized."; 47} 48 49 int32_t AudioDeviceModuleIOS::AttachAudioBuffer() { 50 RTC_DLOG(LS_INFO) << __FUNCTION__; 51 audio_device_->AttachAudioBuffer(audio_device_buffer_.get()); 52 return 0; 53 } 54 55 AudioDeviceModuleIOS::~AudioDeviceModuleIOS() { 56 RTC_DLOG(LS_INFO) << __FUNCTION__; 57 } 58 59 int32_t AudioDeviceModuleIOS::ActiveAudioLayer(AudioLayer* audioLayer) const { 60 RTC_DLOG(LS_INFO) << __FUNCTION__; 61 AudioLayer activeAudio; 62 if (audio_device_->ActiveAudioLayer(activeAudio) == -1) { 63 return -1; 64 } 65 *audioLayer = activeAudio; 66 return 0; 67 } 68 69 int32_t AudioDeviceModuleIOS::Init() { 70 RTC_DLOG(LS_INFO) << __FUNCTION__; 71 if (initialized_) 72 return 0; 73 74 audio_device_buffer_.reset(new webrtc::AudioDeviceBuffer(task_queue_factory_.get())); 75 audio_device_.reset(new ios_adm::AudioDeviceIOS(bypass_voice_processing_)); 76 RTC_CHECK(audio_device_); 77 78 this->AttachAudioBuffer(); 79 80 AudioDeviceGeneric::InitStatus status = audio_device_->Init(); 81 RTC_HISTOGRAM_ENUMERATION( 82 "WebRTC.Audio.InitializationResult", static_cast<int>(status), 83 static_cast<int>(AudioDeviceGeneric::InitStatus::NUM_STATUSES)); 84 if (status != AudioDeviceGeneric::InitStatus::OK) { 85 RTC_LOG(LS_ERROR) << "Audio device initialization failed."; 86 return -1; 87 } 88 initialized_ = true; 89 return 0; 90 } 91 92 int32_t AudioDeviceModuleIOS::Terminate() { 93 RTC_DLOG(LS_INFO) << __FUNCTION__; 94 if (!initialized_) 95 return 0; 96 if (audio_device_->Terminate() == -1) { 97 return -1; 98 } 99 initialized_ = false; 100 return 0; 101 } 102 103 bool AudioDeviceModuleIOS::Initialized() const { 104 RTC_DLOG(LS_INFO) << __FUNCTION__ << ": " << initialized_; 105 return initialized_; 106 } 107 108 int32_t AudioDeviceModuleIOS::InitSpeaker() { 109 RTC_DLOG(LS_INFO) << __FUNCTION__; 110 CHECKinitialized_(); 111 return audio_device_->InitSpeaker(); 112 } 113 114 int32_t AudioDeviceModuleIOS::InitMicrophone() { 115 RTC_DLOG(LS_INFO) << __FUNCTION__; 116 CHECKinitialized_(); 117 return audio_device_->InitMicrophone(); 118 } 119 120 int32_t AudioDeviceModuleIOS::SpeakerVolumeIsAvailable(bool* available) { 121 RTC_DLOG(LS_INFO) << __FUNCTION__; 122 CHECKinitialized_(); 123 bool isAvailable = false; 124 if (audio_device_->SpeakerVolumeIsAvailable(isAvailable) == -1) { 125 return -1; 126 } 127 *available = isAvailable; 128 RTC_DLOG(LS_INFO) << "output: " << isAvailable; 129 return 0; 130 } 131 132 int32_t AudioDeviceModuleIOS::SetSpeakerVolume(uint32_t volume) { 133 RTC_DLOG(LS_INFO) << __FUNCTION__ << "(" << volume << ")"; 134 CHECKinitialized_(); 135 return audio_device_->SetSpeakerVolume(volume); 136 } 137 138 int32_t AudioDeviceModuleIOS::SpeakerVolume(uint32_t* volume) const { 139 RTC_DLOG(LS_INFO) << __FUNCTION__; 140 CHECKinitialized_(); 141 uint32_t level = 0; 142 if (audio_device_->SpeakerVolume(level) == -1) { 143 return -1; 144 } 145 *volume = level; 146 RTC_DLOG(LS_INFO) << "output: " << *volume; 147 return 0; 148 } 149 150 bool AudioDeviceModuleIOS::SpeakerIsInitialized() const { 151 RTC_DLOG(LS_INFO) << __FUNCTION__; 152 CHECKinitialized__BOOL(); 153 bool isInitialized = audio_device_->SpeakerIsInitialized(); 154 RTC_DLOG(LS_INFO) << "output: " << isInitialized; 155 return isInitialized; 156 } 157 158 bool AudioDeviceModuleIOS::MicrophoneIsInitialized() const { 159 RTC_DLOG(LS_INFO) << __FUNCTION__; 160 CHECKinitialized__BOOL(); 161 bool isInitialized = audio_device_->MicrophoneIsInitialized(); 162 RTC_DLOG(LS_INFO) << "output: " << isInitialized; 163 return isInitialized; 164 } 165 166 int32_t AudioDeviceModuleIOS::MaxSpeakerVolume(uint32_t* maxVolume) const { 167 CHECKinitialized_(); 168 uint32_t maxVol = 0; 169 if (audio_device_->MaxSpeakerVolume(maxVol) == -1) { 170 return -1; 171 } 172 *maxVolume = maxVol; 173 return 0; 174 } 175 176 int32_t AudioDeviceModuleIOS::MinSpeakerVolume(uint32_t* minVolume) const { 177 CHECKinitialized_(); 178 uint32_t minVol = 0; 179 if (audio_device_->MinSpeakerVolume(minVol) == -1) { 180 return -1; 181 } 182 *minVolume = minVol; 183 return 0; 184 } 185 186 int32_t AudioDeviceModuleIOS::SpeakerMuteIsAvailable(bool* available) { 187 RTC_DLOG(LS_INFO) << __FUNCTION__; 188 CHECKinitialized_(); 189 bool isAvailable = false; 190 if (audio_device_->SpeakerMuteIsAvailable(isAvailable) == -1) { 191 return -1; 192 } 193 *available = isAvailable; 194 RTC_DLOG(LS_INFO) << "output: " << isAvailable; 195 return 0; 196 } 197 198 int32_t AudioDeviceModuleIOS::SetSpeakerMute(bool enable) { 199 RTC_DLOG(LS_INFO) << __FUNCTION__ << "(" << enable << ")"; 200 CHECKinitialized_(); 201 return audio_device_->SetSpeakerMute(enable); 202 } 203 204 int32_t AudioDeviceModuleIOS::SpeakerMute(bool* enabled) const { 205 RTC_DLOG(LS_INFO) << __FUNCTION__; 206 CHECKinitialized_(); 207 bool muted = false; 208 if (audio_device_->SpeakerMute(muted) == -1) { 209 return -1; 210 } 211 *enabled = muted; 212 RTC_DLOG(LS_INFO) << "output: " << muted; 213 return 0; 214 } 215 216 int32_t AudioDeviceModuleIOS::MicrophoneMuteIsAvailable(bool* available) { 217 RTC_DLOG(LS_INFO) << __FUNCTION__; 218 CHECKinitialized_(); 219 bool isAvailable = false; 220 if (audio_device_->MicrophoneMuteIsAvailable(isAvailable) == -1) { 221 return -1; 222 } 223 *available = isAvailable; 224 RTC_DLOG(LS_INFO) << "output: " << isAvailable; 225 return 0; 226 } 227 228 int32_t AudioDeviceModuleIOS::SetMicrophoneMute(bool enable) { 229 RTC_DLOG(LS_INFO) << __FUNCTION__ << "(" << enable << ")"; 230 CHECKinitialized_(); 231 return (audio_device_->SetMicrophoneMute(enable)); 232 } 233 234 int32_t AudioDeviceModuleIOS::MicrophoneMute(bool* enabled) const { 235 RTC_DLOG(LS_INFO) << __FUNCTION__; 236 CHECKinitialized_(); 237 bool muted = false; 238 if (audio_device_->MicrophoneMute(muted) == -1) { 239 return -1; 240 } 241 *enabled = muted; 242 RTC_DLOG(LS_INFO) << "output: " << muted; 243 return 0; 244 } 245 246 int32_t AudioDeviceModuleIOS::MicrophoneVolumeIsAvailable(bool* available) { 247 RTC_DLOG(LS_INFO) << __FUNCTION__; 248 CHECKinitialized_(); 249 bool isAvailable = false; 250 if (audio_device_->MicrophoneVolumeIsAvailable(isAvailable) == -1) { 251 return -1; 252 } 253 *available = isAvailable; 254 RTC_DLOG(LS_INFO) << "output: " << isAvailable; 255 return 0; 256 } 257 258 int32_t AudioDeviceModuleIOS::SetMicrophoneVolume(uint32_t volume) { 259 RTC_DLOG(LS_INFO) << __FUNCTION__ << "(" << volume << ")"; 260 CHECKinitialized_(); 261 return (audio_device_->SetMicrophoneVolume(volume)); 262 } 263 264 int32_t AudioDeviceModuleIOS::MicrophoneVolume(uint32_t* volume) const { 265 RTC_DLOG(LS_INFO) << __FUNCTION__; 266 CHECKinitialized_(); 267 uint32_t level = 0; 268 if (audio_device_->MicrophoneVolume(level) == -1) { 269 return -1; 270 } 271 *volume = level; 272 RTC_DLOG(LS_INFO) << "output: " << *volume; 273 return 0; 274 } 275 276 int32_t AudioDeviceModuleIOS::StereoRecordingIsAvailable( 277 bool* available) const { 278 RTC_DLOG(LS_INFO) << __FUNCTION__; 279 CHECKinitialized_(); 280 bool isAvailable = false; 281 if (audio_device_->StereoRecordingIsAvailable(isAvailable) == -1) { 282 return -1; 283 } 284 *available = isAvailable; 285 RTC_DLOG(LS_INFO) << "output: " << isAvailable; 286 return 0; 287 } 288 289 int32_t AudioDeviceModuleIOS::SetStereoRecording(bool enable) { 290 RTC_DLOG(LS_INFO) << __FUNCTION__ << "(" << enable << ")"; 291 CHECKinitialized_(); 292 if (enable) { 293 RTC_LOG(LS_WARNING) << "recording in stereo is not supported"; 294 } 295 return -1; 296 } 297 298 int32_t AudioDeviceModuleIOS::StereoRecording(bool* enabled) const { 299 RTC_DLOG(LS_INFO) << __FUNCTION__; 300 CHECKinitialized_(); 301 bool stereo = false; 302 if (audio_device_->StereoRecording(stereo) == -1) { 303 return -1; 304 } 305 *enabled = stereo; 306 RTC_DLOG(LS_INFO) << "output: " << stereo; 307 return 0; 308 } 309 310 int32_t AudioDeviceModuleIOS::StereoPlayoutIsAvailable(bool* available) const { 311 RTC_DLOG(LS_INFO) << __FUNCTION__; 312 CHECKinitialized_(); 313 bool isAvailable = false; 314 if (audio_device_->StereoPlayoutIsAvailable(isAvailable) == -1) { 315 return -1; 316 } 317 *available = isAvailable; 318 RTC_DLOG(LS_INFO) << "output: " << isAvailable; 319 return 0; 320 } 321 322 int32_t AudioDeviceModuleIOS::SetStereoPlayout(bool enable) { 323 RTC_DLOG(LS_INFO) << __FUNCTION__ << "(" << enable << ")"; 324 CHECKinitialized_(); 325 if (audio_device_->PlayoutIsInitialized()) { 326 RTC_LOG(LS_ERROR) << "unable to set stereo mode while playing side is initialized"; 327 return -1; 328 } 329 if (audio_device_->SetStereoPlayout(enable)) { 330 RTC_LOG(LS_WARNING) << "stereo playout is not supported"; 331 return -1; 332 } 333 int8_t nChannels(1); 334 if (enable) { 335 nChannels = 2; 336 } 337 audio_device_buffer_.get()->SetPlayoutChannels(nChannels); 338 return 0; 339 } 340 341 int32_t AudioDeviceModuleIOS::StereoPlayout(bool* enabled) const { 342 RTC_DLOG(LS_INFO) << __FUNCTION__; 343 CHECKinitialized_(); 344 bool stereo = false; 345 if (audio_device_->StereoPlayout(stereo) == -1) { 346 return -1; 347 } 348 *enabled = stereo; 349 RTC_DLOG(LS_INFO) << "output: " << stereo; 350 return 0; 351 } 352 353 int32_t AudioDeviceModuleIOS::PlayoutIsAvailable(bool* available) { 354 RTC_DLOG(LS_INFO) << __FUNCTION__; 355 CHECKinitialized_(); 356 bool isAvailable = false; 357 if (audio_device_->PlayoutIsAvailable(isAvailable) == -1) { 358 return -1; 359 } 360 *available = isAvailable; 361 RTC_DLOG(LS_INFO) << "output: " << isAvailable; 362 return 0; 363 } 364 365 int32_t AudioDeviceModuleIOS::RecordingIsAvailable(bool* available) { 366 RTC_DLOG(LS_INFO) << __FUNCTION__; 367 CHECKinitialized_(); 368 bool isAvailable = false; 369 if (audio_device_->RecordingIsAvailable(isAvailable) == -1) { 370 return -1; 371 } 372 *available = isAvailable; 373 RTC_DLOG(LS_INFO) << "output: " << isAvailable; 374 return 0; 375 } 376 377 int32_t AudioDeviceModuleIOS::MaxMicrophoneVolume(uint32_t* maxVolume) const { 378 CHECKinitialized_(); 379 uint32_t maxVol(0); 380 if (audio_device_->MaxMicrophoneVolume(maxVol) == -1) { 381 return -1; 382 } 383 *maxVolume = maxVol; 384 return 0; 385 } 386 387 int32_t AudioDeviceModuleIOS::MinMicrophoneVolume(uint32_t* minVolume) const { 388 CHECKinitialized_(); 389 uint32_t minVol(0); 390 if (audio_device_->MinMicrophoneVolume(minVol) == -1) { 391 return -1; 392 } 393 *minVolume = minVol; 394 return 0; 395 } 396 397 int16_t AudioDeviceModuleIOS::PlayoutDevices() { 398 RTC_DLOG(LS_INFO) << __FUNCTION__; 399 CHECKinitialized_(); 400 uint16_t nPlayoutDevices = audio_device_->PlayoutDevices(); 401 RTC_DLOG(LS_INFO) << "output: " << nPlayoutDevices; 402 return (int16_t)(nPlayoutDevices); 403 } 404 405 int32_t AudioDeviceModuleIOS::SetPlayoutDevice(uint16_t index) { 406 RTC_DLOG(LS_INFO) << __FUNCTION__ << "(" << index << ")"; 407 CHECKinitialized_(); 408 return audio_device_->SetPlayoutDevice(index); 409 } 410 411 int32_t AudioDeviceModuleIOS::SetPlayoutDevice(WindowsDeviceType device) { 412 RTC_DLOG(LS_INFO) << __FUNCTION__; 413 CHECKinitialized_(); 414 return audio_device_->SetPlayoutDevice(device); 415 } 416 417 int32_t AudioDeviceModuleIOS::PlayoutDeviceName( 418 uint16_t index, 419 char name[kAdmMaxDeviceNameSize], 420 char guid[kAdmMaxGuidSize]) { 421 RTC_DLOG(LS_INFO) << __FUNCTION__ << "(" << index << ", ...)"; 422 CHECKinitialized_(); 423 if (name == NULL) { 424 return -1; 425 } 426 if (audio_device_->PlayoutDeviceName(index, name, guid) == -1) { 427 return -1; 428 } 429 if (name != NULL) { 430 RTC_DLOG(LS_INFO) << "output: name = " << name; 431 } 432 if (guid != NULL) { 433 RTC_DLOG(LS_INFO) << "output: guid = " << guid; 434 } 435 return 0; 436 } 437 438 int32_t AudioDeviceModuleIOS::RecordingDeviceName( 439 uint16_t index, 440 char name[kAdmMaxDeviceNameSize], 441 char guid[kAdmMaxGuidSize]) { 442 RTC_DLOG(LS_INFO) << __FUNCTION__ << "(" << index << ", ...)"; 443 CHECKinitialized_(); 444 if (name == NULL) { 445 return -1; 446 } 447 if (audio_device_->RecordingDeviceName(index, name, guid) == -1) { 448 return -1; 449 } 450 if (name != NULL) { 451 RTC_DLOG(LS_INFO) << "output: name = " << name; 452 } 453 if (guid != NULL) { 454 RTC_DLOG(LS_INFO) << "output: guid = " << guid; 455 } 456 return 0; 457 } 458 459 int16_t AudioDeviceModuleIOS::RecordingDevices() { 460 RTC_DLOG(LS_INFO) << __FUNCTION__; 461 CHECKinitialized_(); 462 uint16_t nRecordingDevices = audio_device_->RecordingDevices(); 463 RTC_DLOG(LS_INFO) << "output: " << nRecordingDevices; 464 return (int16_t)nRecordingDevices; 465 } 466 467 int32_t AudioDeviceModuleIOS::SetRecordingDevice(uint16_t index) { 468 RTC_DLOG(LS_INFO) << __FUNCTION__ << "(" << index << ")"; 469 CHECKinitialized_(); 470 return audio_device_->SetRecordingDevice(index); 471 } 472 473 int32_t AudioDeviceModuleIOS::SetRecordingDevice(WindowsDeviceType device) { 474 RTC_DLOG(LS_INFO) << __FUNCTION__; 475 CHECKinitialized_(); 476 return audio_device_->SetRecordingDevice(device); 477 } 478 479 int32_t AudioDeviceModuleIOS::InitPlayout() { 480 RTC_DLOG(LS_INFO) << __FUNCTION__; 481 CHECKinitialized_(); 482 if (PlayoutIsInitialized()) { 483 return 0; 484 } 485 int32_t result = audio_device_->InitPlayout(); 486 RTC_DLOG(LS_INFO) << "output: " << result; 487 RTC_HISTOGRAM_BOOLEAN("WebRTC.Audio.InitPlayoutSuccess", 488 static_cast<int>(result == 0)); 489 return result; 490 } 491 492 int32_t AudioDeviceModuleIOS::InitRecording() { 493 RTC_DLOG(LS_INFO) << __FUNCTION__; 494 CHECKinitialized_(); 495 if (RecordingIsInitialized()) { 496 return 0; 497 } 498 int32_t result = audio_device_->InitRecording(); 499 RTC_DLOG(LS_INFO) << "output: " << result; 500 RTC_HISTOGRAM_BOOLEAN("WebRTC.Audio.InitRecordingSuccess", 501 static_cast<int>(result == 0)); 502 return result; 503 } 504 505 bool AudioDeviceModuleIOS::PlayoutIsInitialized() const { 506 RTC_DLOG(LS_INFO) << __FUNCTION__; 507 CHECKinitialized__BOOL(); 508 return audio_device_->PlayoutIsInitialized(); 509 } 510 511 bool AudioDeviceModuleIOS::RecordingIsInitialized() const { 512 RTC_DLOG(LS_INFO) << __FUNCTION__; 513 CHECKinitialized__BOOL(); 514 return audio_device_->RecordingIsInitialized(); 515 } 516 517 int32_t AudioDeviceModuleIOS::StartPlayout() { 518 RTC_DLOG(LS_INFO) << __FUNCTION__; 519 CHECKinitialized_(); 520 if (Playing()) { 521 return 0; 522 } 523 audio_device_buffer_.get()->StartPlayout(); 524 int32_t result = audio_device_->StartPlayout(); 525 RTC_DLOG(LS_INFO) << "output: " << result; 526 RTC_HISTOGRAM_BOOLEAN("WebRTC.Audio.StartPlayoutSuccess", 527 static_cast<int>(result == 0)); 528 return result; 529 } 530 531 int32_t AudioDeviceModuleIOS::StopPlayout() { 532 RTC_DLOG(LS_INFO) << __FUNCTION__; 533 CHECKinitialized_(); 534 int32_t result = audio_device_->StopPlayout(); 535 audio_device_buffer_.get()->StopPlayout(); 536 RTC_DLOG(LS_INFO) << "output: " << result; 537 RTC_HISTOGRAM_BOOLEAN("WebRTC.Audio.StopPlayoutSuccess", 538 static_cast<int>(result == 0)); 539 return result; 540 } 541 542 bool AudioDeviceModuleIOS::Playing() const { 543 RTC_DLOG(LS_INFO) << __FUNCTION__; 544 CHECKinitialized__BOOL(); 545 return audio_device_->Playing(); 546 } 547 548 int32_t AudioDeviceModuleIOS::StartRecording() { 549 RTC_DLOG(LS_INFO) << __FUNCTION__; 550 CHECKinitialized_(); 551 if (Recording()) { 552 return 0; 553 } 554 audio_device_buffer_.get()->StartRecording(); 555 int32_t result = audio_device_->StartRecording(); 556 RTC_DLOG(LS_INFO) << "output: " << result; 557 RTC_HISTOGRAM_BOOLEAN("WebRTC.Audio.StartRecordingSuccess", 558 static_cast<int>(result == 0)); 559 return result; 560 } 561 562 int32_t AudioDeviceModuleIOS::StopRecording() { 563 RTC_DLOG(LS_INFO) << __FUNCTION__; 564 CHECKinitialized_(); 565 int32_t result = audio_device_->StopRecording(); 566 audio_device_buffer_.get()->StopRecording(); 567 RTC_DLOG(LS_INFO) << "output: " << result; 568 RTC_HISTOGRAM_BOOLEAN("WebRTC.Audio.StopRecordingSuccess", 569 static_cast<int>(result == 0)); 570 return result; 571 } 572 573 bool AudioDeviceModuleIOS::Recording() const { 574 RTC_DLOG(LS_INFO) << __FUNCTION__; 575 CHECKinitialized__BOOL(); 576 return audio_device_->Recording(); 577 } 578 579 int32_t AudioDeviceModuleIOS::RegisterAudioCallback( 580 AudioTransport* audioCallback) { 581 RTC_DLOG(LS_INFO) << __FUNCTION__; 582 return audio_device_buffer_.get()->RegisterAudioCallback(audioCallback); 583 } 584 585 int32_t AudioDeviceModuleIOS::PlayoutDelay(uint16_t* delayMS) const { 586 CHECKinitialized_(); 587 uint16_t delay = 0; 588 if (audio_device_->PlayoutDelay(delay) == -1) { 589 RTC_LOG(LS_ERROR) << "failed to retrieve the playout delay"; 590 return -1; 591 } 592 *delayMS = delay; 593 return 0; 594 } 595 596 bool AudioDeviceModuleIOS::BuiltInAECIsAvailable() const { 597 RTC_DLOG(LS_INFO) << __FUNCTION__; 598 CHECKinitialized__BOOL(); 599 bool isAvailable = audio_device_->BuiltInAECIsAvailable(); 600 RTC_DLOG(LS_INFO) << "output: " << isAvailable; 601 return isAvailable; 602 } 603 604 int32_t AudioDeviceModuleIOS::EnableBuiltInAEC(bool enable) { 605 RTC_DLOG(LS_INFO) << __FUNCTION__ << "(" << enable << ")"; 606 CHECKinitialized_(); 607 int32_t ok = audio_device_->EnableBuiltInAEC(enable); 608 RTC_DLOG(LS_INFO) << "output: " << ok; 609 return ok; 610 } 611 612 bool AudioDeviceModuleIOS::BuiltInAGCIsAvailable() const { 613 RTC_DLOG(LS_INFO) << __FUNCTION__; 614 CHECKinitialized__BOOL(); 615 bool isAvailable = audio_device_->BuiltInAGCIsAvailable(); 616 RTC_DLOG(LS_INFO) << "output: " << isAvailable; 617 return isAvailable; 618 } 619 620 int32_t AudioDeviceModuleIOS::EnableBuiltInAGC(bool enable) { 621 RTC_DLOG(LS_INFO) << __FUNCTION__ << "(" << enable << ")"; 622 CHECKinitialized_(); 623 int32_t ok = audio_device_->EnableBuiltInAGC(enable); 624 RTC_DLOG(LS_INFO) << "output: " << ok; 625 return ok; 626 } 627 628 bool AudioDeviceModuleIOS::BuiltInNSIsAvailable() const { 629 RTC_DLOG(LS_INFO) << __FUNCTION__; 630 CHECKinitialized__BOOL(); 631 bool isAvailable = audio_device_->BuiltInNSIsAvailable(); 632 RTC_DLOG(LS_INFO) << "output: " << isAvailable; 633 return isAvailable; 634 } 635 636 int32_t AudioDeviceModuleIOS::EnableBuiltInNS(bool enable) { 637 RTC_DLOG(LS_INFO) << __FUNCTION__ << "(" << enable << ")"; 638 CHECKinitialized_(); 639 int32_t ok = audio_device_->EnableBuiltInNS(enable); 640 RTC_DLOG(LS_INFO) << "output: " << ok; 641 return ok; 642 } 643 644 int32_t AudioDeviceModuleIOS::GetPlayoutUnderrunCount() const { 645 // Don't log here, as this method can be called very often. 646 CHECKinitialized_(); 647 int32_t ok = audio_device_->GetPlayoutUnderrunCount(); 648 return ok; 649 } 650 651#if defined(WEBRTC_IOS) 652 int AudioDeviceModuleIOS::GetPlayoutAudioParameters( 653 AudioParameters* params) const { 654 RTC_DLOG(LS_INFO) << __FUNCTION__; 655 int r = audio_device_->GetPlayoutAudioParameters(params); 656 RTC_DLOG(LS_INFO) << "output: " << r; 657 return r; 658 } 659 660 int AudioDeviceModuleIOS::GetRecordAudioParameters( 661 AudioParameters* params) const { 662 RTC_DLOG(LS_INFO) << __FUNCTION__; 663 int r = audio_device_->GetRecordAudioParameters(params); 664 RTC_DLOG(LS_INFO) << "output: " << r; 665 return r; 666 } 667#endif // WEBRTC_IOS 668} 669} 670