[Sumover-dev] [svn commit] r4353 - vic/branches/cc/rtp

sumover-dev at cs.ucl.ac.uk sumover-dev at cs.ucl.ac.uk
Wed Jan 21 17:50:01 GMT 2009


Author: soohyunc
Date: Wed Jan 21 17:50:00 2009
New Revision: 4353

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

Log:

o	implemented a global variable saying if this is a data sender or not.



Modified: vic/branches/cc/rtp/session.cpp
==============================================================================
--- vic/branches/cc/rtp/session.cpp	(original)
+++ vic/branches/cc/rtp/session.cpp	Wed Jan 21 17:50:00 2009
@@ -474,12 +474,14 @@
 // sending ack of ack packet (RTCP XR report packet)
 void CtrlHandler::send_aoa()
 {
+	i_am_sender();
 	sm_->build_aoa_pkt(this);
 }
 
 // sending time stamp packet (RTCP XR report packet)
 void CtrlHandler::send_ts()
 {
+	i_am_sender();
 	sm_->build_ts_pkt(this);
 }
 
@@ -1165,22 +1167,18 @@
 
 	// XR block flags
 	u_int16_t flags = xr->xr_flags;
-
-	// ackofack and seqno
-	//ackofack_ = ntohs(xr->begin_seq);
-	//seqno_ = ntohs(xr->end_seq);
 	
 	// parse XR information (begin, end, chunk)
 	u_int16_t begin	= ntohs(xr->begin_seq);
 	u_int16_t end	= ntohs(xr->end_seq);
 	u_int16_t chunk	= ntohs(xr->chunk);
 
-	// we received seqno/ackofack, so do receiver stuffs here
-	if (seqno_ != ackofack_) {
+	// i am an RTP data sender, so do the sender stuffs
+	if (am_i_sender()) {
 		// parse seqno, ackofack, and timestamp from XR report block
 		if(flags == XR_BT_1) {
 			// this is XR conveys seqno and ackofack
-			tfwc_rcvr_recv(flags, seqno_, ackofack_, 0);
+			tfwc_rcvr_recv(flags, begin, chunk, 0);
 		}
 		else if(flags == XR_BT_3) {
 			ts_ = ntohl(xr->chunk);
@@ -1193,7 +1191,7 @@
 		ch_[0].send_ackv();
 		//ch_[0].send_ts_echo();
 	}
-	// we received ackvec, so do sender stuffs here
+	// i am an RTP data receiver, so do the receiver stuffs
 	else {
 		// parse ackvec and timestamp echo from XR report block
 		if(flags == XR_BT_1) {
@@ -1447,9 +1445,10 @@
 		++nrunt_;
 		return;
 	}
+
 	/*
 	 * try to filter out junk: first thing in packet must be
-	 * sr, rr or bye & version number must be correct.
+	 * sr, rr, xr or bye & version number must be correct.
 	 */
 	switch(ntohs(rh->rh_flags) & 0xc0ff) {
 	case RTP_VERSION << 14 | RTCP_PT_SR:
@@ -1461,7 +1460,7 @@
 		/*
 		 * XXX should further categorize this error -- it is
 		 * likely that people mis-implement applications that
-		 * don't put something other than SR,RR,BYE first.
+		 * don't put something other than SR,RR,XR,BYE first.
 		 */
 		++badversion_;
 		return;
@@ -1485,10 +1484,10 @@
 		return;
 	
 	int layer = ch - ch_;
-		/*
-		* Outer loop parses multiple RTCP records of a "compound packet".
-		* There is no framing between records.  Boundaries are implicit
-		* and the overall length comes from UDP.
+	/*
+	*  Outer loop parses multiple RTCP records of a "compound packet".
+	*  There is no framing between records.  Boundaries are implicit
+	*  and the overall length comes from UDP.
 	*/
 	u_char* epack = (u_char*)rh + cc;
 	while ((u_char*)rh < epack) {

Modified: vic/branches/cc/rtp/session.h
==============================================================================
--- vic/branches/cc/rtp/session.h	(original)
+++ vic/branches/cc/rtp/session.h	Wed Jan 21 17:50:00 2009
@@ -46,6 +46,14 @@
 
 class Source;
 class SessionManager;
+/* 
+ * global variable representing data sender or receiver
+ * (by default, it is set to a data receiver.)
+ *
+ * e.g., for data sender, it must change this variable 
+ * 		using i_am_sender() method.
+*/
+bool is_sender_ = false;
 
 class DataHandler : public IOHandler {
     public:
@@ -99,6 +107,9 @@
 	void send_ackv();
 	void send_ts_echo();
 
+	// i am an RTP data sender
+	inline void i_am_sender() { is_sender_ = true; }
+
  protected:
 	void schedule_timer();
 	double ctrl_inv_bw_;
@@ -134,6 +145,9 @@
 	void build_ts_echo_pkt(CtrlHandler* ch);
 	void cc_output();
 
+	// am i a data sender?
+	inline bool am_i_sender() { return is_sender_; }
+
 protected:
 //	void demux(rtphdr* rh, u_char* bp, int cc, Address & addr, int layer);
 	void demux(pktbuf* pb, Address & addr);



More information about the Sumover-dev mailing list