diff --git a/sflphone-common/src/iax/iaxvoiplink.cpp b/sflphone-common/src/iax/iaxvoiplink.cpp index a9d4f117ea361c1fdba5731c715dcc57b9b2c77e..a997aa4f19a57223b6e308f80cfd4a3e62d33191 100644 --- a/sflphone-common/src/iax/iaxvoiplink.cpp +++ b/sflphone-common/src/iax/iaxvoiplink.cpp @@ -51,20 +51,26 @@ #define CHK_VALID_CALL if (call == NULL) { _debug("IAX: Call doesn't exists"); \ return false; } -IAXVoIPLink::IAXVoIPLink (const AccountID& accountID) - : VoIPLink (accountID) +IAXVoIPLink::IAXVoIPLink (const AccountID& accountID) : VoIPLink (accountID) + , _evThread (NULL) + , _regSession (NULL) + , _nextRefreshStamp (0) + , audiolayer (NULL) + , micData (NULL) + , micDataConverted (NULL) + , micDataEncoded (NULL) + , spkrDataDecoded (NULL) + , spkrDataConverted (NULL) + , converter (NULL) + , converterSamplingRate (NULL) + , urlhook (NULL) + , countTime (0) { - // _debug("IAXVoIPLink::IAXVoIPLink : creating eventhread "); _evThread = new EventThread (this); - _regSession = NULL; - _nextRefreshStamp = 0; - countTime = 0; // to get random number for RANDOM_PORT srand (time (NULL)); - audiolayer = NULL; - converter = new SamplerateConverter(); int nbSamplesMax = (int) (converter->getFrequence() * converter->getFramesize() / 1000); @@ -82,26 +88,46 @@ IAXVoIPLink::IAXVoIPLink (const AccountID& accountID) IAXVoIPLink::~IAXVoIPLink() { - delete _evThread; - _evThread = NULL; + if (_evThread) { + delete _evThread; + _evThread = NULL; + } + _regSession = NULL; // shall not delete it terminate(); audiolayer = NULL; - delete converter; + if (converter) { + delete converter; + converter = NULL; + } - delete [] micData; - micData = NULL; - delete [] micDataConverted; - micDataConverted = NULL; - delete [] micDataEncoded; - micDataEncoded = NULL; + if (micData) { + delete [] micData; + micData = NULL; + } + + if (micDataConverted) { + delete [] micDataConverted; + micDataConverted = NULL; + } + + if (micDataEncoded) { + delete [] micDataEncoded; + micDataEncoded = NULL; + } + + if (spkrDataDecoded) { + delete [] spkrDataDecoded; + spkrDataDecoded = NULL; + } + + if (spkrDataConverted) { + delete [] spkrDataConverted; + spkrDataConverted = NULL; + } - delete [] spkrDataDecoded; - spkrDataDecoded = NULL; - delete [] spkrDataConverted; - spkrDataConverted = NULL; } bool @@ -254,12 +280,6 @@ IAXVoIPLink::getEvent() sendAudioFromMic(); - if (call) { - call->recAudio.recData (spkrDataDecoded, micData, nbSampleForRec_, nbSampleForRec_); - - // Do the doodle-moodle to send audio from the microphone to the IAX channel. - } - // Do the doodle-moodle to send audio from the microphone to the IAX channel. // sendAudioFromMic(); @@ -537,7 +557,7 @@ IAXVoIPLink::answer (const CallID& id) bool IAXVoIPLink::hangup (const CallID& id) { - _debug ("IAXVoIPLink::hangup() : function called once hangup "); + _debug ("IAXVoIPLink: Hangup"); IAXCall* call = getIAXCall (id); std::string reason = "Dumped Call"; CHK_VALID_CALL; @@ -565,7 +585,7 @@ IAXVoIPLink::hangup (const CallID& id) bool IAXVoIPLink::peerHungup (const CallID& id) { - _debug ("IAXVoIPLink::peerHangup() : function called once hangup "); + _debug ("IAXVoIPLink: Peer hung up"); IAXCall* call = getIAXCall (id); std::string reason = "Dumped Call"; CHK_VALID_CALL; diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index a9ae013bd593f332910575240544be0cf4ed5dee..8520f647ef6fb2cc963478eabaac625cc48b4ff8 100644 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -3821,7 +3821,7 @@ void ManagerImpl::unloadAccountMap () while (iter != _accountMap.end()) { - _debug ("Unloading account %s", iter->first.c_str()); + _debug ("Manager: Unloading account %s", iter->first.c_str()); delete iter->second; iter->second = NULL;