From a5dbd2654806a3d613b8ed71bd487dcd34679779 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 5 Dec 2012 13:17:50 -0600 Subject: [PATCH] fix some delay regressions --- src/switch_ivr.c | 2 ++ src/switch_ivr_bridge.c | 4 ++-- src/switch_ivr_originate.c | 8 ++++---- src/switch_rtp.c | 6 ++++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/switch_ivr.c b/src/switch_ivr.c index dd5055351c..6aa5166634 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -640,6 +640,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se switch_channel_set_flag(channel, CF_BREAK); } + switch_channel_audio_sync(channel); } } else if (cmd_hash == CMD_UNICAST) { char *local_ip = switch_event_get_header(event, "local-ip"); @@ -1771,6 +1772,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_ switch_channel_set_caller_profile(channel, new_profile); switch_channel_set_state(channel, CS_ROUTING); + switch_channel_audio_sync(channel); msg.message_id = SWITCH_MESSAGE_INDICATE_TRANSFER; msg.from = __FILE__; diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index b8b04cdbd0..52cc7c6693 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -1232,8 +1232,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses switch_channel_set_flag_recursive(caller_channel, CF_BRIDGE_ORIGINATOR); switch_channel_clear_flag(peer_channel, CF_BRIDGE_ORIGINATOR); - //switch_channel_audio_sync(caller_channel); - //switch_channel_audio_sync(peer_channel); + switch_channel_audio_sync(caller_channel); + switch_channel_audio_sync(peer_channel); b_leg->session = peer_session; switch_copy_string(b_leg->b_uuid, switch_core_session_get_uuid(session), sizeof(b_leg->b_uuid)); diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 52d903c79d..dc281b5885 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -3707,11 +3707,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess switch_cond_next(); } - //switch_channel_audio_sync(bchan); + switch_channel_audio_sync(bchan); - //if (caller_channel) { - // switch_channel_audio_sync(caller_channel); - //} + if (caller_channel) { + switch_channel_audio_sync(caller_channel); + } } if (oglobals.session) { diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 652ffb11a9..951edb70b7 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -2072,7 +2072,7 @@ SWITCH_DECLARE(switch_rtp_t *) switch_rtp_new(const char *rx_host, rtp_session->ready = 2; rtp_session->rx_host = switch_core_strdup(rtp_session->pool, rx_host); rtp_session->rx_port = rx_port; - //switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_FLUSH); + switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_FLUSH); } else { switch_rtp_release_port(rx_host, rx_port); } @@ -2763,7 +2763,8 @@ SWITCH_DECLARE(void) rtp_flush_read_buffer(switch_rtp_t *rtp_session, switch_rtp if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA) && !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO)) { - + switch_set_flag(rtp_session, SWITCH_RTP_FLAG_FLUSH); + switch (flush) { case SWITCH_RTP_FLUSH_STICK: switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_STICKY_FLUSH); @@ -2818,6 +2819,7 @@ static void do_flush(switch_rtp_t *rtp_session) if (switch_rtp_ready(rtp_session)) { bytes = sizeof(rtp_msg_t); switch_socket_recvfrom(rtp_session->from_addr, rtp_session->sock_input, 0, (void *) &rtp_session->recv_msg, &bytes); + if (bytes) { int do_cng = 0;