destroy codec

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12936 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2009-04-07 16:06:30 +00:00
parent bb5d54f698
commit 7e61b16d6b
1 changed files with 12 additions and 0 deletions

View File

@ -113,10 +113,12 @@ static switch_status_t tech_init(private_t *tech_pvt, switch_core_session_t *ses
if (tech_pvt->read_codec.implementation) {
switch_core_codec_destroy(&tech_pvt->read_codec);
memset(&tech_pvt->read_codec, 0, sizeof(tech_pvt->read_codec));
}
if (tech_pvt->write_codec.implementation) {
switch_core_codec_destroy(&tech_pvt->write_codec);
memset(&tech_pvt->write_codec, 0, sizeof(tech_pvt->write_codec));
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s setup codec %s/%d/%d\n", switch_channel_get_name(channel), iananame, rate, interval);
@ -366,6 +368,16 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session)
switch_core_timer_destroy(&tech_pvt->timer);
if (tech_pvt->read_codec.implementation) {
switch_core_codec_destroy(&tech_pvt->read_codec);
memset(&tech_pvt->read_codec, 0, sizeof(tech_pvt->read_codec));
}
if (tech_pvt->write_codec.implementation) {
switch_core_codec_destroy(&tech_pvt->write_codec);
memset(&tech_pvt->write_codec, 0, sizeof(tech_pvt->write_codec));
}
return SWITCH_STATUS_SUCCESS;
}