From 9590d2eef9b225fc4ab464f28ad59ec234fa082d Mon Sep 17 00:00:00 2001 From: Ken Cooke Date: Mon, 3 Oct 2016 09:08:32 -0700 Subject: [PATCH] Fix support for audio when input rate != output rate --- libraries/audio-client/src/AudioClient.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libraries/audio-client/src/AudioClient.cpp b/libraries/audio-client/src/AudioClient.cpp index 1250f74061..d867bf8b3c 100644 --- a/libraries/audio-client/src/AudioClient.cpp +++ b/libraries/audio-client/src/AudioClient.cpp @@ -817,6 +817,13 @@ void AudioClient::handleLocalEchoAndReverb(QByteArray& inputByteArray) { return; } + // NOTE: we assume the inputFormat and the outputFormat are the same, since on any modern + // multimedia OS they should be. If there is a device that this is not true for, we can + // add back support to do resampling. + if (_inputFormat.sampleRate() != _outputFormat.sampleRate()) { + return; + } + // if this person wants local loopback add that to the locally injected audio // if there is reverb apply it to local audio and substract the origin samples @@ -833,11 +840,6 @@ void AudioClient::handleLocalEchoAndReverb(QByteArray& inputByteArray) { } } - // NOTE: we assume the inputFormat and the outputFormat are the same, since on any modern - // multimedia OS they should be. If there is a device that this is not true for, we can - // add back support to do resampling. - Q_ASSERT(_inputFormat.sampleRate() == _outputFormat.sampleRate()); - static QByteArray loopBackByteArray; int numInputSamples = inputByteArray.size() / AudioConstants::SAMPLE_SIZE;