From 5ff70fb5b68c8017f8bfe586c31cf8517d334e53 Mon Sep 17 00:00:00 2001 From: Alexandre Savard <alexandre.savard@savoirfairelinux.com> Date: Fri, 27 Apr 2012 17:32:53 -0400 Subject: [PATCH] #10016: Crypto context deletion are now managed inside the library --- daemon/src/audio/audiortp/audio_srtp_session.cpp | 10 ++++++---- daemon/src/audio/pulseaudio/pulselayer.cpp | 2 +- daemon/src/sip/sdp.cpp | 1 + daemon/src/sip/sipvoiplink.cpp | 4 ++++ 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/daemon/src/audio/audiortp/audio_srtp_session.cpp b/daemon/src/audio/audiortp/audio_srtp_session.cpp index b6c3d94df8..d8a6f6fd8f 100644 --- a/daemon/src/audio/audiortp/audio_srtp_session.cpp +++ b/daemon/src/audio/audiortp/audio_srtp_session.cpp @@ -264,7 +264,8 @@ void AudioSrtpSession::initializeRemoteCryptoContext() const CryptoSuiteDefinition &crypto = sfl::CryptoSuites[remoteCryptoSuite_]; - delete remoteCryptoCtx_; + // delete this crypto context from the internal map + removeInQueueCryptoContext(remoteCryptoCtx_); remoteCryptoCtx_ = new ost::CryptoContext(0x0, 0, // roc, 0L, // keydr, @@ -287,7 +288,8 @@ void AudioSrtpSession::initializeLocalCryptoContext() const CryptoSuiteDefinition &crypto = sfl::CryptoSuites[localCryptoSuite_]; - delete localCryptoCtx_; + // delete this crypto context from the internal map + removeOutQueueCryptoContext(localCryptoCtx_); localCryptoCtx_ = new ost::CryptoContext(OutgoingDataQueue::getLocalSSRC(), 0, // roc, 0L, // keydr, @@ -307,11 +309,11 @@ void AudioSrtpSession::restoreCryptoContext(ost::CryptoContext *localContext, ost::CryptoContext *remoteContext) { if (remoteCryptoCtx_ != remoteContext) { - delete remoteCryptoCtx_; + removeInQueueCryptoContext(remoteCryptoCtx_); remoteCryptoCtx_ = remoteContext; } if (localCryptoCtx_ != localContext) { - delete localCryptoCtx_; + removeOutQueueCryptoContext(localCryptoCtx_); localCryptoCtx_ = localContext; } setInQueueCryptoContext(remoteCryptoCtx_); diff --git a/daemon/src/audio/pulseaudio/pulselayer.cpp b/daemon/src/audio/pulseaudio/pulselayer.cpp index a930f5a109..ec672a8ba6 100644 --- a/daemon/src/audio/pulseaudio/pulselayer.cpp +++ b/daemon/src/audio/pulseaudio/pulselayer.cpp @@ -398,7 +398,7 @@ void PulseLayer::readFromMic() size_t bytes; if (pa_stream_peek(record_->pulseStream() , (const void**) &data , &bytes) < 0 or !data) { - ERROR("Audio: Error capture stream peek failed: %s" , pa_strerror(pa_context_errno(context_))); + // ERROR("Audio: Error capture stream peek failed: %s" , pa_strerror(pa_context_errno(context_))); return; } diff --git a/daemon/src/sip/sdp.cpp b/daemon/src/sip/sdp.cpp index 8fa3010bc0..d38e6c42df 100644 --- a/daemon/src/sip/sdp.cpp +++ b/daemon/src/sip/sdp.cpp @@ -410,6 +410,7 @@ void Sdp::getRemoteSdpCryptoFromOffer(const pjmedia_sdp_session* remote_sdp, Cry pjmedia_sdp_attr *attribute = media->attr[j]; // @TODO our parser require the "a=crypto:" to be present + ERROR(" attribute %s", pj_strbuf(&attribute->name)); if (pj_stricmp2(&attribute->name, "crypto") == 0) crypto_offer.push_back("a=crypto:" + std::string(attribute->value.ptr, attribute->value.slen)); } diff --git a/daemon/src/sip/sipvoiplink.cpp b/daemon/src/sip/sipvoiplink.cpp index 1dc9c62250..92fb85b364 100644 --- a/daemon/src/sip/sipvoiplink.cpp +++ b/daemon/src/sip/sipvoiplink.cpp @@ -1402,9 +1402,13 @@ void sdp_media_update_cb(pjsip_inv_session *inv, pj_status_t status) Manager::instance().getDbusManager()->getCallManager()->secureSdesOn(call->getCallId()); } else { + ERROR("UserAgent: SDES negotiation failure"); Manager::instance().getDbusManager()->getCallManager()->secureSdesOff(call->getCallId()); } } + else { + DEBUG("UserAgent: No crypto offer available"); + } // We did not find any crypto context for this media, RTP fallback if (!nego_success && call->getAudioRtp().isSdesEnabled()) { -- GitLab