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;
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)) {
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);
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;