From ff98f4b1d813db0a2306aa5898f091e68dfaa16e Mon Sep 17 00:00:00 2001 From: Gustavo Garcia Date: Wed, 19 Dec 2018 10:37:16 +0100 Subject: [PATCH] Fix stop logging errors for stereo mode when it is not used MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When using WebRTC in iOS this Warning is shown for every single call even if stereo is not being used at all. Change-Id: I0cc71620b9deb0692544101d78c0801968edbb26 Bug: webrtc:10146 Change-Id: I0cc71620b9deb0692544101d78c0801968edbb26 Reviewed-on: https://webrtc-review.googlesource.com/c/85283 Commit-Queue: Kári Helgason Reviewed-by: Kári Helgason Reviewed-by: Henrik Andreassson Cr-Commit-Position: refs/heads/master@{#26133} --- modules/audio_device/audio_device_impl.cc | 7 +++++-- .../native/src/audio/audio_device_module_ios.mm | 14 ++------------ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/modules/audio_device/audio_device_impl.cc b/modules/audio_device/audio_device_impl.cc index 31d5b5ecfc..c5f4332e5e 100644 --- a/modules/audio_device/audio_device_impl.cc +++ b/modules/audio_device/audio_device_impl.cc @@ -548,11 +548,14 @@ int32_t AudioDeviceModuleImpl::SetStereoRecording(bool enable) { RTC_LOG(INFO) << __FUNCTION__ << "(" << enable << ")"; CHECKinitialized_(); if (audio_device_->RecordingIsInitialized()) { - RTC_LOG(WARNING) << "recording in stereo is not supported"; + RTC_LOG(LERROR) + << "unable to set stereo mode after recording is initialized"; return -1; } if (audio_device_->SetStereoRecording(enable) == -1) { - RTC_LOG(WARNING) << "failed to change stereo recording"; + if (enable) { + RTC_LOG(WARNING) << "failed to enable stereo recording"; + } return -1; } int8_t nChannels(1); diff --git a/sdk/objc/native/src/audio/audio_device_module_ios.mm b/sdk/objc/native/src/audio/audio_device_module_ios.mm index 176b51aa99..814ab9076d 100644 --- a/sdk/objc/native/src/audio/audio_device_module_ios.mm +++ b/sdk/objc/native/src/audio/audio_device_module_ios.mm @@ -287,20 +287,10 @@ namespace ios_adm { int32_t AudioDeviceModuleIOS::SetStereoRecording(bool enable) { RTC_LOG(INFO) << __FUNCTION__ << "(" << enable << ")"; CHECKinitialized_(); - if (audio_device_->RecordingIsInitialized()) { - RTC_LOG(WARNING) << "recording in stereo is not supported"; - return -1; - } - if (audio_device_->SetStereoRecording(enable) == -1) { - RTC_LOG(WARNING) << "failed to change stereo recording"; - return -1; - } - int8_t nChannels(1); if (enable) { - nChannels = 2; + RTC_LOG(WARNING) << "recording in stereo is not supported"; } - audio_device_buffer_.get()->SetRecordingChannels(nChannels); - return 0; + return -1; } int32_t AudioDeviceModuleIOS::StereoRecording(bool* enabled) const {