Commit 75b772b1 authored by Alexandre Savard's avatar Alexandre Savard

#10335: Add a noise suppressor for incoming rtp streams

parent 2e29361d
......@@ -63,6 +63,7 @@ AudioRtpRecord::AudioRtpRecord() :
, dtmfQueue_()
, fadeFactor_(INIT_FADE_IN_FACTOR)
, noiseSuppressEncode_(0)
, noiseSuppressDecode_(0)
, audioProcessMutex_()
, callId_("")
, dtmfPayloadType_(101) // same as Asterisk
......@@ -79,6 +80,7 @@ AudioRtpRecord::~AudioRtpRecord()
delete converterDecode_;
delete audioCodec_;
delete noiseSuppressEncode_;
delete noiseSuppressDecode_;
}
......@@ -123,6 +125,8 @@ void AudioRtpRecordHandler::initNoiseSuppress()
ost::MutexLock lock(audioRtpRecord_.audioProcessMutex_);
delete audioRtpRecord_.noiseSuppressEncode_;
audioRtpRecord_.noiseSuppressEncode_ = new NoiseSuppress(getCodecFrameSize(), getCodecSampleRate());
delete audioRtpRecord_.noiseSuppressDecode_;
audioRtpRecord_.noiseSuppressDecode_ = new NoiseSuppress(getCodecFrameSize(), getCodecSampleRate());
}
void AudioRtpRecordHandler::putDtmfEvent(int digit)
......@@ -208,6 +212,13 @@ void AudioRtpRecordHandler::processDataDecode(unsigned char *spkrData, size_t si
inSamples = audioRtpRecord_.audioCodec_->decode(spkrDataDecoded, spkrData, size);
}
if (Manager::instance().audioPreference.getNoiseReduce()) {
ost::MutexLock lock(audioRtpRecord_.audioProcessMutex_);
assert(audioRtpRecord_.noiseSuppressDecode_);
audioRtpRecord_.noiseSuppressDecode_->process(spkrDataDecoded, getCodecFrameSize());
}
audioRtpRecord_.fadeInDecodedData(inSamples);
// Normalize incomming signal
......
......@@ -93,6 +93,7 @@ class AudioRtpRecord {
std::list<int> dtmfQueue_;
SFLDataFormat fadeFactor_;
NoiseSuppress *noiseSuppressEncode_;
NoiseSuppress *noiseSuppressDecode_;
ost::Mutex audioProcessMutex_;
std::string callId_;
unsigned int dtmfPayloadType_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment