[Freeswitch-svn] [commit] r10009 - in freeswitch/trunk/src: . include
Freeswitch SVN
anthm at freeswitch.org
Tue Oct 14 14:03:15 EDT 2008
Author: anthm
Date: Tue Oct 14 14:03:14 2008
New Revision: 10009
Modified:
freeswitch/trunk/src/include/switch_core.h
freeswitch/trunk/src/switch_core_codec.c
freeswitch/trunk/src/switch_core_io.c
freeswitch/trunk/src/switch_ivr_originate.c
Log:
cleanup
Modified: freeswitch/trunk/src/include/switch_core.h
==============================================================================
--- freeswitch/trunk/src/include/switch_core.h (original)
+++ freeswitch/trunk/src/include/switch_core.h Tue Oct 14 14:03:14 2008
@@ -1132,6 +1132,7 @@
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
Modified: freeswitch/trunk/src/switch_core_codec.c
==============================================================================
--- freeswitch/trunk/src/switch_core_codec.c (original)
+++ freeswitch/trunk/src/switch_core_codec.c Tue Oct 14 14:03:14 2008
@@ -47,6 +47,11 @@
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 @@
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");
Modified: freeswitch/trunk/src/switch_core_io.c
==============================================================================
--- freeswitch/trunk/src/switch_core_io.c (original)
+++ freeswitch/trunk/src/switch_core_io.c Tue Oct 14 14:03:14 2008
@@ -180,7 +180,6 @@
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;
}
Modified: freeswitch/trunk/src/switch_ivr_originate.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_originate.c (original)
+++ freeswitch/trunk/src/switch_ivr_originate.c Tue Oct 14 14:03:14 2008
@@ -88,6 +88,14 @@
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 @@
}
}
}
- wbreak:
+ wbreak:
+
+ switch_core_session_rwunlock(collect->session);
return NULL;
}
More information about the Freeswitch-svn
mailing list