mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-17 01:02:12 +00:00
FSCORE-341
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12728 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
7b52ef1305
commit
523e0653ed
@ -103,7 +103,8 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha
|
|||||||
context->sfinfo.channels = handle->channels;
|
context->sfinfo.channels = handle->channels;
|
||||||
context->sfinfo.samplerate = handle->samplerate;
|
context->sfinfo.samplerate = handle->samplerate;
|
||||||
if (handle->samplerate == 8000 || handle->samplerate == 16000 ||
|
if (handle->samplerate == 8000 || handle->samplerate == 16000 ||
|
||||||
handle->samplerate == 24000 || handle->samplerate == 32000 || handle->samplerate == 48000) {
|
handle->samplerate == 24000 || handle->samplerate == 32000 || handle->samplerate == 48000 ||
|
||||||
|
handle->samplerate == 11025 || handle->samplerate == 22050 || handle->samplerate == 44100) {
|
||||||
context->sfinfo.format |= SF_FORMAT_PCM_16;
|
context->sfinfo.format |= SF_FORMAT_PCM_16;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,20 +24,23 @@ static switch_status_t lua_hanguphook(switch_core_session_t *session_hungup);
|
|||||||
Session::~Session()
|
Session::~Session()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (channel) {
|
if (session) {
|
||||||
switch_channel_set_private(channel, "CoreSession", NULL);
|
if (!channel) {
|
||||||
}
|
channel = switch_core_session_get_channel(session);
|
||||||
|
|
||||||
if (hangup_func_str) {
|
|
||||||
if (session) {
|
|
||||||
switch_core_event_hook_remove_state_change(session, lua_hanguphook);
|
|
||||||
}
|
}
|
||||||
switch_safe_free(hangup_func_str);
|
switch_channel_set_private(channel, "CoreSession", NULL);
|
||||||
|
switch_core_event_hook_remove_state_change(session, lua_hanguphook);
|
||||||
|
session = NULL;
|
||||||
|
channel = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch_safe_free(hangup_func_str);
|
||||||
switch_safe_free(hangup_func_arg);
|
switch_safe_free(hangup_func_arg);
|
||||||
switch_safe_free(cb_function);
|
switch_safe_free(cb_function);
|
||||||
switch_safe_free(cb_arg);
|
switch_safe_free(cb_arg);
|
||||||
|
|
||||||
|
init_vars();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Session::begin_allow_threads()
|
bool Session::begin_allow_threads()
|
||||||
|
@ -290,10 +290,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_write(switch_file_handle_t *fh,
|
|||||||
fh->dbuf = switch_core_alloc(fh->memory_pool, fh->dbuflen);
|
fh->dbuf = switch_core_alloc(fh->memory_pool, fh->dbuflen);
|
||||||
}
|
}
|
||||||
switch_assert(fh->resampler->to_len <= fh->dbuflen);
|
switch_assert(fh->resampler->to_len <= fh->dbuflen);
|
||||||
memcpy(fh->dbuf, fh->resampler->to, fh->resampler->to_len);
|
memcpy(fh->dbuf, fh->resampler->to, fh->resampler->to_len * 2);
|
||||||
data = fh->dbuf;
|
data = fh->dbuf;
|
||||||
} else {
|
} else {
|
||||||
memcpy(data, fh->resampler->to, fh->resampler->to_len);
|
memcpy(data, fh->resampler->to, fh->resampler->to_len * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
*len = fh->resampler->to_len / fh->channels;
|
*len = fh->resampler->to_len / fh->channels;
|
||||||
|
@ -888,22 +888,28 @@ SWITCH_DECLARE(void) CoreSession::destroy(void)
|
|||||||
{
|
{
|
||||||
this_check_void();
|
this_check_void();
|
||||||
|
|
||||||
if (channel) {
|
|
||||||
switch_channel_set_private(channel, "CoreSession", NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch_safe_free(xml_cdr_text);
|
switch_safe_free(xml_cdr_text);
|
||||||
switch_safe_free(uuid);
|
switch_safe_free(uuid);
|
||||||
switch_safe_free(tts_name);
|
switch_safe_free(tts_name);
|
||||||
switch_safe_free(voice_name);
|
switch_safe_free(voice_name);
|
||||||
|
|
||||||
if (session) {
|
if (session) {
|
||||||
|
if (!channel) {
|
||||||
|
channel = switch_core_session_get_channel(session);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (channel) {
|
||||||
|
switch_channel_set_private(channel, "CoreSession", NULL);
|
||||||
|
}
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "destroy/unlink session from object\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "destroy/unlink session from object\n");
|
||||||
if (switch_test_flag(this, S_HUP) && !switch_channel_test_flag(channel, CF_TRANSFER)) {
|
|
||||||
|
if (switch_channel_up(channel) && switch_test_flag(this, S_HUP) && !switch_channel_test_flag(channel, CF_TRANSFER)) {
|
||||||
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
|
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
|
||||||
}
|
}
|
||||||
switch_core_session_rwunlock(session);
|
switch_core_session_rwunlock(session);
|
||||||
session = NULL;
|
session = NULL;
|
||||||
|
channel = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
allocated = 0;
|
allocated = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user