[Sumover-dev] [svn commit] r4523 - vic/branches/cc/cc

sumover-dev at cs.ucl.ac.uk sumover-dev at cs.ucl.ac.uk
Thu Oct 22 00:14:40 BST 2009


Author: soohyunc
Date: Thu Oct 22 00:14:40 2009
New Revision: 4523

Modified:
   vic/branches/cc/cc/tfwc_rcvr.cpp
   vic/branches/cc/cc/tfwc_rcvr.h

Log:
1) there was a bug when clearing all the bits for AckVec
	- it should be placed just after calculating 
		o  the number of AckVec
		o  the number of AckVec chunks

2) there was a bug for bit shifting
	it didn't properly set the first bit of the next AckVec chunk

3) added a feature if the receiver got the duplicated seqno, then it just skips adding 
it to the AckVec.



Modified: vic/branches/cc/cc/tfwc_rcvr.cpp
==============================================================================
--- vic/branches/cc/cc/tfwc_rcvr.cpp	(original)
+++ vic/branches/cc/cc/tfwc_rcvr.cpp	Thu Oct 22 00:14:40 2009
@@ -53,7 +53,7 @@
 {
 	// tfwcAV (bit vector)
 	tfwcAV = (u_int16_t *) malloc(sizeof(u_int16_t *));
-	bzero(tfwcAV, numVec_);
+	clear_avec(numVec_);
 }
 
 // retrive ackofack from RTCP control channel
@@ -73,18 +73,23 @@
 // retrieve data packet sequence number from RTP data channel
 void TfwcRcvr::tfwc_rcvr_recv_seqno(u_int16_t seqno)
 {
+	// required number of AckVec elements
+	numElm_ = seqno - ackofack_;
+
+	// required number of AckVec chunks
+	numVec_ = numElm_/BITLEN + (numElm_%BITLEN > 0);
+
 	// reset necessary variables before start
 	reset();
 
-	// required number of AckVec elements
-	numElm_ = seqno - ackofack();
-
 	// reference vector
 	for (int i = 1; i <= numElm_; i++)
 		rvec_.push_back(ackofack_ + i);
 
 	// push back the current seqno
-	avec_.push_back(seqno);
+	// (if this is duplicate seqno, skip adding it)
+	if (find(avec_.begin(), avec_.end(), seqno) == avec_.end())
+		avec_.push_back(seqno);
 	sort(avec_.begin(), avec_.end());
 
 	// then, trim upto ackofack (inclusive)
@@ -92,9 +97,6 @@
 	if (avit_ != avec_.end()) 
 		avec_.erase(avec_.begin(), ++avit_);
 
-	// required number of AckVec chunks
-	numVec_ = numElm_/BITLEN + (numElm_%BITLEN > 0);
-
 	// now, build tfwcAV chunks
 	tfwc_ackvec();
 
@@ -125,7 +127,7 @@
 				tfwcAV[cv] = (tfwcAV[cv] << 1) | 1;
 				cb++;
 			} 
-			else {
+			if (cb == BITLEN) {
 				cb = 0;
 				cv++;
 			}
@@ -136,7 +138,7 @@
 				tfwcAV[cv] = (tfwcAV[cv] << 1) | 0;
 				cb++;
 			}
-			else {
+			if (cb == BITLEN) {
 				cb = 0;
 				cv++;
 			}
@@ -163,6 +165,6 @@
 
 // reset
 void TfwcRcvr::reset() {
-	bzero(tfwcAV, numVec_);
 	rvec_.clear();
+	clear_avec(numVec_);
 }

Modified: vic/branches/cc/cc/tfwc_rcvr.h
==============================================================================
--- vic/branches/cc/cc/tfwc_rcvr.h	(original)
+++ vic/branches/cc/cc/tfwc_rcvr.h	Thu Oct 22 00:14:40 2009
@@ -84,6 +84,12 @@
 	// returning AckOfAck
 	inline u_int16_t ackofack() { return ackofack_; }
 
+	// clear tfwcAV
+	inline void clear_avec(int num) {
+		for (int i = 0; i < num; i++)
+			tfwcAV[i] = 0;
+	}
+
 	// print built AckVec
 	void print_tfwcAV();
 	void print_vec(std::vector<int> v);



More information about the Sumover-dev mailing list