[asterisk-commits] branch oej/rtcp r18794 - /team/oej/rtcp/rtp.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Apr 10 05:44:51 MST 2006


Author: oej
Date: Mon Apr 10 07:44:49 2006
New Revision: 18794

URL: http://svn.digium.com/view/asterisk?rev=18794&view=rev
Log:
Merge John's latest rtcp patch from bug tracker.

Modified:
    team/oej/rtcp/rtp.c

Modified: team/oej/rtcp/rtp.c
URL: http://svn.digium.com/view/asterisk/team/oej/rtcp/rtp.c?rev=18794&r1=18793&r2=18794&view=diff
==============================================================================
--- team/oej/rtcp/rtp.c (original)
+++ team/oej/rtcp/rtp.c Mon Apr 10 07:44:49 2006
@@ -471,6 +471,7 @@
 	unsigned int msw;
 	unsigned int lsw;
 	unsigned int comp;
+	struct ast_frame *f = &ast_null_frame;
 	
 	if (!rtp || !rtp->rtcp)
 		return &ast_null_frame;
@@ -534,9 +535,9 @@
 	  		rtp->rtcp->themrxlsr = ((ntohl(rtcpheader[i]) & 0x0000ffff) << 16) | ((ntohl(rtcpheader[i+1]) & 0xffff) >> 16); /* Going to LSR in RR*/
     
 	  		if(rtcp_debug_test_addr(&sin)){
-	  			ast_verbose("NTP timestamp: %lu.%010lu\n",ntohl(rtcpheader[i]), ntohl(rtcpheader[i+1])*4096);
-	  			ast_verbose("RTP timestamp: %lu\n",ntohl(rtcpheader[i+2]));
-	  			ast_verbose("SPC: %lu\tSOC: %lu\n",ntohl(rtcpheader[i+3]),ntohl(rtcpheader[i+4]));
+	  			ast_verbose("NTP timestamp: %lu.%010lu\n",(unsigned long)ntohl(rtcpheader[i]), (unsigned long)ntohl(rtcpheader[i+1])*4096);
+	  			ast_verbose("RTP timestamp: %lu\n",(unsigned long)ntohl(rtcpheader[i+2]));
+	  			ast_verbose("SPC: %lu\tSOC: %lu\n",(unsigned long)ntohl(rtcpheader[i+3]),(unsigned long)ntohl(rtcpheader[i+4]));
 	  		}
 				i += 5;
 				if (rc < 1)
@@ -564,12 +565,12 @@
 	  		rtp->rtcp->reported_jitter = ntohl(rtcpheader[i+3]);
 	  		rtp->rtcp->reported_lost = ntohl(rtcpheader[i+1]) & 0xffffff;
 	  		if(rtcp_debug_test_addr(&sin)){
-	  			ast_verbose("Fraction lost: %ld\n", ((ntohl(rtcpheader[i+1]) & 0xff000000) >> 24));
+	  			ast_verbose("Fraction lost: %ld\n", (((long)ntohl(rtcpheader[i+1]) & 0xff000000) >> 24));
 	  			ast_verbose("Packets lost so far: %d\n", rtp->rtcp->reported_lost);
-	  			ast_verbose("Highest sequence number: %ld\n", (ntohl(rtcpheader[i+2]) & 0xffff));
-	  			ast_verbose("Sequence number cycles: %ld\n", (ntohl(rtcpheader[i+2]) & 0xffff) >> 16);
+	  			ast_verbose("Highest sequence number: %ld\n", (long)(ntohl(rtcpheader[i+2]) & 0xffff));
+	  			ast_verbose("Sequence number cycles: %ld\n", (long)(ntohl(rtcpheader[i+2]) & 0xffff) >> 16);
 	  			ast_verbose("Interarrival jitter: %u\n", rtp->rtcp->reported_jitter);
-	  			ast_verbose("Last SR(our NTP): %lu.%010lu\n",ntohl(rtcpheader[i+4])>>16,(ntohl(rtcpheader[i+4])<<16)*4096);
+	  			ast_verbose("Last SR(our NTP): %lu.%010lu\n",(unsigned long)ntohl(rtcpheader[i+4])>>16,((unsigned long)ntohl(rtcpheader[i+4])<<16)*4096);
 	  			ast_verbose("DLSR: %4.4f (sec)\n",ntohl(rtcpheader[i+5])/65536.0);
 	  			if(rtt)
 	  				ast_verbose("RTT: %f(sec)\n", rtt);
@@ -577,8 +578,15 @@
 	  		break;
 	  	case RTCP_PT_FUR:
 	  		if(rtcp_debug_test_addr(&sin))
-	  			ast_verbose("Received a Fast Update Request\n");
-			  break;
+	  			ast_verbose("Received an RTCP Fast Update Request\n");
+	  		rtp->f.frametype = AST_FRAME_CONTROL;
+	  		rtp->f.subclass = AST_CONTROL_VIDUPDATE;
+	  		rtp->f.datalen = 0;
+	  		rtp->f.samples = 0;
+	  		rtp->f.mallocd = 0;
+	  		rtp->f.src = "RTP";
+	  		f = &rtp->f;
+	  		break;
 	  	case RTCP_PT_SDES:
 	  		if(rtcp_debug_test_addr(&sin))
 	  			ast_verbose("Received an SDES from %s:%d\n", ast_inet_ntoa(iabuf, sizeof(iabuf), rtp->rtcp->them.sin_addr), ntohs(rtp->rtcp->them.sin_port));
@@ -594,7 +602,7 @@
 		position += (length + 1);
 	}
 			
-	return &ast_null_frame;
+	return f;
 }
 
 static void calc_rxstamp(struct timeval *tv, struct ast_rtp *rtp, unsigned int timestamp, int mark)
@@ -1612,7 +1620,7 @@
 	unsigned int expected;
 	unsigned int expected_interval;
 	unsigned int received_interval;
-	unsigned int lost_interval;
+	int lost_interval;
 	int fraction;
 	struct timeval dlsr;
 	char bdata[512];
@@ -1657,7 +1665,7 @@
 	timersub(&now, &rtp->rtcp->rxlsr, &dlsr);
 	rtcpheader[7] = htonl(rtp->themssrc);
 	rtcpheader[8] = htonl(((fraction & 0xff) << 24) | (lost & 0xffffff));
-	rtcpheader[9] = htonl((rtp->cycles << 16) | ((rtp->lastrxseqno & 0xffff)));
+	rtcpheader[9] = htonl((rtp->cycles) | ((rtp->lastrxseqno & 0xffff)));
 	rtcpheader[10] = htonl((unsigned int)rtp->rxjitter);
 	rtcpheader[11] = htonl(rtp->rtcp->themrxlsr);
 	rtcpheader[12] = htonl((((dlsr.tv_sec * 1000) + (dlsr.tv_usec / 1000)) * 65536) / 1000);
@@ -1721,7 +1729,7 @@
 	unsigned int expected;
 	unsigned int expected_interval;
 	unsigned int received_interval;
-	unsigned int lost_interval;
+	int lost_interval;
 	struct timeval now;
 	unsigned int *rtcpheader;
 	char bdata[1024];
@@ -1758,7 +1766,7 @@
 	rtcpheader[1] = htonl(rtp->ssrc);
 	rtcpheader[2] = htonl(rtp->themssrc);
 	rtcpheader[3] = htonl(((fraction & 0xff) << 24) | (lost & 0xffffff));
-	rtcpheader[4] = htonl((rtp->cycles << 16) | ((rtp->lastrxseqno & 0xffff)));
+	rtcpheader[4] = htonl((rtp->cycles) | ((rtp->lastrxseqno & 0xffff)));
 	rtcpheader[5] = htonl((unsigned int)rtp->rxjitter);
 	rtcpheader[6] = htonl(rtp->rtcp->themrxlsr);
 	rtcpheader[7] = htonl((((dlsr.tv_sec * 1000) + (dlsr.tv_usec / 1000)) * 65536) / 1000);



More information about the asterisk-commits mailing list