Fixed threading exception on Mac.

Bug: webrtc:8128
Change-Id: I7bdada77e5937631fa2d8c3020ed56a0e33065f1
Reviewed-on: https://webrtc-review.googlesource.com/7221
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Peter Hanspers <peterhanspers@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20239}
This commit is contained in:
Peter Hanspers
2017-10-06 14:13:51 +02:00
committed by Commit Bot
parent 0a1140e3a0
commit d931705f84

View File

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