]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
use the module pool for the RTP sessions instead of the session pool
authorMoises Silva <moy@sangoma.com>
Fri, 26 Mar 2010 16:20:51 +0000 (16:20 +0000)
committerMoises Silva <moy@sangoma.com>
Fri, 26 Mar 2010 16:20:51 +0000 (16:20 +0000)
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

index 0f6ae4ad558beb3160acdb443823635a0b944df9..38d4fe8401905f5f32a2a836648e2d94ba5a56db 100644 (file)
@@ -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;