[svn-commits] branch oej/test-this-branch r18795 - /team/oej/test-this-branch/rtp.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Mon Apr 10 05:45:53 MST 2006


Author: oej
Date: Mon Apr 10 07:45:50 2006
New Revision: 18795

URL: http://svn.digium.com/view/asterisk?rev=18795&view=rev
Log:
Merge latest rtcp update

Modified:
    team/oej/test-this-branch/rtp.c

Modified: team/oej/test-this-branch/rtp.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/rtp.c?rev=18795&r1=18794&r2=18795&view=diff
==============================================================================
--- team/oej/test-this-branch/rtp.c (original)
+++ team/oej/test-this-branch/rtp.c Mon Apr 10 07:45:50 2006
@@ -473,6 +473,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;
@@ -536,9 +537,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)
@@ -566,12 +567,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);
@@ -579,8 +580,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));
@@ -596,7 +604,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)
@@ -1628,7 +1636,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];
@@ -1673,7 +1681,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);
@@ -1736,7 +1744,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];
@@ -1773,7 +1781,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 svn-commits mailing list