From: Brian West Date: Mon, 7 Oct 2013 16:38:08 +0000 (-0500) Subject: deal with rtp keep alives X-Git-Tag: v1.4.1~12^2~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c0dc8ed6ff75a3b87a27354e26092487874a5d17;p=thirdparty%2Ffreeswitch.git deal with rtp keep alives --- diff --git a/src/switch_rtp.c b/src/switch_rtp.c index a5b091fe17..c7f15f01f1 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -3961,6 +3961,10 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t status = switch_socket_recvfrom(rtp_session->from_addr, rtp_session->sock_input, 0, (void *) &rtp_session->recv_msg, bytes); + if (*bytes) { + rtp_session->missed_count = 0; + } + if (check_rtcp_and_ice(rtp_session) == -1) { return SWITCH_STATUS_GENERR; } @@ -4641,7 +4645,15 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ ret = -1; goto end; } - + + if (rtp_session->max_missed_packets && read_loops == 1 && !rtp_session->flags[SWITCH_RTP_FLAG_VIDEO]) { + if (bytes) { + rtp_session->missed_count = 0; + } else if (++rtp_session->missed_count >= rtp_session->max_missed_packets) { + ret = -2; + goto end; + } + } if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO]) { //switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_CRIT, "Read bytes (%i) %ld\n", status, bytes); @@ -4837,15 +4849,6 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ goto end; } - if (rtp_session->max_missed_packets && read_loops == 1 && !rtp_session->flags[SWITCH_RTP_FLAG_VIDEO]) { - if (bytes) { - rtp_session->missed_count = 0; - } else if (++rtp_session->missed_count >= rtp_session->max_missed_packets) { - ret = -2; - goto end; - } - } - check = !bytes; if (rtp_session->flags[SWITCH_RTP_FLAG_FLUSH]) {