diff --git a/daemon/src/audio/audiortp/AudioRtpRecordHandler.cpp b/daemon/src/audio/audiortp/AudioRtpRecordHandler.cpp index 08cd50a8cae54d04feb42352da3c0cae3499724f..8e783314b77f5b8f87b7b5902d2d81a0c98bb989 100644 --- a/daemon/src/audio/audiortp/AudioRtpRecordHandler.cpp +++ b/daemon/src/audio/audiortp/AudioRtpRecordHandler.cpp @@ -103,7 +103,7 @@ void AudioRtpRecordHandler::initNoiseSuppress() delete _audioRtpRecord._noiseSuppress; - _audioRtpRecord._noiseSuppress = new NoiseSuppress (getCodecFrameSize(), getCodecSampleRate()); + _audioRtpRecord._noiseSuppress = new NoiseSuppress(getCodecFrameSize(), getCodecSampleRate()); _audioRtpRecord.audioProcessMutex.leave(); } @@ -146,14 +146,9 @@ int AudioRtpRecordHandler::processDataEncode (void) fadeIn (micData, samples, &_audioRtpRecord._micAmplFactor); - if(Manager::instance().getEchoCancelState() == "enabled") + if(Manager::instance().getEchoCancelState()) echoCanceller.getData(micData); - _audioRtpRecord.audioProcessMutex.enter(); - if (Manager::instance().audioPreference.getNoiseReduce()) - _audioRtpRecord._noiseSuppress->process(micData, samples); - _audioRtpRecord.audioProcessMutex.leave(); - #ifdef DUMP_PROCESS_DATA_ENCODE teststream.write(reinterpret_cast<char *>(micData), bytesToGet); #endif @@ -164,8 +159,14 @@ int AudioRtpRecordHandler::processDataEncode (void) _audioRtpRecord._converter->resample (micData, micDataConverted, codecSampleRate, mainBufferSampleRate, samplesToGet); } + if (Manager::instance().audioPreference.getNoiseReduce()) { + _audioRtpRecord.audioProcessMutex.enter(); + _audioRtpRecord._noiseSuppress->process(micData, getCodecFrameSize()); + _audioRtpRecord.audioProcessMutex.leave(); + } + _audioRtpRecord.audioCodecMutex.enter(); - int compSize = _audioRtpRecord._audioCodec->encode (micDataEncoded, out, DEC_BUFFER_SIZE); + int compSize = _audioRtpRecord._audioCodec->encode (micDataEncoded, out, getCodecFrameSize()); _audioRtpRecord.audioCodecMutex.leave(); return compSize; @@ -205,7 +206,7 @@ void AudioRtpRecordHandler::processDataDecode (unsigned char *spkrData, unsigned out = spkrDataConverted; } - if(Manager::instance().getEchoCancelState() == "enabled") + if(Manager::instance().getEchoCancelState()) echoCanceller.putData(out, outSamples); Manager::instance().getMainBuffer()->putData (out, outSamples * sizeof (SFLDataFormat), id_); } diff --git a/daemon/src/dbus/configurationmanager.cpp b/daemon/src/dbus/configurationmanager.cpp index 25c7a683e2e487b7dafd5db0bf8f0627b23457da..0d926bf9ec86589f72b022f521797dad143f68ea 100644 --- a/daemon/src/dbus/configurationmanager.cpp +++ b/daemon/src/dbus/configurationmanager.cpp @@ -288,7 +288,7 @@ void ConfigurationManager::setNoiseSuppressState (const std::string& state) std::string ConfigurationManager::getEchoCancelState(void) { - return Manager::instance().getEchoCancelState(); + return Manager::instance().getEchoCancelState() ? "enabled" : "disabled"; } void ConfigurationManager::setEchoCancelState(const std::string& state) diff --git a/daemon/src/managerimpl.cpp b/daemon/src/managerimpl.cpp index 222da33d093082b4f02ccff21cd220aff3b378e6..c918912d4472adec8fb75cfa6f33b1f1d1982d7c 100644 --- a/daemon/src/managerimpl.cpp +++ b/daemon/src/managerimpl.cpp @@ -2246,9 +2246,9 @@ void ManagerImpl::setNoiseSuppressState (const std::string &state) audioPreference.setNoiseReduce (state == "enabled"); } -std::string ManagerImpl::getEchoCancelState() const +bool ManagerImpl::getEchoCancelState() const { - return audioPreference.getEchoCancel() ? "enabled" : "disabled"; + return audioPreference.getEchoCancel(); } void ManagerImpl::setEchoCancelState(const std::string &state) diff --git a/daemon/src/managerimpl.h b/daemon/src/managerimpl.h index 024ec8992d91b70d2db5698e65421c8613796a47..44a046d83fc6989d3e63b86342013f346849d506 100644 --- a/daemon/src/managerimpl.h +++ b/daemon/src/managerimpl.h @@ -567,7 +567,7 @@ class ManagerImpl * Get the echo canceller engin state from * the current audio layer */ - std::string getEchoCancelState(void) const; + bool getEchoCancelState(void) const; /** * Set the echo canceller engin state