From 988acdb3f9c0c44560e0e0c24771947d4343cd2b Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Thu, 19 Jul 2018 18:53:03 -0300 Subject: [PATCH] Set output sample rate at 24000 (with testing purposes only) --- libraries/audio-client/src/AudioClient.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/audio-client/src/AudioClient.cpp b/libraries/audio-client/src/AudioClient.cpp index 161cf162b1..8c0862f184 100644 --- a/libraries/audio-client/src/AudioClient.cpp +++ b/libraries/audio-client/src/AudioClient.cpp @@ -490,7 +490,7 @@ bool nativeFormatForAudioDevice(const QAudioDeviceInfo& audioDevice, // Using the HW sample rate (AUDIO_INPUT_FLAG_FAST) in some samsung phones causes a low volume at input stream // Changing the sample rate forces a resampling that (in samsung) amplifies +18 dB QAndroidJniObject brand = QAndroidJniObject::getStaticObjectField("android/os/Build", "BRAND"); - if (audioDevice == QAudioDeviceInfo::defaultInputDevice() && brand.toString().contains("samsung", Qt::CaseInsensitive)) { + if (brand.toString().contains("samsung", Qt::CaseInsensitive)) { audioFormat.setSampleRate(24000); } #endif @@ -1774,7 +1774,7 @@ bool AudioClient::switchOutputToAudioDevice(const QAudioDeviceInfo outputDeviceI _outputScratchBuffer = new int16_t[_outputPeriod]; // size local output mix buffer based on resampled network frame size - int networkPeriod = _localToOutputResampler->getMaxOutput(AudioConstants::NETWORK_FRAME_SAMPLES_STEREO); + int networkPeriod = _localToOutputResampler ? _localToOutputResampler->getMaxOutput(AudioConstants::NETWORK_FRAME_SAMPLES_STEREO) : AudioConstants::NETWORK_FRAME_SAMPLES_STEREO; _localOutputMixBuffer = new float[networkPeriod]; // local period should be at least twice the output period,