From 82821945647d8f72d2518cd9dcd2e53bd0ff1112 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Fri, 26 Mar 2010 16:20:51 +0000 Subject: [PATCH] use the module pool for the RTP sessions instead of the session pool git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@17111 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c index 0f6ae4ad55..38d4fe8401 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -72,6 +72,9 @@ unsigned long long g_next_session_id = 0; /* hash of sessions (I think a linked list suits better here, but FS does not have the data type) */ switch_hash_t *g_sessions_hash = NULL; +/* global memory pool provided by FS */ +switch_memory_pool_t *g_pool = NULL; + typedef struct vocallo_codec_s { int codec_id; /* vocallo codec ID */ int iana; /* IANA code to register in FS */ @@ -196,13 +199,14 @@ static int sangoma_create_rtp(void *usr_priv, sngtc_codec_request_leg_t *codec_r local_ip, rtp_port, codec_ip, codec_reply_leg->codec_udp_port, iana, codec_reg_leg->sample_rate, codec_reg_leg->ms*1000, sess->sessid); - /* create the RTP socket */ + /* create the RTP socket, dont use the session pool since the session may go away while the RTP socket should linger around + * until sangoma_transcode decides to kill it */ rtp_session = switch_rtp_new(local_ip, rtp_port, codec_ip, codec_reply_leg->codec_udp_port, iana, codec_reg_leg->ms*8, /* samples per interval, FIXME: do based on sampling rate */ codec_reg_leg->ms*1000, /* ms per packet */ - flags, NULL, &err, sess->pool); + flags, NULL, &err, g_pool); if (!rtp_session) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to create switch rtp session: %s\n", err); @@ -900,6 +904,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) return SWITCH_STATUS_FALSE; } + g_pool = pool; + g_init_cfg.log = sangoma_logger; g_init_cfg.create_rtp = sangoma_create_rtp; g_init_cfg.destroy_rtp = sangoma_destroy_rtp;