[Freeswitch-svn] [commit] r4454 - in freeswitch/trunk/src: . include mod/applications/mod_conference mod/endpoints/mod_portaudio mod/languages/mod_spidermonkey_teletone

Freeswitch SVN mikej at freeswitch.org
Mon Mar 5 18:18:30 EST 2007


Author: mikej
Date: Mon Mar  5 18:18:29 2007
New Revision: 4454

Modified:
   freeswitch/trunk/src/include/switch_core.h
   freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
   freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c
   freeswitch/trunk/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c
   freeswitch/trunk/src/switch_core.c
   freeswitch/trunk/src/switch_ivr.c

Log:
change switch_core_timer_next to return switch_status_t, update all users to new usage, add some error checking to mod_conference so that it bails out of the loops more gracefully on shutdown.

Modified: freeswitch/trunk/src/include/switch_core.h
==============================================================================
--- freeswitch/trunk/src/include/switch_core.h	(original)
+++ freeswitch/trunk/src/include/switch_core.h	Mon Mar  5 18:18:29 2007
@@ -931,7 +931,7 @@
   \param timer the timer to wait on
   \return the newest sample count
 */
-SWITCH_DECLARE(int) switch_core_timer_next(switch_timer_t *timer);
+SWITCH_DECLARE(switch_status_t) switch_core_timer_next(switch_timer_t *timer);
 
 /*! 
   \brief Step the timer one step

Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c	Mon Mar  5 18:18:29 2007
@@ -676,7 +676,10 @@
 		switch_size_t file_data_len = samples * 2;
 
 		/* Sync the conference to a single timing source */
-		switch_core_timer_next(&timer);
+		if (switch_core_timer_next(&timer) != SWITCH_STATUS_SUCCESS) {
+			switch_set_flag(conference, CFLAG_DESTRUCT);
+			break;
+		}
 		switch_mutex_lock(conference->mutex);
 		ready = 0;
 
@@ -1659,7 +1662,9 @@
 			} 
 		}
 
-		switch_core_timer_next(&timer);
+		if (switch_core_timer_next(&timer) != SWITCH_STATUS_SUCCESS) {
+			break;
+		}
 
 	} /* Rinse ... Repeat */
 

Modified: freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c	Mon Mar  5 18:18:29 2007
@@ -623,7 +623,7 @@
 
         {
             switch_size_t olen = globals.read_codec.implementation->samples_per_frame;
-			if (switch_core_timer_next(&tech_pvt->timer) < 0) {
+			if (switch_core_timer_next(&tech_pvt->timer) != SWITCH_STATUS_SUCCESS) {
                 switch_core_file_close(&tech_pvt->fh);
                 switch_core_codec_destroy(&tech_pvt->write_codec);
                 goto cng;

Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c	Mon Mar  5 18:18:29 2007
@@ -273,7 +273,7 @@
 			}
 			
 			if (tto->timer) {
-				if (switch_core_timer_next(tto->timer)< 0) {
+				if (switch_core_timer_next(tto->timer) != SWITCH_STATUS_SUCCESS) {
 					break;
 				}
 

Modified: freeswitch/trunk/src/switch_core.c
==============================================================================
--- freeswitch/trunk/src/switch_core.c	(original)
+++ freeswitch/trunk/src/switch_core.c	Mon Mar  5 18:18:29 2007
@@ -1315,7 +1315,7 @@
 
 }
 
-SWITCH_DECLARE(int) switch_core_timer_next(switch_timer_t *timer)
+SWITCH_DECLARE(switch_status_t) switch_core_timer_next(switch_timer_t *timer)
 {
 	if (!timer->timer_interface) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Timer is not initilized!\n");
@@ -1323,9 +1323,9 @@
 	}
 
 	if (timer->timer_interface->timer_next(timer) == SWITCH_STATUS_SUCCESS) {
-		return timer->samplecount;
+		return SWITCH_STATUS_SUCCESS;
 	} else {
-		return -1;
+		return SWITCH_STATUS_GENERR;
 	}
 
 }

Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c	(original)
+++ freeswitch/trunk/src/switch_ivr.c	Mon Mar  5 18:18:29 2007
@@ -1444,7 +1444,7 @@
     
 		
 		if (timer_name) {
-			if (switch_core_timer_next(&timer) < 0) {
+			if (switch_core_timer_next(&timer) != SWITCH_STATUS_SUCCESS) {
 				break;
 			}
 		} else { /* time off the channel (if you must) */
@@ -1750,7 +1750,7 @@
 
 		if (switch_test_flag(sh, SWITCH_SPEECH_FLAG_PAUSE)) {
 			if (timer) {
-				if ((x = switch_core_timer_next(timer)) < 0) {
+				if (switch_core_timer_next(timer) != SWITCH_STATUS_SUCCESS) {
 					break;
 				}
 			} else {
@@ -1813,7 +1813,7 @@
         }
 
 		if (timer) {
-			if ((x = switch_core_timer_next(timer)) < 0) {
+			if (switch_core_timer_next(timer) != SWITCH_STATUS_SUCCESS) {
 				break;
 			}
 		} else { /* time off the channel (if you must) */



More information about the Freeswitch-svn mailing list