diff --git a/src/switch_jitterbuffer.c b/src/switch_jitterbuffer.c index c6787a6bc1..b5c1e4f793 100644 --- a/src/switch_jitterbuffer.c +++ b/src/switch_jitterbuffer.c @@ -602,7 +602,7 @@ static inline void add_node(switch_jb_t *jb, switch_rtp_packet_t *packet, switch ts_diff = abs((int)((int64_t)ntohl(node->packet.header.ts) - (int64_t)ntohl(jb->highest_wrote_ts))); } - if (((seq_diff >= jb->max_frame_len) || (ts_diff > (900000 * 5)))) { + if (((seq_diff >= 100) || (ts_diff > (900000 * 5)))) { jb_debug(jb, 2, "CHANGE DETECTED, PUNT %u\n", abs(((int)ntohs(packet->header.seq) - ntohs(jb->highest_wrote_seq)))); switch_jb_reset(jb); } diff --git a/src/switch_rtp.c b/src/switch_rtp.c index be8625da75..219080cf28 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -2695,10 +2695,10 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_set_local_address(switch_rtp_t *rtp_s goto done; } - if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO]) { - switch_socket_opt_set(new_sock, SWITCH_SO_RCVBUF, 1572864); - switch_socket_opt_set(new_sock, SWITCH_SO_SNDBUF, 1572864); - } + //if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO]) { + //switch_socket_opt_set(new_sock, SWITCH_SO_RCVBUF, 1572864); + //switch_socket_opt_set(new_sock, SWITCH_SO_SNDBUF, 1572864); + //} if (switch_socket_bind(new_sock, rtp_session->local_addr) != SWITCH_STATUS_SUCCESS) { char *em = switch_core_sprintf(rtp_session->pool, "Bind Error! %s:%d", host, port); @@ -6530,6 +6530,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ int hot_socket = 0; int read_loops = 0; int slept = 0; + switch_bool_t got_jb = SWITCH_FALSE; if (!switch_rtp_ready(rtp_session)) { return -1; @@ -6724,8 +6725,13 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ } + if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO]) { + got_jb = (rtp_session->vb && switch_jb_poll(rtp_session->vb)); + } else { + got_jb = SWITCH_TRUE; + } - if (poll_status == SWITCH_STATUS_SUCCESS || (rtp_session->vb && switch_jb_poll(rtp_session->vb))) { + if (poll_status == SWITCH_STATUS_SUCCESS || got_jb) { got_rtp_poll = 1; @@ -6733,7 +6739,8 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ read_pretriggered = 0; } else { - status = read_rtp_packet(rtp_session, &bytes, flags, pmapP, poll_status, SWITCH_TRUE); + + status = read_rtp_packet(rtp_session, &bytes, flags, pmapP, poll_status, got_jb); if (status == SWITCH_STATUS_GENERR) { ret = -1;