Revision
17111
Author
moy
Date
2010-03-26 11:20:51 -0500 (Fri, 26 Mar 2010)

Log Message

use the module pool for the RTP sessions instead of the session pool

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c (17110 => 17111)


--- freeswitch/trunk/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c	2010-03-26 15:14:44 UTC (rev 17110)
+++ freeswitch/trunk/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c	2010-03-26 16:20:51 UTC (rev 17111)
@@ -72,6 +72,9 @@
 /* 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 @@
 					  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 @@
 		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;