Skip to content
Snippets Groups Projects
Commit 25369192 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#2926] Code Cleanup

parent c891cd82
No related branches found
No related tags found
No related merge requests found
...@@ -125,14 +125,14 @@ void AudioRtpFactory::initAudioRtpSession (SIPCall * ca) ...@@ -125,14 +125,14 @@ void AudioRtpFactory::initAudioRtpSession (SIPCall * ca)
void AudioRtpFactory::start (void) void AudioRtpFactory::start (void)
{ {
if (_rtpSession == NULL) { if (_rtpSession == NULL) {
throw AudioRtpFactoryException ("_rtpSession was null when trying to start audio thread"); throw AudioRtpFactoryException ("RTP: Error: _rtpSession was null when trying to start audio thread");
} }
switch (_rtpSessionType) { switch (_rtpSessionType) {
case Sdes: case Sdes:
if (static_cast<AudioSrtpSession *> (_rtpSession)->startRtpThread() != 0) { if (static_cast<AudioSrtpSession *> (_rtpSession)->startRtpThread() != 0) {
throw AudioRtpFactoryException ("Failed to start AudioSRtpSession thread"); throw AudioRtpFactoryException ("RTP: Error: Failed to start AudioSRtpSession thread");
} }
break; break;
...@@ -140,7 +140,7 @@ void AudioRtpFactory::start (void) ...@@ -140,7 +140,7 @@ void AudioRtpFactory::start (void)
_debug ("Starting symmetric rtp thread"); _debug ("Starting symmetric rtp thread");
if (static_cast<AudioSymmetricRtpSession *> (_rtpSession)->startRtpThread() != 0) { if (static_cast<AudioSymmetricRtpSession *> (_rtpSession)->startRtpThread() != 0) {
throw AudioRtpFactoryException ("Failed to start AudioSymmetricRtpSession thread"); throw AudioRtpFactoryException ("RTP: Error: Failed to start AudioSymmetricRtpSession thread");
} }
break; break;
...@@ -148,9 +148,8 @@ void AudioRtpFactory::start (void) ...@@ -148,9 +148,8 @@ void AudioRtpFactory::start (void)
case Zrtp: case Zrtp:
if (static_cast<AudioZrtpSession *> (_rtpSession)->startRtpThread() != 0) { if (static_cast<AudioZrtpSession *> (_rtpSession)->startRtpThread() != 0) {
throw AudioRtpFactoryException ("Failed to start AudioZrtpSession thread"); throw AudioRtpFactoryException ("RTP: Error: Failed to start AudioZrtpSession thread");
} }
break; break;
} }
} }
...@@ -158,10 +157,10 @@ void AudioRtpFactory::start (void) ...@@ -158,10 +157,10 @@ void AudioRtpFactory::start (void)
void AudioRtpFactory::stop (void) void AudioRtpFactory::stop (void)
{ {
ost::MutexLock mutex (_audioRtpThreadMutex); ost::MutexLock mutex (_audioRtpThreadMutex);
_debug ("Stopping audio rtp session"); _info("RTP: Stopping audio rtp session");
if (_rtpSession == NULL) { if (_rtpSession == NULL) {
_debugException ("_rtpSession is null when trying to stop. Returning."); _debugException ("RTP: Error: _rtpSession is null when trying to stop. Returning.");
return; return;
} }
...@@ -183,16 +182,16 @@ void AudioRtpFactory::stop (void) ...@@ -183,16 +182,16 @@ void AudioRtpFactory::stop (void)
_rtpSession = NULL; _rtpSession = NULL;
} catch (...) { } catch (...) {
_debugException ("Exception caught when stopping the audio rtp session"); _debugException ("RTP: Error: Exception caught when stopping the audio rtp session");
throw AudioRtpFactoryException("caught exception in AudioRtpFactory::stop"); throw AudioRtpFactoryException("RTP: Error: caught exception in AudioRtpFactory::stop");
} }
} }
void AudioRtpFactory::updateDestinationIpAddress (void) void AudioRtpFactory::updateDestinationIpAddress (void)
{ {
_debug ("Updating IP address"); _info ("RTP: Updating IP address");
if (_rtpSession == NULL) { if (_rtpSession == NULL) {
throw AudioRtpFactoryException ("_rtpSession was null when trying to update IP address"); throw AudioRtpFactoryException ("RTP: Error: _rtpSession was null when trying to update IP address");
} }
switch (_rtpSessionType) { switch (_rtpSessionType) {
...@@ -216,7 +215,7 @@ sfl::AudioZrtpSession * AudioRtpFactory::getAudioZrtpSession() ...@@ -216,7 +215,7 @@ sfl::AudioZrtpSession * AudioRtpFactory::getAudioZrtpSession()
if ( (_rtpSessionType == Zrtp) && (_rtpSessionType != NULL)) { if ( (_rtpSessionType == Zrtp) && (_rtpSessionType != NULL)) {
return static_cast<AudioZrtpSession *> (_rtpSession); return static_cast<AudioZrtpSession *> (_rtpSession);
} else { } else {
throw AudioRtpFactoryException("_rtpSession is NULL in getAudioZrtpSession"); throw AudioRtpFactoryException("RTP: Error: _rtpSession is NULL in getAudioZrtpSession");
} }
} }
...@@ -226,9 +225,10 @@ sfl::AudioZrtpSession * AudioRtpFactory::getAudioZrtpSession() ...@@ -226,9 +225,10 @@ sfl::AudioZrtpSession * AudioRtpFactory::getAudioZrtpSession()
static_cast<AudioSrtpSession *> (_rtpSession)->setRemoteCryptoInfo(nego); static_cast<AudioSrtpSession *> (_rtpSession)->setRemoteCryptoInfo(nego);
} }
else { else {
throw AudioRtpFactoryException("_rtpSession is NULL in setRemoteCryptoInfo"); throw AudioRtpFactoryException("RTP: Error: _rtpSession is NULL in setRemoteCryptoInfo");
} }
} }
} }
...@@ -38,7 +38,6 @@ AudioZrtpSession::AudioZrtpSession (ManagerImpl * manager, SIPCall * sipcall, co ...@@ -38,7 +38,6 @@ AudioZrtpSession::AudioZrtpSession (ManagerImpl * manager, SIPCall * sipcall, co
{ {
_debug ("AudioZrtpSession initialized"); _debug ("AudioZrtpSession initialized");
initializeZid(); initializeZid();
// startZrtp();
} }
void AudioZrtpSession::initializeZid (void) void AudioZrtpSession::initializeZid (void)
......
...@@ -150,7 +150,6 @@ ZrtpSessionCallback::showMessage (GnuZrtpCodes::MessageSeverity sev, int32_t sub ...@@ -150,7 +150,6 @@ ZrtpSessionCallback::showMessage (GnuZrtpCodes::MessageSeverity sev, int32_t sub
msg = _infoMap[subCode]; msg = _infoMap[subCode];
if (msg != NULL) { if (msg != NULL) {
_debug ("ZRTP Debug:");
} }
} }
...@@ -158,7 +157,6 @@ ZrtpSessionCallback::showMessage (GnuZrtpCodes::MessageSeverity sev, int32_t sub ...@@ -158,7 +157,6 @@ ZrtpSessionCallback::showMessage (GnuZrtpCodes::MessageSeverity sev, int32_t sub
msg = _warningMap[subCode]; msg = _warningMap[subCode];
if (msg != NULL) { if (msg != NULL) {
_debug ("ZRTP Debug:");
} }
} }
...@@ -166,10 +164,11 @@ ZrtpSessionCallback::showMessage (GnuZrtpCodes::MessageSeverity sev, int32_t sub ...@@ -166,10 +164,11 @@ ZrtpSessionCallback::showMessage (GnuZrtpCodes::MessageSeverity sev, int32_t sub
msg = _severeMap[subCode]; msg = _severeMap[subCode];
if (msg != NULL) { if (msg != NULL) {
_debug ("ZRTP Debug:");
} }
} }
if (sev == ZrtpError) { if (sev == ZrtpError) {
if (subCode < 0) { // received an error packet from peer if (subCode < 0) { // received an error packet from peer
subCode *= -1; subCode *= -1;
...@@ -181,7 +180,7 @@ ZrtpSessionCallback::showMessage (GnuZrtpCodes::MessageSeverity sev, int32_t sub ...@@ -181,7 +180,7 @@ ZrtpSessionCallback::showMessage (GnuZrtpCodes::MessageSeverity sev, int32_t sub
msg = _zrtpMap[subCode]; msg = _zrtpMap[subCode];
if (msg != NULL) { if (msg != NULL) {
_debug ("ZRTP Debug: %s", msg->c_str());
} }
} }
} }
......
...@@ -489,9 +489,6 @@ void Sdp::set_negotiated_sdp (const pjmedia_sdp_session *sdp) ...@@ -489,9 +489,6 @@ void Sdp::set_negotiated_sdp (const pjmedia_sdp_session *sdp)
pjmedia_sdp_attr_to_rtpmap (_pool, attribute, &rtpmap); pjmedia_sdp_attr_to_rtpmap (_pool, attribute, &rtpmap);
// _debug("================== set_negociated_offer ===================== %i", pj_strtoul(&rtpmap->pt));
// _debug("================== set_negociated_offer ===================== %s", current->desc.fmt[j].ptr);
// _debug("================== set_negociated_offer ===================== %i", atoi(current->desc.fmt[j].ptr));
iter = codecs_list.find ( (AudioCodecType) pj_strtoul (&rtpmap->pt)); iter = codecs_list.find ( (AudioCodecType) pj_strtoul (&rtpmap->pt));
if (iter==codecs_list.end()) if (iter==codecs_list.end())
...@@ -627,7 +624,7 @@ void Sdp::set_remote_ip_from_sdp (const pjmedia_sdp_session *r_sdp) ...@@ -627,7 +624,7 @@ void Sdp::set_remote_ip_from_sdp (const pjmedia_sdp_session *r_sdp)
{ {
std::string remote_ip (r_sdp->conn->addr.ptr, r_sdp->conn->addr.slen); std::string remote_ip (r_sdp->conn->addr.ptr, r_sdp->conn->addr.slen);
_debug (" Remote IP from fetching SDP: %s", remote_ip.c_str()); _info ("SDP: Remote IP from fetching SDP: %s", remote_ip.c_str());
this->set_remote_ip (remote_ip); this->set_remote_ip (remote_ip);
} }
...@@ -637,21 +634,21 @@ void Sdp::set_remote_audio_port_from_sdp (pjmedia_sdp_media *r_media) ...@@ -637,21 +634,21 @@ void Sdp::set_remote_audio_port_from_sdp (pjmedia_sdp_media *r_media)
int remote_port; int remote_port;
remote_port = r_media->desc.port; remote_port = r_media->desc.port;
_debug (" Remote Audio Port from fetching SDP: %d", remote_port); _info ("SDP: Remote Audio Port from fetching SDP: %d", remote_port);
this->set_remote_audio_port (remote_port); this->set_remote_audio_port (remote_port);
} }
void Sdp::set_media_transport_info_from_remote_sdp (const pjmedia_sdp_session *remote_sdp) void Sdp::set_media_transport_info_from_remote_sdp (const pjmedia_sdp_session *remote_sdp)
{ {
_debug ("Fetching media from sdp"); _info ("SDP: Fetching media from sdp");
pjmedia_sdp_media *r_media; pjmedia_sdp_media *r_media;
this->get_remote_sdp_media_from_offer (remote_sdp, &r_media); this->get_remote_sdp_media_from_offer (remote_sdp, &r_media);
if (r_media==NULL) { if (r_media==NULL) {
_debug ("SDP Failure: no remote sdp media found in the remote offer"); _warn ("SDP: Error: no remote sdp media found in the remote offer");
return; return;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment