Commit 5c5f9ed5 authored by Adrien Béraud's avatar Adrien Béraud

sip: register thread on pool destruction

Change-Id: I9f5bb169861f841e3efafbeae1b3f321b3df1a5b
parent 27693882
......@@ -110,7 +110,7 @@ public:
IpAddr getLocalAddress(unsigned comp_id) const;
IpAddr getRemoteAddress(unsigned comp_id) const;
std::unique_ptr<pj_pool_t, decltype(pj_pool_release)&> pool_;
std::unique_ptr<pj_pool_t, std::function<void(pj_pool_t*)>> pool_;
IceTransportCompleteCb on_initdone_cb_;
IceTransportCompleteCb on_negodone_cb_;
std::unique_ptr<pj_ice_strans, IceSTransDeleter> icest_;
......@@ -251,7 +251,7 @@ add_turn_server(pj_pool_t& pool, pj_ice_strans_cfg& cfg, const TurnServerInfo& i
IceTransport::Impl::Impl(const char* name, int component_count, bool master,
const IceTransportOptions& options)
: pool_(nullptr, pj_pool_release)
: pool_(nullptr, [](pj_pool_t* pool) { sip_utils::register_thread(); pj_pool_release(pool); })
, on_initdone_cb_(options.onInitDone)
, on_negodone_cb_(options.onNegoDone)
, component_count_(component_count)
......@@ -1133,7 +1133,7 @@ IceTransport::waitForData(int comp_id, unsigned int timeout, std::error_code& ec
IceTransportFactory::IceTransportFactory()
: cp_()
, pool_(nullptr, pj_pool_release)
, pool_(nullptr, [](pj_pool_t* pool) { sip_utils::register_thread(); pj_pool_release(pool); })
, ice_cfg_()
{
pj_caching_pool_init(&cp_, NULL, 0);
......
......@@ -195,7 +195,7 @@ public:
private:
pj_caching_pool cp_;
std::unique_ptr<pj_pool_t, decltype(pj_pool_release)&> pool_;
std::unique_ptr<pj_pool_t, std::function<void(pj_pool_t*)>> pool_;
pj_ice_strans_cfg ice_cfg_;
};
......
......@@ -58,7 +58,7 @@ static constexpr int POOL_INITIAL_SIZE = 16384;
static constexpr int POOL_INCREMENT_SIZE = POOL_INITIAL_SIZE;
Sdp::Sdp(const std::string& id)
: memPool_(nullptr, pj_pool_release)
: memPool_(nullptr, [](pj_pool_t* pool) { sip_utils::register_thread(); pj_pool_release(pool); })
, publishedIpAddr_()
, publishedIpAddrType_()
, sdesNego_ {CryptoSuites}
......
......@@ -240,7 +240,7 @@ class Sdp {
/**
* The pool to allocate memory
*/
std::unique_ptr<pj_pool_t, decltype(pj_pool_release)&> memPool_;
std::unique_ptr<pj_pool_t, std::function<void(pj_pool_t*)>> memPool_;
/** negotiator */
pjmedia_sdp_neg *negotiator_ {nullptr};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment