Skip to content
Snippets Groups Projects
Commit e5ddc0f1 authored by asavard's avatar asavard
Browse files

[#4367] Fix AudioRtpSession putDtmfEvent shadowing

parent 71d6b7bf
Branches
Tags
No related merge requests found
...@@ -62,6 +62,7 @@ AudioRtpRecord::AudioRtpRecord(ManagerImpl *manager) : _audioCodec(NULL) ...@@ -62,6 +62,7 @@ AudioRtpRecord::AudioRtpRecord(ManagerImpl *manager) : _audioCodec(NULL)
_audioLayerFrameSize = Manager::instance().getAudioDriver()->getFrameSize(); // in ms _audioLayerFrameSize = Manager::instance().getAudioDriver()->getFrameSize(); // in ms
_audioLayerSampleRate = Manager::instance().getAudioDriver()->getSampleRate(); _audioLayerSampleRate = Manager::instance().getAudioDriver()->getSampleRate();
} }
...@@ -308,6 +309,16 @@ void AudioRtpRecord::setSpkrFadeInComplete(bool _spkrFadeInComplete) ...@@ -308,6 +309,16 @@ void AudioRtpRecord::setSpkrFadeInComplete(bool _spkrFadeInComplete)
this->_spkrFadeInComplete = _spkrFadeInComplete; this->_spkrFadeInComplete = _spkrFadeInComplete;
} }
void AudioRtpRecord::setAudioProcessing(AudioProcessing *audioProcess)
{
this->_audioProcess = audioProcess;
}
void AudioRtpRecord::setNoiseSuppress(NoiseSuppress *noiseSuppress)
{
this->_noiseSuppress = noiseSuppress;
}
AudioRtpRecordHandler::AudioRtpRecordHandler(ManagerImpl *manager, SIPCall *ca) : _audioRtpRecord(manager), _ca(ca) { AudioRtpRecordHandler::AudioRtpRecordHandler(ManagerImpl *manager, SIPCall *ca) : _audioRtpRecord(manager), _ca(ca) {
// TODO Auto-generated constructor stub // TODO Auto-generated constructor stub
...@@ -365,6 +376,15 @@ void AudioRtpRecordHandler::initBuffers() ...@@ -365,6 +376,15 @@ void AudioRtpRecordHandler::initBuffers()
Manager::instance().addStream(_ca->getCallId()); Manager::instance().addStream(_ca->getCallId());
} }
void AudioRtpRecordHandler::initNoiseSuppress()
{
NoiseSuppress *noiseSuppress = new NoiseSuppress (getCodecFrameSize(), getCodecSampleRate());
AudioProcessing *processing = new AudioProcessing (noiseSuppress);
_audioRtpRecord.setNoiseSuppress(noiseSuppress);
_audioRtpRecord.setAudioProcessing(processing);
}
void AudioRtpRecordHandler::putDtmfEvent(int digit) void AudioRtpRecordHandler::putDtmfEvent(int digit)
{ {
sfl::DtmfEvent *dtmf = new sfl::DtmfEvent(); sfl::DtmfEvent *dtmf = new sfl::DtmfEvent();
......
...@@ -115,6 +115,8 @@ public: ...@@ -115,6 +115,8 @@ public:
void setSpkrDataConverted(SFLDataFormat *_spkrDataConverted); void setSpkrDataConverted(SFLDataFormat *_spkrDataConverted);
void setSpkrDataDecoded(SFLDataFormat *_spkrDataDecoded); void setSpkrDataDecoded(SFLDataFormat *_spkrDataDecoded);
void setSpkrFadeInComplete(bool _spkrFadeInComplete); void setSpkrFadeInComplete(bool _spkrFadeInComplete);
void setAudioProcessing(AudioProcessing *audioProcess);
void setNoiseSuppress(NoiseSuppress *noiseSuppress);
private: private:
AudioCodec *_audioCodec; AudioCodec *_audioCodec;
...@@ -192,6 +194,8 @@ public: ...@@ -192,6 +194,8 @@ public:
*/ */
void initBuffers (void); void initBuffers (void);
void initNoiseSuppress (void);
/** /**
* Encode audio data from mainbuffer * Encode audio data from mainbuffer
*/ */
......
...@@ -53,7 +53,7 @@ AudioRtpSession::AudioRtpSession (ManagerImpl * manager, SIPCall * sipcall) : ...@@ -53,7 +53,7 @@ AudioRtpSession::AudioRtpSession (ManagerImpl * manager, SIPCall * sipcall) :
, _countNotificationTime (0) , _countNotificationTime (0)
, _ca (sipcall) , _ca (sipcall)
{ {
setCancel (cancelDefault); this->setCancel (cancelDefault);
assert (_ca); assert (_ca);
...@@ -66,7 +66,7 @@ AudioRtpSession::~AudioRtpSession() ...@@ -66,7 +66,7 @@ AudioRtpSession::~AudioRtpSession()
_debug ("AudioRtpSession: Delete AudioRtpSession instance"); _debug ("AudioRtpSession: Delete AudioRtpSession instance");
try { try {
terminate(); this->terminate();
} catch (...) { } catch (...) {
_debugException ("AudioRtpSession: Thread destructor didn't terminate correctly"); _debugException ("AudioRtpSession: Thread destructor didn't terminate correctly");
throw; throw;
...@@ -266,7 +266,9 @@ int AudioRtpSession::startRtpThread (AudioCodec* audiocodec) ...@@ -266,7 +266,9 @@ int AudioRtpSession::startRtpThread (AudioCodec* audiocodec)
setSessionTimeouts(); setSessionTimeouts();
setSessionMedia (audiocodec); setSessionMedia (audiocodec);
initBuffers(); initBuffers();
return start (_mainloopSemaphore); int ret = this->start (_mainloopSemaphore);
this->startRunning();
return ret;
} }
void AudioRtpSession::run () void AudioRtpSession::run ()
...@@ -284,6 +286,8 @@ void AudioRtpSession::run () ...@@ -284,6 +286,8 @@ void AudioRtpSession::run ()
threadSleep = getAudioLayerFrameSize(); threadSleep = getAudioLayerFrameSize();
} }
initNoiseSuppress();
TimerPort::setTimer (threadSleep); TimerPort::setTimer (threadSleep);
// Set recording sampling rate // Set recording sampling rate
...@@ -291,7 +295,7 @@ void AudioRtpSession::run () ...@@ -291,7 +295,7 @@ void AudioRtpSession::run ()
// Start audio stream (if not started) AND flush all buffers (main and urgent) // Start audio stream (if not started) AND flush all buffers (main and urgent)
_manager->getAudioDriver()->startStream(); _manager->getAudioDriver()->startStream();
startRunning(); // startRunning();
_debug ("AudioRtpSession: Entering mainloop for call %s",_ca->getCallId().c_str()); _debug ("AudioRtpSession: Entering mainloop for call %s",_ca->getCallId().c_str());
......
...@@ -335,6 +335,8 @@ void AudioZrtpSession::run () ...@@ -335,6 +335,8 @@ void AudioZrtpSession::run ()
threadSleep = getAudioLayerFrameSize(); threadSleep = getAudioLayerFrameSize();
} }
initNoiseSuppress();
TimerPort::setTimer (threadSleep); TimerPort::setTimer (threadSleep);
// Set recording sampling rate // Set recording sampling rate
...@@ -348,6 +350,8 @@ void AudioZrtpSession::run () ...@@ -348,6 +350,8 @@ void AudioZrtpSession::run ()
while (!testCancel()) { while (!testCancel()) {
_debug("run");
// Reset timestamp to make sure the timing information are up to date // Reset timestamp to make sure the timing information are up to date
if (_timestampCount > RTP_TIMESTAMP_RESET_FREQ) { if (_timestampCount > RTP_TIMESTAMP_RESET_FREQ) {
_timestamp = getCurrentTimestamp(); _timestamp = getCurrentTimestamp();
......
...@@ -3727,6 +3727,7 @@ void ManagerImpl::loadIptoipProfile() ...@@ -3727,6 +3727,7 @@ void ManagerImpl::loadIptoipProfile()
// build a default IP2IP account with default parameters // build a default IP2IP account with default parameters
_directIpAccount = AccountCreator::createAccount (AccountCreator::SIP_DIRECT_IP_ACCOUNT, ""); _directIpAccount = AccountCreator::createAccount (AccountCreator::SIP_DIRECT_IP_ACCOUNT, "");
_accountMap[IP2IP_PROFILE] = _directIpAccount; _accountMap[IP2IP_PROFILE] = _directIpAccount;
_accountMap[""] = _directIpAccount;
if (_directIpAccount == NULL) { if (_directIpAccount == NULL) {
_error ("Manager: Failed to create default \"account\""); _error ("Manager: Failed to create default \"account\"");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment