]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
timer mojo (cont)
authorAnthony Minessale <anthony.minessale@gmail.com>
Wed, 7 Feb 2007 19:01:07 +0000 (19:01 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Wed, 7 Feb 2007 19:01:07 +0000 (19:01 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4150 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/applications/mod_conference/mod_conference.c
src/mod/timers/mod_softtimer/mod_softtimer.c
src/switch_rtp.c

index ae722de971ff5f6c1c3515e1c25932868fe8a8c8..95a5e6b53e66721ef18ea546025827c0dfa9df67 100644 (file)
@@ -510,13 +510,13 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe
         // anounce the total number of members in the conference
         if (conference->count >= conference->anounce_count && conference->anounce_count > 1) {
             snprintf(msg, sizeof(msg), "There are %d callers", conference->count);
-            conference_member_say(member, msg, 0);
+            conference_member_say(member, msg, CONF_DEFAULT_LEADIN);
         } else if (conference->count == 1) {
             if (conference->alone_sound) {
-                conference_play_file(conference, conference->alone_sound, 0, switch_core_session_get_channel(member->session));
+                conference_play_file(conference, conference->alone_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session));
             } else {
                 snprintf(msg, sizeof(msg), "You are currently the only person in this conference.", conference->count);
-                conference_member_say(member, msg, 0);
+                conference_member_say(member, msg, CONF_DEFAULT_LEADIN);
             }
         }
 
@@ -1555,6 +1555,7 @@ static void conference_loop_output(conference_member_t *member)
 
                /* handle file and TTS frames */
                if (member->fnode) {
+            switch_mutex_lock(member->flag_mutex);
                        /* if we are done, clean it up */
                        if (member->fnode->done) {
                                conference_file_node_t *fnode;
@@ -1567,15 +1568,13 @@ static void conference_loop_output(conference_member_t *member)
                                        switch_core_file_close(&member->fnode->fh);
                                }
 
-                               switch_mutex_lock(member->flag_mutex);
+
                                fnode = member->fnode;
                                member->fnode = member->fnode->next;
-                               switch_mutex_unlock(member->flag_mutex);
 
                                pool = fnode->pool;
                                fnode = NULL;
                                switch_core_destroy_memory_pool(&pool);
-
                        } else {
                                /* skip this frame until leadin time has expired */
                                if (member->fnode->leadin) {
@@ -1618,6 +1617,7 @@ static void conference_loop_output(conference_member_t *member)
                                        }
                                }
                        }
+            switch_mutex_unlock(member->flag_mutex);
                } else {        /* send the conferecne frame to the call leg */
                        switch_buffer_t *use_buffer = NULL;
                        uint32_t mux_used = (uint32_t)switch_buffer_inuse(member->mux_buffer);
@@ -2055,6 +2055,7 @@ static switch_status_t conference_member_say(conference_member_t *member, char *
 
         fnode->type = NODE_TYPE_SPEECH;
         fnode->leadin = leadin;
+        fnode->pool = pool;
 
         memset(&fnode->sh, 0, sizeof(fnode->sh));
         if (switch_core_speech_open(&fnode->sh, 
@@ -2062,13 +2063,11 @@ static switch_status_t conference_member_say(conference_member_t *member, char *
                                     conference->tts_voice, 
                                     conference->rate, 
                                     &flags, 
-                                    conference->pool) != SWITCH_STATUS_SUCCESS) {
+                                    fnode->pool) != SWITCH_STATUS_SUCCESS) {
             switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module [%s]!\n", conference->tts_engine);
             return SWITCH_STATUS_FALSE;
         }
 
-        fnode->pool = pool;
-
         /* Queue the node */
         switch_mutex_lock(member->flag_mutex);
         for (nptr = member->fnode; nptr && nptr->next; nptr = nptr->next);
index e24e5e01e1834a111218d6baf1d61fa3fa747e2c..10f6bb07411cc37ab3f55bec55bd2de4d50b30f9 100644 (file)
@@ -95,7 +95,13 @@ static inline switch_status_t timer_next(switch_timer_t *timer)
         uint64_t diff;
 
         if ((diff = (private_info->reference - TIMER_MATRIX[timer->interval].tick))) {
-            switch_yield(diff * 1000);
+            if (diff == timer->interval) {
+                switch_yield(diff * 500);
+            } else {
+                switch_yield(1000);
+            }
+        } else {
+            break;
         }
        }
        timer->samplecount += timer->samples;
index 334b8814c777b488c84e95b4cdd65df38072b874..81a14f0b6fa34db1e484cc411863443a189efa40 100644 (file)
@@ -781,8 +781,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
                
                if (status == SWITCH_STATUS_BREAK || bytes == 0) {
                        if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_DATAWAIT)) {
-
-                               switch_yield(diff  * 1000);
+                               switch_yield(diff * 500);
                                continue;
                        }
                        return 0;