提交 f9d1c799 authored 作者: Anthony Minessale's avatar Anthony Minessale

cleanup

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10009 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 fe9e0e15
......@@ -1132,6 +1132,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_destroy(switch_codec_t *codec)
SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(_In_ switch_core_session_t *session, switch_codec_t *codec);
SWITCH_DECLARE(void) switch_core_session_unset_read_codec(_In_ switch_core_session_t *session);
SWITCH_DECLARE(void) switch_core_session_unset_write_codec(_In_ switch_core_session_t *session);
/*!
\brief Retrieve the read codec from a given session
......
......@@ -47,6 +47,11 @@ SWITCH_DECLARE(void) switch_core_session_unset_read_codec(switch_core_session_t
session->real_read_codec = session->read_codec = NULL;
}
SWITCH_DECLARE(void) switch_core_session_unset_write_codec(switch_core_session_t *session)
{
session->real_write_codec = session->write_codec = NULL;
}
SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(switch_core_session_t *session, switch_codec_t *codec)
{
......@@ -55,16 +60,24 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(switch_core_s
char tmp[30];
if (codec && !codec->implementation) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot set INITIALIZED codec!\n");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot set UNINITIALIZED codec!\n");
return SWITCH_STATUS_FALSE;
}
if (!codec || codec == session->real_read_codec) {
if (session->real_read_codec) {
session->read_codec = session->real_read_codec;
if (session->real_read_codec->implementation) {
session->read_codec = session->real_read_codec;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "resetting to uninitilized codec, setting to NULL\n");
session->read_codec = session->real_read_codec = NULL;
return SWITCH_STATUS_FALSE;
}
} else {
return SWITCH_STATUS_FALSE;
}
} else if (codec) {
if (session->read_codec != session->real_read_codec) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot double-set codec!\n");
......
......@@ -180,7 +180,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
if (!(session->read_codec && session->read_codec->implementation)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s has no read codec.\n", switch_channel_get_name(session->channel));
abort();
return SWITCH_STATUS_FALSE;
}
......
......@@ -88,6 +88,14 @@ static void *SWITCH_THREAD_FUNC collect_thread_run(switch_thread_t *thread, void
char buf[10] = SWITCH_BLANK_STRING;
char *p, term;
if (collect->session) {
if (switch_core_session_read_lock(collect->session) != SWITCH_STATUS_SUCCESS) {
return NULL;
}
} else {
return NULL;
}
if (!strcasecmp(collect->key, "exec")) {
char *data;
const switch_application_interface_t *application_interface;
......@@ -147,7 +155,9 @@ static void *SWITCH_THREAD_FUNC collect_thread_run(switch_thread_t *thread, void
}
}
}
wbreak:
wbreak:
switch_core_session_rwunlock(collect->session);
return NULL;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论