FSCORE-352

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12987 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2009-04-10 20:14:02 +00:00
parent ab6c4f1a6d
commit 73fe7bfdcc
9 changed files with 109 additions and 107 deletions

View File

@ -428,14 +428,12 @@ static void remove_pvt(private_t *tech_pvt)
static switch_status_t channel_on_destroy(switch_core_session_t *session)
{
switch_channel_t *channel = NULL;
private_t *tech_pvt = NULL;
//switch_channel_t *channel = NULL;
//private_t *tech_pvt = NULL;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
//channel = switch_core_session_get_channel(session);
//tech_pvt = switch_core_session_get_private(session);
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
return SWITCH_STATUS_SUCCESS;
}

View File

@ -1214,23 +1214,23 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session)
struct private_object *tech_pvt = NULL;
tech_pvt = switch_core_session_get_private(session);
switch_assert(tech_pvt != NULL);
if (tech_pvt->rtp_session) {
switch_rtp_destroy(&tech_pvt->rtp_session);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "NUKE RTP\n");
tech_pvt->rtp_session = NULL;
if (tech_pvt) {
if (tech_pvt->rtp_session) {
switch_rtp_destroy(&tech_pvt->rtp_session);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "NUKE RTP\n");
tech_pvt->rtp_session = NULL;
}
if (switch_core_codec_ready(&tech_pvt->read_codec)) {
switch_core_codec_destroy(&tech_pvt->read_codec);
}
if (switch_core_codec_ready(&tech_pvt->write_codec)) {
switch_core_codec_destroy(&tech_pvt->write_codec);
}
}
if (switch_core_codec_ready(&tech_pvt->read_codec)) {
switch_core_codec_destroy(&tech_pvt->read_codec);
}
if (switch_core_codec_ready(&tech_pvt->write_codec)) {
switch_core_codec_destroy(&tech_pvt->write_codec);
}
return SWITCH_STATUS_SUCCESS;
}

View File

@ -493,14 +493,14 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session)
{
private_t *tech_pvt = switch_core_session_get_private(session);
switch_assert(tech_pvt != NULL);
if (switch_core_codec_ready(&tech_pvt->read_codec)) {
switch_core_codec_destroy(&tech_pvt->read_codec);
}
if (!switch_core_codec_ready(&tech_pvt->write_codec)) {
switch_core_codec_destroy(&tech_pvt->write_codec);
if (tech_pvt) {
if (switch_core_codec_ready(&tech_pvt->read_codec)) {
switch_core_codec_destroy(&tech_pvt->read_codec);
}
if (!switch_core_codec_ready(&tech_pvt->write_codec)) {
switch_core_codec_destroy(&tech_pvt->write_codec);
}
}
return SWITCH_STATUS_SUCCESS;

View File

@ -353,16 +353,17 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session)
switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
switch_assert(tech_pvt != NULL);
switch_core_timer_destroy(&tech_pvt->timer);
if (switch_core_codec_ready(&tech_pvt->read_codec)) {
switch_core_codec_destroy(&tech_pvt->read_codec);
}
if (switch_core_codec_ready(&tech_pvt->write_codec)) {
switch_core_codec_destroy(&tech_pvt->write_codec);
if (tech_pvt) {
switch_core_timer_destroy(&tech_pvt->timer);
if (switch_core_codec_ready(&tech_pvt->read_codec)) {
switch_core_codec_destroy(&tech_pvt->read_codec);
}
if (switch_core_codec_ready(&tech_pvt->write_codec)) {
switch_core_codec_destroy(&tech_pvt->write_codec);
}
}

View File

@ -835,38 +835,36 @@ switch_status_t FSConnection::on_execute()
static switch_status_t on_destroy(switch_core_session_t *session)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
//switch_channel_t *channel = switch_core_session_get_channel(session);
opal_private_t *tech_pvt = (opal_private_t *) switch_core_session_get_private(session);
if (tech_pvt->read_codec.implementation) {
switch_core_codec_destroy(&tech_pvt->read_codec);
if (tech_pvt) {
if (tech_pvt->read_codec.implementation) {
switch_core_codec_destroy(&tech_pvt->read_codec);
}
if (tech_pvt->write_codec.implementation) {
switch_core_codec_destroy(&tech_pvt->write_codec);
}
if (tech_pvt->vid_read_codec.implementation) {
switch_core_codec_destroy(&tech_pvt->vid_read_codec);
}
if (tech_pvt->vid_write_codec.implementation) {
switch_core_codec_destroy(&tech_pvt->vid_write_codec);
}
if (tech_pvt->read_timer.timer_interface) {
switch_core_timer_destroy(&tech_pvt->read_timer);
}
if (tech_pvt->vid_read_timer.timer_interface) {
switch_core_timer_destroy(&tech_pvt->vid_read_timer);
}
}
if (tech_pvt->write_codec.implementation) {
switch_core_codec_destroy(&tech_pvt->write_codec);
}
if (tech_pvt->vid_read_codec.implementation) {
switch_core_codec_destroy(&tech_pvt->vid_read_codec);
}
if (tech_pvt->vid_write_codec.implementation) {
switch_core_codec_destroy(&tech_pvt->vid_write_codec);
}
if (tech_pvt->read_timer.timer_interface) {
switch_core_timer_destroy(&tech_pvt->read_timer);
}
if (tech_pvt->vid_read_timer.timer_interface) {
switch_core_timer_destroy(&tech_pvt->vid_read_timer);
}
switch_core_session_unset_read_codec(session);
switch_core_session_unset_write_codec(session);
return SWITCH_STATUS_SUCCESS;
}
/* this function has to be called with the original session beause the FSConnection might already be destroyed and we

View File

@ -195,15 +195,15 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session)
assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
if (switch_core_codec_ready(&tech_pvt->read_codec)) {
switch_core_codec_destroy(&tech_pvt->read_codec);
}
if (switch_core_codec_ready(&tech_pvt->write_codec)) {
switch_core_codec_destroy(&tech_pvt->write_codec);
if (tech_pvt) {
if (switch_core_codec_ready(&tech_pvt->read_codec)) {
switch_core_codec_destroy(&tech_pvt->read_codec);
}
if (switch_core_codec_ready(&tech_pvt->write_codec)) {
switch_core_codec_destroy(&tech_pvt->write_codec);
}
}
return SWITCH_STATUS_SUCCESS;

View File

@ -183,23 +183,24 @@ static switch_status_t channel_on_init(switch_core_session_t * session)
return SWITCH_STATUS_SUCCESS;
}
static switch_status_t channel_on_hangup(switch_core_session_t * session)
static switch_status_t channel_on_destroy(switch_core_session_t * session)
{
switch_channel_t *channel = NULL;
//switch_channel_t *channel = NULL;
private_t *tech_pvt = NULL;
channel = switch_core_session_get_channel(session);
switch_assert(channel != NULL);
//channel = switch_core_session_get_channel(session);
//switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
switch_assert(tech_pvt != NULL);
if (switch_core_codec_ready(&tech_pvt->read_codec)) {
switch_core_codec_destroy(&tech_pvt->read_codec);
}
if (switch_core_codec_ready(&tech_pvt->write_codec)) {
switch_core_codec_destroy(&tech_pvt->write_codec);
if (tech_pvt) {
if (switch_core_codec_ready(&tech_pvt->read_codec)) {
switch_core_codec_destroy(&tech_pvt->read_codec);
}
if (switch_core_codec_ready(&tech_pvt->write_codec)) {
switch_core_codec_destroy(&tech_pvt->write_codec);
}
}
return SWITCH_STATUS_SUCCESS;

View File

@ -239,23 +239,25 @@ switch_status_t sofia_on_destroy(switch_core_session_t *session)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA DESTROY\n", switch_channel_get_name(channel));
if (switch_core_codec_ready(&tech_pvt->read_codec)) {
switch_core_codec_destroy(&tech_pvt->read_codec);
if (tech_pvt) {
if (switch_core_codec_ready(&tech_pvt->read_codec)) {
switch_core_codec_destroy(&tech_pvt->read_codec);
}
if (switch_core_codec_ready(&tech_pvt->write_codec)) {
switch_core_codec_destroy(&tech_pvt->write_codec);
}
switch_core_session_unset_read_codec(session);
switch_core_session_unset_write_codec(session);
switch_mutex_lock(tech_pvt->profile->flag_mutex);
tech_pvt->profile->inuse--;
switch_mutex_unlock(tech_pvt->profile->flag_mutex);
sofia_glue_deactivate_rtp(tech_pvt);
}
if (switch_core_codec_ready(&tech_pvt->write_codec)) {
switch_core_codec_destroy(&tech_pvt->write_codec);
}
switch_core_session_unset_read_codec(session);
switch_core_session_unset_write_codec(session);
switch_mutex_lock(tech_pvt->profile->flag_mutex);
tech_pvt->profile->inuse--;
switch_mutex_unlock(tech_pvt->profile->flag_mutex);
sofia_glue_deactivate_rtp(tech_pvt);
return SWITCH_STATUS_SUCCESS;
}

View File

@ -934,18 +934,20 @@ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "unicall_on_execute(%p)\n
static switch_status_t unicall_on_destroy(switch_core_session_t *session)
{
switch_channel_t *channel;
//switch_channel_t *channel;
private_t *tech_pvt;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
//channel = switch_core_session_get_channel(session);
//assert(channel != NULL);
if (switch_core_codec_ready(&tech_pvt->read_codec))
switch_core_codec_destroy(&tech_pvt->read_codec);
if (switch_core_codec_ready(&tech_pvt->write_codec))
switch_core_codec_destroy(&tech_pvt->write_codec);
tech_pvt = switch_core_session_get_private(session);
if (tech_pvt) {
if (switch_core_codec_ready(&tech_pvt->read_codec))
switch_core_codec_destroy(&tech_pvt->read_codec);
if (switch_core_codec_ready(&tech_pvt->write_codec))
switch_core_codec_destroy(&tech_pvt->write_codec);
}
return SWITCH_STATUS_SUCCESS;