Fix stop logging errors for stereo mode when it is not used

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 <kthelgason@webrtc.org>
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26133}
This commit is contained in:
Gustavo Garcia 2018-12-19 10:37:16 +01:00 committed by Commit Bot
parent 1ebfb6aac7
commit ff98f4b1d8
2 changed files with 7 additions and 14 deletions

View File

@ -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);

View File

@ -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 {