]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
spread out timer skips to smooth out socket catch-up
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 29 Nov 2012 19:42:56 +0000 (13:42 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 29 Nov 2012 19:43:01 +0000 (13:43 -0600)
src/switch_rtp.c

index ec003f956903d92a3de1d25baa217b788117d5c9..8726beabe87e2c254b16365e081966155ea61a8b 100644 (file)
@@ -3246,9 +3246,9 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
                                                if (switch_poll(rtp_session->read_pollfd, 1, &fdr, 0) == SWITCH_STATUS_SUCCESS) {
                                                        rtp_session->hot_hits++;//+= rtp_session->samples_per_interval;
                                                        
-                                                       //switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "%s Trigger %d\n", 
-                                                       //switch_core_session_get_name(session),
-                                                       //                                rtp_session->hot_hits); 
+                                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10, "%s Hot Hit %d\n", 
+                                                                                         switch_core_session_get_name(session),
+                                                                                         rtp_session->hot_hits); 
                                                } else {
                                                        rtp_session->hot_hits = 0;
                                                }
@@ -3262,21 +3262,21 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
                                }
                        }
 
-
-                       if (hot_socket) { 
-                               //switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Skip timer\n");
+                       if (hot_socket && (rtp_session->hot_hits % 10) != 0) { 
+                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10, "%s timer while HOT\n", switch_core_session_get_name(session));
+                               switch_core_timer_next(&rtp_session->timer);
+                       } else if (hot_socket) {
+                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10, "%s skip timer once\n", switch_core_session_get_name(session));
                                rtp_session->sync_packets++;
                                switch_core_timer_sync(&rtp_session->timer);
-                               
                        } else {
                                
                                if (rtp_session->sync_packets) {
-#if 0
-                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT,
-                                                                         "Auto-Flush catching up %d packets (%d)ms.\n",
+
+                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10,
+                                                                         "%s Auto-Flush catching up %d packets (%d)ms.\n",
+                                                                         switch_core_session_get_name(session),
                                                                          rtp_session->sync_packets, (rtp_session->ms_per_packet * rtp_session->sync_packets) / 1000);
-#endif
-                                       //switch_core_timer_sync(&rtp_session->timer);
                                } else {
 
                                        switch_core_timer_next(&rtp_session->timer);