spread out timer skips to smooth out socket catch-up
This commit is contained in:
parent
b4d7c2ab2c
commit
1073f70b6f
|
@ -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) {
|
if (switch_poll(rtp_session->read_pollfd, 1, &fdr, 0) == SWITCH_STATUS_SUCCESS) {
|
||||||
rtp_session->hot_hits++;//+= rtp_session->samples_per_interval;
|
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_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10, "%s Hot Hit %d\n",
|
||||||
//switch_core_session_get_name(session),
|
switch_core_session_get_name(session),
|
||||||
// rtp_session->hot_hits);
|
rtp_session->hot_hits);
|
||||||
} else {
|
} else {
|
||||||
rtp_session->hot_hits = 0;
|
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 && (rtp_session->hot_hits % 10) != 0) {
|
||||||
if (hot_socket) {
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10, "%s timer while HOT\n", switch_core_session_get_name(session));
|
||||||
//switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Skip timer\n");
|
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++;
|
rtp_session->sync_packets++;
|
||||||
switch_core_timer_sync(&rtp_session->timer);
|
switch_core_timer_sync(&rtp_session->timer);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (rtp_session->sync_packets) {
|
if (rtp_session->sync_packets) {
|
||||||
#if 0
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT,
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10,
|
||||||
"Auto-Flush catching up %d packets (%d)ms.\n",
|
"%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);
|
rtp_session->sync_packets, (rtp_session->ms_per_packet * rtp_session->sync_packets) / 1000);
|
||||||
#endif
|
|
||||||
//switch_core_timer_sync(&rtp_session->timer);
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
switch_core_timer_next(&rtp_session->timer);
|
switch_core_timer_next(&rtp_session->timer);
|
||||||
|
|
Loading…
Reference in New Issue