]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
addition to a6a3ff1dc5574ded096ac1427cd7c6992d14092f
authorAnthony Minessale <anthm@freeswitch.org>
Mon, 26 Mar 2012 15:53:34 +0000 (10:53 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Mon, 26 Mar 2012 15:53:39 +0000 (10:53 -0500)
src/include/switch_rtp.h
src/switch_ivr_bridge.c
src/switch_rtp.c

index 94c9d671e958948a468ae91968dd8c4070666333..a61326a6b81e589f0bef9c289e07e22c98df49e8 100644 (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
index 266fa8d187a5dce110d85e2ff63d567d79354803..06dc31e1cb822dea4889e1ceda52fcf67c3c4014 100644 (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;
index 56bc0e58ee4b8e25b2558841656a9bbf4275a27f..f9b2c1a7d8fc1bdf4a75f93d3197a9de765868bc 100644 (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;