Allow AEC with device sample rate up to 96KHz

This commit is contained in:
Ken Cooke 2019-07-26 12:18:30 -07:00 committed by Seth Alves
parent 5c86c22076
commit bd0849fd4f
2 changed files with 4 additions and 8 deletions

View file

@ -1145,12 +1145,10 @@ void AudioClient::processWebrtcFarEnd(const int16_t* samples, int numFrames, int
const webrtc::StreamConfig streamConfig = webrtc::StreamConfig(sampleRate, numChannels);
const int numChunk = (int)streamConfig.num_frames();
if (sampleRate > webrtc::AudioProcessing::kMaxNativeSampleRateHz) {
qCWarning(audioclient) << "WebRTC does not support" << sampleRate << "output sample rate.";
if (sampleRate > WEBRTC_SAMPLE_RATE_MAX) {
return;
}
if (numChannels > WEBRTC_CHANNELS_MAX) {
qCWarning(audioclient) << "WebRTC does not support" << numChannels << "output channels.";
return;
}
@ -1186,16 +1184,13 @@ void AudioClient::processWebrtcNearEnd(int16_t* samples, int numFrames, int numC
const webrtc::StreamConfig streamConfig = webrtc::StreamConfig(sampleRate, numChannels);
const int numChunk = (int)streamConfig.num_frames();
if (sampleRate > webrtc::AudioProcessing::kMaxNativeSampleRateHz) {
qCWarning(audioclient) << "WebRTC does not support" << sampleRate << "input sample rate.";
if (sampleRate > WEBRTC_SAMPLE_RATE_MAX) {
return;
}
if (numChannels > WEBRTC_CHANNELS_MAX) {
qCWarning(audioclient) << "WebRTC does not support" << numChannels << "input channels.";
return;
}
if (numFrames != numChunk) {
qCWarning(audioclient) << "WebRTC requires exactly 10ms of input.";
return;
}

View file

@ -423,8 +423,9 @@ private:
void handleLocalEchoAndReverb(QByteArray& inputByteArray);
#if defined(WEBRTC_ENABLED)
static const int WEBRTC_FRAMES_MAX = webrtc::AudioProcessing::kChunkSizeMs * webrtc::AudioProcessing::kMaxNativeSampleRateHz / 1000;
static const int WEBRTC_SAMPLE_RATE_MAX = 96000;
static const int WEBRTC_CHANNELS_MAX = 2;
static const int WEBRTC_FRAMES_MAX = webrtc::AudioProcessing::kChunkSizeMs * WEBRTC_SAMPLE_RATE_MAX / 1000;
webrtc::AudioProcessing* _apm { nullptr };