]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-5296 --resolve
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 21 Aug 2013 21:30:59 +0000 (02:30 +0500)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 21 Aug 2013 21:30:59 +0000 (02:30 +0500)
src/include/switch_types.h
src/switch_rtp.c

index 7f3aade715f4de7c8df516b6ce8745b3faa6d93c..9728062d4c5228c25b15cea5220bffa30e2beb7f 100644 (file)
@@ -652,6 +652,7 @@ typedef enum {
        SWITCH_RTP_FLAG_VIDEO,
        SWITCH_RTP_FLAG_ENABLE_RTCP,
        SWITCH_RTP_FLAG_RTCP_MUX,
+       SWITCH_RTP_FLAG_KILL_JB,
        SWITCH_RTP_FLAG_INVALID
 } switch_rtp_flag_t;
 
index 106f9ec1aaff377313f45bdafcc3321eb7a3896d..b75835a2704b19ee70ce45ddca52c379fa7d6dda 100644 (file)
@@ -3126,9 +3126,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_deactivate_jitter_buffer(switch_rtp_t
                return SWITCH_STATUS_FALSE;
        }
 
-       READ_INC(rtp_session);
-       stfu_n_destroy(&rtp_session->jb);
-       READ_DEC(rtp_session);
+       rtp_session->flags[SWITCH_RTP_FLAG_KILL_JB]++;
        
        return SWITCH_STATUS_SUCCESS;
 }
@@ -3638,6 +3636,9 @@ SWITCH_DECLARE(void) switch_rtp_set_flag(switch_rtp_t *rtp_session, switch_rtp_f
                rtp_session->autoadj_window = 20;
                rtp_session->autoadj_tally = 0;
                rtp_flush_read_buffer(rtp_session, SWITCH_RTP_FLUSH_ONCE);
+               if (rtp_session->jb) {
+                       stfu_n_reset(rtp_session->jb);
+               }
        } else if (flag == SWITCH_RTP_FLAG_NOBLOCK && rtp_session->sock_input) {
                switch_socket_opt_set(rtp_session->sock_input, SWITCH_SO_NONBLOCK, TRUE);
        }
@@ -4255,6 +4256,14 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
                switch_swap_linear((int16_t *)RTP_BODY(rtp_session), (int) *bytes - rtp_header_len);
        }
 
+       if (rtp_session->flags[SWITCH_RTP_FLAG_KILL_JB]) {
+               rtp_session->flags[SWITCH_RTP_FLAG_KILL_JB] = 0;
+               if (rtp_session->jb) {
+                       stfu_n_destroy(&rtp_session->jb);
+               }
+       }
+
+
        if (rtp_session->jb && !rtp_session->pause_jb && rtp_session->recv_msg.header.version == 2 && *bytes) {
                if (rtp_session->recv_msg.header.m && rtp_session->recv_msg.header.pt != rtp_session->recv_te && 
                        !rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] && !(rtp_session->rtp_bugs & RTP_BUG_IGNORE_MARK_BIT)) {