]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
change switch_core_timer_next to return switch_status_t, update all users to new...
authorMichael Jerris <mike@jerris.com>
Mon, 5 Mar 2007 23:18:29 +0000 (23:18 +0000)
committerMichael Jerris <mike@jerris.com>
Mon, 5 Mar 2007 23:18:29 +0000 (23:18 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4454 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_core.h
src/mod/applications/mod_conference/mod_conference.c
src/mod/endpoints/mod_portaudio/mod_portaudio.c
src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c
src/switch_core.c
src/switch_ivr.c

index 7229b046d45a92e014894475eaa962b45a6be888..3e79e238e1d09bec5e97a17f09a375c7f8c6a678 100644 (file)
@@ -931,7 +931,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_timer_init(switch_timer_t *timer, ch
   \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
index 241eef339052c53d591c099718038573c37546c3..a8467bc821898521618e982ea8f7763769641a15 100644 (file)
@@ -676,7 +676,10 @@ static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, v
                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 @@ static void conference_loop_output(conference_member_t *member)
                        } 
                }
 
-               switch_core_timer_next(&timer);
+               if (switch_core_timer_next(&timer) != SWITCH_STATUS_SUCCESS) {
+                       break;
+               }
 
        } /* Rinse ... Repeat */
 
index d44dfda0a59ba758ee90120a2a7a8409b9cb4b57..93e63dc337ff3591b749f1c7daab611a68b3075f 100644 (file)
@@ -623,7 +623,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
 
         {
             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;
index a8f7cf8f9a33c8a567104296f1b094f4b1a352b3..ca48fcd855a8d9df806d5626b9d4abab7dfa91d5 100644 (file)
@@ -273,7 +273,7 @@ static JSBool teletone_generate(JSContext *cx, JSObject *obj, uintN argc, jsval
                        }
                        
                        if (tto->timer) {
-                               if (switch_core_timer_next(tto->timer)< 0) {
+                               if (switch_core_timer_next(tto->timer) != SWITCH_STATUS_SUCCESS) {
                                        break;
                                }
 
index 8b3cb12fa66046a77148dd3576e68e062d58ec36..06b00efaa9d969f4806ca5eee6afc4757c931ccf 100644 (file)
@@ -1315,7 +1315,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_timer_init(switch_timer_t *timer, ch
 
 }
 
-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 @@ SWITCH_DECLARE(int) switch_core_timer_next(switch_timer_t *timer)
        }
 
        if (timer->timer_interface->timer_next(timer) == SWITCH_STATUS_SUCCESS) {
-               return timer->samplecount;
+               return SWITCH_STATUS_SUCCESS;
        } else {
-               return -1;
+               return SWITCH_STATUS_GENERR;
        }
 
 }
index 2915ba6f5fbc99ab3ca0dc53e55d041491e4485d..ccb30d83f3450dc964f393666701c8f225b839ea 100644 (file)
@@ -1444,7 +1444,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
     
                
                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 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session
 
                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 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session
         }
 
                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) */