This commit is contained in:
Anthony Minessale 2012-03-26 10:53:34 -05:00
parent 3e3acf2fa7
commit a239914926
3 changed files with 25 additions and 11 deletions

View File

@ -196,6 +196,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_set_local_address(switch_rtp_t *rtp_s
SWITCH_DECLARE(void) switch_rtp_kill_socket(switch_rtp_t *rtp_session);
SWITCH_DECLARE(void) switch_rtp_break(switch_rtp_t *rtp_session);
SWITCH_DECLARE(void) switch_rtp_flush(switch_rtp_t *rtp_session);
/*!
\brief Test if an RTP session is ready

View File

@ -1194,6 +1194,9 @@ 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);
b_leg->session = peer_session;
switch_copy_string(b_leg->b_uuid, switch_core_session_get_uuid(session), sizeof(b_leg->b_uuid));
b_leg->stream_id = stream_id;

View File

@ -2030,6 +2030,16 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_sessio
return SWITCH_STATUS_SUCCESS;
}
SWITCH_DECLARE(void) switch_rtp_flush(switch_rtp_t *rtp_session)
{
if (!switch_rtp_ready(rtp_session)) {
return;
}
switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_FLUSH);
}
SWITCH_DECLARE(void) switch_rtp_break(switch_rtp_t *rtp_session)
{
if (!switch_rtp_ready(rtp_session)) {
@ -2038,7 +2048,6 @@ SWITCH_DECLARE(void) switch_rtp_break(switch_rtp_t *rtp_session)
switch_mutex_lock(rtp_session->flag_mutex);
switch_set_flag(rtp_session, SWITCH_RTP_FLAG_BREAK);
switch_set_flag(rtp_session, SWITCH_RTP_FLAG_FLUSH);
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_NOBLOCK)) {
switch_mutex_unlock(rtp_session->flag_mutex);
@ -3095,25 +3104,26 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
check = !bytes;
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_FLUSH)) {
if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO)) {
do_flush(rtp_session);
bytes = 0;
}
switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_FLUSH);
}
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_BREAK) || (bytes && bytes == 4 && *((int *) &rtp_session->recv_msg) == UINT_MAX)) {
switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_BREAK);
if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_NOBLOCK) || !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_USE_TIMER) || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA) || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_UDPTL) || (bytes && bytes < 5) || (!bytes && poll_loop)) {
if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_NOBLOCK) || !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_USE_TIMER) ||
switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA) || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_UDPTL) ||
(bytes && bytes < 5) || (!bytes && poll_loop)) {
do_2833(rtp_session, session);
bytes = 0;
return_cng_frame();
} else {
switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_FLUSH);
}
}
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_FLUSH)) {
if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO)) {
do_flush(rtp_session);
bytes = 0;
}
switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_FLUSH);
}
if (bytes && bytes < 5) {
continue;