[Freeswitch-svn] [commit] r7628 - freeswitch/trunk/src

Freeswitch SVN brian at freeswitch.org
Fri Feb 15 15:31:11 EST 2008


Author: brian
Date: Fri Feb 15 15:31:10 2008
New Revision: 7628

Modified:
   freeswitch/trunk/src/switch_rtp.c

Log:
move invalid check/handler up in switch_rtp

Modified: freeswitch/trunk/src/switch_rtp.c
==============================================================================
--- freeswitch/trunk/src/switch_rtp.c	(original)
+++ freeswitch/trunk/src/switch_rtp.c	Fri Feb 15 15:31:10 2008
@@ -1043,6 +1043,26 @@
 			switch_core_timer_step(&rtp_session->timer);
 		}
 
+		if (bytes && rtp_session->recv_msg.header.version != 2) {
+			uint8_t *data = (uint8_t *) rtp_session->recv_msg.body;
+			if (rtp_session->recv_msg.header.version == 0 && rtp_session->ice_user) {
+				handle_ice(rtp_session, (void *) &rtp_session->recv_msg, bytes);
+			}
+
+			if (rtp_session->invalid_handler) {
+				rtp_session->invalid_handler(rtp_session, rtp_session->sock, (void *) &rtp_session->recv_msg, bytes, rtp_session->from_addr);
+			}
+			
+			memset(data, 0, 2);
+			data[0] = 65;
+
+			rtp_session->recv_msg.header.pt = (uint32_t) rtp_session->cng_pt ? rtp_session->cng_pt : SWITCH_RTP_CNG_PAYLOAD;
+			*flags |= SFF_CNG;
+			*payload_type = (switch_payload_t)rtp_session->recv_msg.header.pt;
+			ret = 2 + rtp_header_len;
+			goto end;
+		}
+
 		if (bytes && switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_RECV)) {
 			int sbytes = (int) bytes;
 			err_status_t stat = 0;
@@ -1063,7 +1083,6 @@
 
 			stat = srtp_unprotect(rtp_session->recv_ctx, &rtp_session->recv_msg.header, &sbytes);
 
-
 			if (stat && rtp_session->recv_msg.header.pt != rtp_session->te && rtp_session->recv_msg.header.pt != rtp_session->cng_pt) {
 				if (++rtp_session->srtp_errs >= MAX_SRTP_ERRS) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
@@ -1225,26 +1244,6 @@
 			}
 		}
 
-		if (bytes && rtp_session->recv_msg.header.version != 2) {
-			uint8_t *data = (uint8_t *) rtp_session->recv_msg.body;
-			if (rtp_session->recv_msg.header.version == 0 && rtp_session->ice_user) {
-				handle_ice(rtp_session, (void *) &rtp_session->recv_msg, bytes);
-			}
-
-			if (rtp_session->invalid_handler) {
-				rtp_session->invalid_handler(rtp_session, rtp_session->sock, (void *) &rtp_session->recv_msg, bytes, rtp_session->from_addr);
-			}
-			
-			memset(data, 0, 2);
-			data[0] = 65;
-
-			rtp_session->recv_msg.header.pt = (uint32_t) rtp_session->cng_pt ? rtp_session->cng_pt : SWITCH_RTP_CNG_PAYLOAD;
-			*flags |= SFF_CNG;
-			*payload_type = (switch_payload_t)rtp_session->recv_msg.header.pt;
-			ret = 2 + rtp_header_len;
-			goto end;
-		}
-
 		if (bytes > 0) {
 			rtp_session->missed_count = 0;
 		}



More information about the Freeswitch-svn mailing list