[Freeswitch-svn] [commit] r11203 - freeswitch/trunk/src

FreeSWITCH SVN anthm at freeswitch.org
Wed Jan 14 12:46:02 PST 2009


Author: anthm
Date: Wed Jan 14 14:46:02 2009
New Revision: 11203

Log:
add extra sanity check

Modified:
   freeswitch/trunk/src/switch_core_io.c

Modified: freeswitch/trunk/src/switch_core_io.c
==============================================================================
--- freeswitch/trunk/src/switch_core_io.c	(original)
+++ freeswitch/trunk/src/switch_core_io.c	Wed Jan 14 14:46:02 2009
@@ -572,7 +572,7 @@
 	switch_assert(session != NULL);
 	switch_assert(frame != NULL);
 
-	if (switch_channel_get_state(session->channel) >= CS_HANGUP) {
+	if (!switch_channel_ready(session->channel)) {
 		return SWITCH_STATUS_FALSE;
 	}
 
@@ -605,14 +605,15 @@
 
 	switch_mutex_lock(session->codec_write_mutex);	
 
-	if (!(session->write_codec && session->write_codec->mutex && frame->codec)) {
+	if (!(session->write_codec && session->write_codec->mutex && frame->codec) || 
+		!switch_channel_ready(session->channel) || !switch_channel_media_ready(session->channel)) {
 		switch_mutex_unlock(session->codec_write_mutex);	
 		return SWITCH_STATUS_FALSE;
 	}
 
 	switch_mutex_lock(session->write_codec->mutex);
 	switch_mutex_lock(frame->codec->mutex);
-
+	
 
 	if ((session->write_codec && frame->codec && session->write_codec->implementation != frame->codec->implementation)) {
 		if (session->write_codec->implementation->codec_id == frame->codec->implementation->codec_id) {



More information about the Freeswitch-svn mailing list