Merge pull request #206 in FS/freeswitch from ~ARTURZ/freeswitch:FS-7306-fs_encode-sleep-cleanup to master

* commit '921f77668f39ee9a768c0515dba054f99cf0bd75':
  FS-7306: fs_encode is sleeping to much - cleanup
This commit is contained in:
Anthony Minessale II 2015-03-06 11:31:56 -06:00
commit b448953fab
1 changed files with 2 additions and 11 deletions

View File

@ -138,7 +138,7 @@ static int add_pvt(pvt_t *pvt)
{ {
int r = 0; int r = 0;
if (t38_state_list.thread_running > 0) { if (t38_state_list.thread_running == 1) {
switch_mutex_lock(t38_state_list.mutex); switch_mutex_lock(t38_state_list.mutex);
pvt->next = t38_state_list.head; pvt->next = t38_state_list.head;
t38_state_list.head = pvt; t38_state_list.head = pvt;
@ -190,18 +190,14 @@ static void *SWITCH_THREAD_FUNC timer_thread_run(switch_thread_t *thread, void *
pvt_t *pvt; pvt_t *pvt;
int samples = 160; int samples = 160;
int ms = 20; int ms = 20;
int r = 0;
if (switch_core_timer_init(&timer, "soft", ms, samples, NULL) != SWITCH_STATUS_SUCCESS) { if (switch_core_timer_init(&timer, "soft", ms, samples, NULL) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "timer init failed.\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "timer init failed.\n");
r = -1; t38_state_list.thread_running = -1;
goto end; goto end;
} }
switch_mutex_lock(t38_state_list.mutex);
t38_state_list.thread_running = 1; t38_state_list.thread_running = 1;
switch_mutex_unlock(t38_state_list.mutex);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FAX timer thread started.\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FAX timer thread started.\n");
switch_mutex_lock(spandsp_globals.cond_mutex); switch_mutex_lock(spandsp_globals.cond_mutex);
@ -231,13 +227,8 @@ static void *SWITCH_THREAD_FUNC timer_thread_run(switch_thread_t *thread, void *
switch_mutex_unlock(spandsp_globals.cond_mutex); switch_mutex_unlock(spandsp_globals.cond_mutex);
end: end:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FAX timer thread ended.\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FAX timer thread ended.\n");
switch_mutex_lock(t38_state_list.mutex);
t38_state_list.thread_running = r;
switch_mutex_unlock(t38_state_list.mutex);
if (timer.timer_interface) { if (timer.timer_interface) {
switch_core_timer_destroy(&timer); switch_core_timer_destroy(&timer);
} }