mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
* #6596: create local SDP on the stack, not the heap
This commit is contained in:
@ -54,12 +54,16 @@ AudioSymmetricRtpSession::AudioSymmetricRtpSession (SIPCall * sipcall) :
|
||||
|
||||
AudioSymmetricRtpSession::~AudioSymmetricRtpSession()
|
||||
{
|
||||
// XXX: DON'T call any members of this (i.e. AudioSymmetricRtpSession and
|
||||
// the classes from which it is derived, or touch any of their data
|
||||
_info ("AudioSymmetricRtpSession: Delete AudioSymmetricRtpSession instance");
|
||||
}
|
||||
|
||||
void AudioSymmetricRtpSession::final()
|
||||
{
|
||||
delete _rtpThread;
|
||||
|
||||
// See: http://www.parashift.com/c++-faq-lite/freestore-mgmt.html#faq-16.15
|
||||
delete this;
|
||||
}
|
||||
|
||||
|
@ -648,6 +648,7 @@ Sdp::~Sdp()
|
||||
|
||||
for (iter = localAudioMediaCap_.begin(); iter != localAudioMediaCap_.end(); ++iter)
|
||||
delete *iter;
|
||||
pj_pool_release (memPool_);
|
||||
}
|
||||
|
||||
|
||||
|
@ -46,28 +46,18 @@ SIPCall::SIPCall (const std::string& id, Call::CallType type, pj_caching_pool *c
|
||||
, _audiortp (new sfl::AudioRtpFactory(this))
|
||||
, _xferSub (NULL)
|
||||
, _invSession (NULL)
|
||||
, _local_sdp (NULL)
|
||||
, pool_(NULL)
|
||||
, pool_(pj_pool_create(&caching_pool->factory, id.c_str(), CALL_MEMPOOL_INIT_SIZE,
|
||||
CALL_MEMPOOL_INC_SIZE, NULL))
|
||||
, local_sdp_(pool_)
|
||||
{
|
||||
_debug ("SIPCall: Create new call %s", id.c_str());
|
||||
|
||||
// Create memory pool for application, initialization value is based on empiric values.
|
||||
pool_ = pj_pool_create (&caching_pool->factory, id.c_str(), CALL_MEMPOOL_INIT_SIZE,
|
||||
CALL_MEMPOOL_INC_SIZE, NULL);
|
||||
|
||||
_local_sdp = new Sdp (pool_);
|
||||
}
|
||||
|
||||
SIPCall::~SIPCall()
|
||||
{
|
||||
_debug ("SIPCall: Delete call");
|
||||
|
||||
_debug ("SDP: pool capacity %d", pj_pool_get_capacity (pool_));
|
||||
_debug ("SDP: pool size %d", pj_pool_get_used_size (pool_));
|
||||
|
||||
pj_pool_release (pool_);
|
||||
pool_ = 0;
|
||||
// Release memory allocated for SDP
|
||||
delete _local_sdp;
|
||||
delete _audiortp;
|
||||
}
|
||||
|
@ -33,9 +33,9 @@
|
||||
#define SIPCALL_H
|
||||
|
||||
#include "call.h"
|
||||
#include "sdp.h"
|
||||
#include <cassert>
|
||||
|
||||
class Sdp;
|
||||
class pjsip_evsub;
|
||||
class pj_caching_pool;
|
||||
class pj_pool_t;
|
||||
@ -96,7 +96,7 @@ class SIPCall : public Call
|
||||
* Return the local SDP session
|
||||
*/
|
||||
Sdp* getLocalSDP (void) {
|
||||
return _local_sdp;
|
||||
return &local_sdp_;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -110,7 +110,6 @@ class SIPCall : public Call
|
||||
* Return the local memory pool for this call
|
||||
*/
|
||||
pj_pool_t *getMemoryPool(void) {
|
||||
assert(pool_);
|
||||
return pool_;
|
||||
}
|
||||
|
||||
@ -162,16 +161,15 @@ class SIPCall : public Call
|
||||
*/
|
||||
pjsip_inv_session *_invSession;
|
||||
|
||||
/**
|
||||
* The SDP session
|
||||
*/
|
||||
Sdp *_local_sdp;
|
||||
|
||||
/**
|
||||
* The pool to allocate memory, released once call hang up
|
||||
*/
|
||||
pj_pool_t *pool_;
|
||||
|
||||
/**
|
||||
* The SDP session
|
||||
*/
|
||||
Sdp local_sdp_;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user