[Sumover-dev] [svn commit] r4257 - in vic/branches/cc: rtp

sumover-dev at cs.ucl.ac.uk sumover-dev at cs.ucl.ac.uk
Sat Aug 9 20:51:03 BST 2008


Author: soohyunc
Date: Sat Aug  9 20:50:56 2008
New Revision: 4257

Modified:
   vic/branches/cc/cc/tfwc_rcvr.cpp
   vic/branches/cc/cc/tfwc_rcvr.h
   vic/branches/cc/cc/tfwc_sndr.h
   vic/branches/cc/rtp/session.cpp
   vic/branches/cc/rtp/session.h

Log:
o RTP/RTCP control loop finished.


Modified: vic/branches/cc/cc/tfwc_rcvr.cpp
==============================================================================
--- vic/branches/cc/cc/tfwc_rcvr.cpp	(original)
+++ vic/branches/cc/cc/tfwc_rcvr.cpp	Sat Aug  9 20:50:56 2008
@@ -48,6 +48,14 @@
 	seqno_(0) 
 {}
 
+void TfwcRcvr::tfwc_rcvr_recv(u_int16_t seqno, 
+		u_int16_t ackofack, u_int32_t ts) 
+{
+	UNUSED(seqno);
+	UNUSED(ackofack);
+	UNUSED(ts);
+}
+
 void TfwcRcvr::set_received_seqno(u_int16_t seqno, u_int16_t lastseq) 
 {
 	seqno_ = seqno;

Modified: vic/branches/cc/cc/tfwc_rcvr.h
==============================================================================
--- vic/branches/cc/cc/tfwc_rcvr.h	(original)
+++ vic/branches/cc/cc/tfwc_rcvr.h	Sat Aug  9 20:50:56 2008
@@ -47,6 +47,7 @@
 class TfwcRcvr {
 public:
 	TfwcRcvr();
+	void tfwc_rcvr_recv(u_int16_t seqno, u_int16_t ackofack, u_int32_t ts);
 	void set_received_seqno(u_int16_t seqno, u_int16_t lastseq);
 
 protected:

Modified: vic/branches/cc/cc/tfwc_sndr.h
==============================================================================
--- vic/branches/cc/cc/tfwc_sndr.h	(original)
+++ vic/branches/cc/cc/tfwc_sndr.h	Sat Aug  9 20:50:56 2008
@@ -43,7 +43,13 @@
 	void tfwc_sndr_send(pktbuf*);
 	void tfwc_sndr_recv(u_int32_t ackv, u_int32_t ts_echo);
 	inline u_int16_t tfwc_sndr_get_seqno() { return seqno_; }
-	inline u_int32_t tfwc_sndr_get_aoa() { return aoa_; }
+	inline u_int16_t tfwc_sndr_get_aoa() { return aoa_; }
+	inline u_int32_t tfwc_sndr_now() {
+		timeval tv;
+		::gettimeofday(&tv, 0);
+		return ((u_int32_t) tv.tv_sec + tv.tv_usec);
+	}
+	inline u_int32_t tfwc_sndr_get_ts() { return ts_; }
 	void ackofack();	// set ack of ack
 	u_int16_t seqno_;	// packet sequence number
 
@@ -51,7 +57,7 @@
 
 	u_int32_t marginvec_;	// margin vec
 	u_int32_t ackv_;	// AckVec (in TfwcSndr)
-	u_int32_t aoa_;		// ack of ack
+	u_int16_t aoa_;		// ack of ack
 	u_int32_t ts_;		// time stamp
 	u_int32_t ts_echo_;	// echo time stamp from the receiver
 	TfwcSndr* tfwcsndr_;

Modified: vic/branches/cc/rtp/session.cpp
==============================================================================
--- vic/branches/cc/rtp/session.cpp	(original)
+++ vic/branches/cc/rtp/session.cpp	Sat Aug  9 20:50:56 2008
@@ -625,7 +625,7 @@
 void SessionManager::announce(CtrlHandler* ch)
 {
 	send_report(ch, 0);
-	//send_xreport(ch, 0);
+	//send_xreport(ch, 0);	// this XR report will be driven by timer
 }
 
 /*
@@ -670,29 +670,24 @@
 		rr = (rtcp_rr*)(rh + 1);
 	}
 
-	// set this to XR packet
+	// set this RTCP flag to XR packet
 	flags |= RTCP_PT_XR;
 	// access XR header 
 	xrh = (rtcp_xr_hdr*)(rh + 1);
 	// XR block length
 	int xrlen = (xrh->xr_flags << 16) >> 16;
 	xrb = (rtcp_xr_blk*)(xrh + xrlen + 1);
-	// access XR block contents
-	// for ackofack
-	xrb->begin_seq = htonl(lastseq_);
-	xrb->end_seq = htonl(seqno_ + 1);
 
-	// this chunk is used for ackvec
+	// this chunk is used for giving seqno and ackofack
 	if(xrh->xr_flags & (bt << 28) == XR_BT_1) {
-		xrb->chunk = (u_int32_t *) htonl(tfwc_rcvr_getvec());
+		xrb->end_seq = htons(tfwc_sndr_get_seqno());
+		xrb->begin_seq = htons(tfwc_sndr_get_aoa());
+		xrb->chunk = NULL;
 	} 
 	
-	// this chunk is used for timestamp
+	// this chunk is used for giving timestamp
 	if(xrh->xr_flags & (bt << 28) == XR_BT_3) {
-		timeval tv;
-		::gettimeofday(&tv, 0);
-		u_int32_t time = (u_int32_t) (tv.tv_sec + tv.tv_usec);
-		xrb->chunk = (u_int32_t *) time;
+		xrb->chunk = (u_int32_t *) htonl(tfwc_sndr_get_ts());
 	}
 
 	int nrr = 0;
@@ -1250,31 +1245,39 @@
 
 	int xrlen = (xrh->xr_flags << 16) >> 16;
 	rtcp_xr_blk* xrb = (rtcp_xr_blk*)(xrh + xrlen + 1);
-	/*
-	 * if AoA is received, trim ackvec and send a new ackvec
-	 * if AckVec is received, then parse it to TfwcSndr
-	 */
-	if (xrb->begin_seq == xrb->end_seq) {
-		debug_msg(" --- RTP Receiver Side Operation\n");
-		// we received ackofack, so do receiver stuffs here
-		//trim_ackvec((u_int32_t) &xrb->chunk);	// chunk in xrb is ackvec
+
+	// we received seqno/ackofack, so do receiver stuffs here
+	if (xrb->chunk == NULL) {
+		// parse seqno, ackofack, and timestamp from XR report block
+		if(((xrh->xr_flags & XR_BT_1) >> 24) == (XR_BT_1 >> 24)) {
+			ackofack_ = xrb->begin_seq;
+			seqno_ = xrb->end_seq;
+		}
+		if(((xrh->xr_flags & XR_BT_3) >> 24) == (XR_BT_3 >> 24)) {
+			ts_ = (u_int32_t) &xrb->chunk;
+		}
+
+		// parse seqno, ackofack, and timestamp to TfwcRcvr
+		tfwc_rcvr_recv(seqno_, ackofack_, ts_);
+
+		// send receiver side XR report
 		ch_[0].send(build_ackv_pkt(xrh, ssrc), xrlen);
 		ch_[0].send(build_ts_echo_pkt(xrh, ssrc), xrlen);
-	} else {
-		debug_msg(" --- RTP Sender Side Operation\n");
-		// we received ackvec, so do sender stuffs here
-		if((xrh->xr_flags & XR_BT_1) >> 24 == 1) {
-			// this is an XR containing ackvec
-			debug_msg("	this is AckVec XR...\n");
+	}
+
+	// we received ackvec, so do sender stuffs here
+	else {
+
+		// parse seqno, ackvec and timestamp echo from XR report block
+		if(((xrh->xr_flags & XR_BT_1) >> 24) == (XR_BT_1 >> 24)) {
 			ackvec_ = (u_int32_t) &xrb->chunk;
-			ackofack_ = xrb->end_seq - 1;
 		}
-		if((xrh->xr_flags & XR_BT_3) >> 24 == 3) {
-			// this is an XR containing ts echo 
-			debug_msg("	this is ts_echo XR...\n");
+		if(((xrh->xr_flags & XR_BT_3) >> 24) == (XR_BT_3 >> 24)) {
 			ts_echo_ = (u_int32_t) &xrb->chunk;
 		}
-		tfwc_sndr_recv(ackvec_, ts_echo_);	// parse AckVec
+
+		// parse ackvec and timestamp echo to TfwcSndr
+		tfwc_sndr_recv(ackvec_, ts_echo_);
 	}
 }
 

Modified: vic/branches/cc/rtp/session.h
==============================================================================
--- vic/branches/cc/rtp/session.h	(original)
+++ vic/branches/cc/rtp/session.h	Sat Aug  9 20:50:56 2008
@@ -210,8 +210,9 @@
 	u_int16_t ackofack_;	// Ack of ack
 
 	// AckVector
-	u_int32_t ackvec_;		// this is a bit vector
-	u_int32_t ts_echo_;		// time stamp echo
+	u_int32_t ackvec_;	// this is a bit vector
+	u_int32_t ts_;		// timestamp
+	u_int32_t ts_echo_;	// timestamp echo
 };
 
 class AudioSessionManager : public SessionManager {



More information about the Sumover-dev mailing list