]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
tweak
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 19 Sep 2006 20:04:35 +0000 (20:04 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 19 Sep 2006 20:04:35 +0000 (20:04 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@2757 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_ivr.c
src/switch_rtp.c

index ef6aabea4515050297bfd9cf0f394c813826f9ec..633f6345a65a8355990806fcfe485c52a37676e4 100644 (file)
@@ -1809,7 +1809,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                        peer_channels[i] = NULL;
                        peer_sessions[i] = NULL;
                        continue;
-               } 
+               }
+
+               switch_core_session_read_lock(peer_sessions[i]);
                pool = NULL;
        
                peer_channels[i] = switch_core_session_get_channel(peer_sessions[i]);
@@ -1986,6 +1988,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                switch_core_codec_destroy(&write_codec);
        }
 
+       for (i = 0; i < argc; i++) {
+               if (!peer_channels[i]) {
+                       continue;
+               }
+               switch_core_session_rwunlock(peer_sessions[i]);
+       }
+
        return status;
 }
 
index 9f6c6a177133393f49cfd05b18ec5c321bda863e..338125042ef747d1ca418994d199f5c4e6d1165e 100644 (file)
@@ -584,10 +584,15 @@ SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session)
        }
 
        switch_mutex_lock((*rtp_session)->flag_mutex);
+       
+       if ((*rtp_session)->packet_buffer) {
+               switch_buffer_destroy(&(*rtp_session)->packet_buffer);
+       }
+                       
        switch_rtp_kill_socket(*rtp_session);
        switch_socket_close((*rtp_session)->sock);
        (*rtp_session)->sock = NULL;
-       switch_mutex_unlock((*rtp_session)->flag_mutex);
+
 
        if (switch_test_flag((*rtp_session), SWITCH_RTP_FLAG_VAD)) {
                switch_rtp_disable_vad(*rtp_session);
@@ -602,6 +607,8 @@ SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session)
                switch_core_timer_destroy(&(*rtp_session)->timer);
        }
 
+       switch_mutex_unlock((*rtp_session)->flag_mutex);
+
        return;
 }
 
@@ -1099,7 +1106,8 @@ static int rtp_common_write(switch_rtp_t *rtp_session, void *data, uint32_t data
                send_msg->header.m = m ? 1 : 0;
                if (packetize) {
                        if (!rtp_session->packet_buffer) {
-                               if (switch_buffer_create(rtp_session->pool, &rtp_session->packet_buffer, rtp_session->packet_size * 2) != SWITCH_STATUS_SUCCESS) {
+                               if (switch_buffer_create_dynamic(&rtp_session->packet_buffer, rtp_session->packet_size, rtp_session->packet_size * 2, 0) 
+                                       != SWITCH_STATUS_SUCCESS) {
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Buffer memory error\n");
                                        return -1;
                                }