diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 7229b046d4..3e79e238e1 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -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 diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 241eef3390..a8467bc821 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -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 */ diff --git a/src/mod/endpoints/mod_portaudio/mod_portaudio.c b/src/mod/endpoints/mod_portaudio/mod_portaudio.c index d44dfda0a5..93e63dc337 100644 --- a/src/mod/endpoints/mod_portaudio/mod_portaudio.c +++ b/src/mod/endpoints/mod_portaudio/mod_portaudio.c @@ -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; diff --git a/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c b/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c index a8f7cf8f9a..ca48fcd855 100644 --- a/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c +++ b/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c @@ -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; } diff --git a/src/switch_core.c b/src/switch_core.c index 8b3cb12fa6..06b00efaa9 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -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; } } diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 2915ba6f5f..ccb30d83f3 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -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) */