]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
deal with rtp keep alives
authorBrian West <brian@freeswitch.org>
Mon, 7 Oct 2013 16:38:08 +0000 (11:38 -0500)
committerBrian West <brian@freeswitch.org>
Mon, 7 Oct 2013 16:38:08 +0000 (11:38 -0500)
src/switch_rtp.c

index a5b091fe17ab0d0ddceb6f19ac2db279485e6811..c7f15f01f1a0653d44822a810d4a1ea276273991 100644 (file)
@@ -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]) {