From d931705f84afd4b0d0d10ee273ad446adbca6e6c Mon Sep 17 00:00:00 2001 From: Peter Hanspers Date: Fri, 6 Oct 2017 14:13:51 +0200 Subject: [PATCH] Fixed threading exception on Mac. Bug: webrtc:8128 Change-Id: I7bdada77e5937631fa2d8c3020ed56a0e33065f1 Reviewed-on: https://webrtc-review.googlesource.com/7221 Reviewed-by: Henrik Andreassson Commit-Queue: Peter Hanspers Cr-Commit-Position: refs/heads/master@{#20239} --- modules/audio_device/mac/audio_device_mac.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/audio_device/mac/audio_device_mac.cc b/modules/audio_device/mac/audio_device_mac.cc index fdeaaf13a2..c0287c979e 100644 --- a/modules/audio_device/mac/audio_device_mac.cc +++ b/modules/audio_device/mac/audio_device_mac.cc @@ -2035,6 +2035,12 @@ int32_t AudioDeviceMac::HandleStreamFormatChange( return -1; } + if (_ptrAudioBuffer && streamFormat.mChannelsPerFrame != _recChannels) { + LOG(LS_ERROR) << "Changing channels not supported (mChannelsPerFrame = " + << streamFormat.mChannelsPerFrame << ")"; + return -1; + } + LOG(LS_VERBOSE) << "Stream format:"; LOG(LS_VERBOSE) << "mSampleRate = " << streamFormat.mSampleRate << ", mChannelsPerFrame = " << streamFormat.mChannelsPerFrame; @@ -2068,12 +2074,6 @@ int32_t AudioDeviceMac::HandleStreamFormatChange( LOG(LS_VERBOSE) << "Stereo recording unavailable on this device"; } - if (_ptrAudioBuffer) { - // Update audio buffer with the selected parameters - _ptrAudioBuffer->SetRecordingSampleRate(N_REC_SAMPLES_PER_SEC); - _ptrAudioBuffer->SetRecordingChannels((uint8_t)_recChannels); - } - // Recreate the converter with the new format // TODO(xians): make this thread safe WEBRTC_CA_RETURN_ON_ERR(AudioConverterDispose(_captureConverter));