[Sumover-dev] [svn commit] r4784 - in vic/branches/cc: cc codec

sumover-dev at cs.ucl.ac.uk sumover-dev at cs.ucl.ac.uk
Wed Apr 28 15:09:39 BST 2010


Author: soohyunc
Date: Wed Apr 28 15:09:39 2010
New Revision: 4784

Modified:
   vic/branches/cc/cc/tfwc_sndr.cpp
   vic/branches/cc/cc/tfwc_sndr.h
   vic/branches/cc/codec/encoder-h261.cpp
   vic/branches/cc/net/pktbuf.h

Log:
create a field in pktbuf (i.e., bool tag) to indicate if this packet belongs to
the same video frame or not. 
	- if tag is set (true), then this packets belong to the same frame.
	- if tag is set to false at the very last packets for the frame.

based on this information, CC module can compute the average packet size in
bytes.
	- first, compute the arithmetic average packet size per frame
	- then, use this average size to compute EWMA packet size

then, cwnd (in bytes) can be computed:
	- cwnd (in bytes) = psize * cwnd (in packets)



Modified: vic/branches/cc/cc/tfwc_sndr.cpp
==============================================================================
--- vic/branches/cc/cc/tfwc_sndr.cpp	(original)
+++ vic/branches/cc/cc/tfwc_sndr.cpp	Wed Apr 28 15:09:39 2010
@@ -143,6 +143,9 @@
 	// record of packet size in bytes
 	record_ = (u_int16_t *)malloc(sizeof(u_int16_t) * PSR);
 	clear_record(PSR);
+	// EWMA packet size
+	asize_ = 0;
+	pcnt_ = 0;
 	psize_ = 0;
 	lambda_ = .75;
 }
@@ -159,9 +162,17 @@
 	// number of bytes for this packet
 	record_[seqno_%PSR] = pb->len;
 	//print_psize(now_, record_[seqno_%PSR]);
-	
-	// EWMA'd packet size
-	psize_ = lambda_ * pb->len + (1 - lambda_) * psize_;	
+
+	// arithmetic average
+	asize_ += pb->len;
+	asize_ /= ++pcnt_;
+
+	// tag finished (end of frame)
+	if (!(pb->tag)) {
+		// EWMA'd packet size
+		psize_ = lambda_ * asize_ + (1 - lambda_) * psize_;	
+		pcnt_ = 0;
+	}
 
 	// timestamp vector for loss history update
 	tsvec_[seqno_%TSZ] = now_-SKEW;

Modified: vic/branches/cc/cc/tfwc_sndr.h
==============================================================================
--- vic/branches/cc/cc/tfwc_sndr.h	(original)
+++ vic/branches/cc/cc/tfwc_sndr.h	Wed Apr 28 15:09:39 2010
@@ -175,8 +175,10 @@
 	double prev_ts_;
 
 	// packet size
-	int psize_;
-	double lambda_;
+	int asize_;		// average packet size per frame
+	int pcnt_;		// packet counter per frame
+	int psize_;		// EWMA packet size 
+	double lambda_;	// EWMA coeff
 
 private:
 	// update RTT

Modified: vic/branches/cc/codec/encoder-h261.cpp
==============================================================================
--- vic/branches/cc/codec/encoder-h261.cpp	(original)
+++ vic/branches/cc/codec/encoder-h261.cpp	Wed Apr 28 15:09:39 2010
@@ -963,6 +963,7 @@
 	tx_->flush();
 
 	pktbuf* pb = pool_->alloc(vf->ts_, RTP_PT_H261);
+	pb->tag = true;
 	bs_ = &pb->data[HDRSIZE];
 	bc_ = bs_;
 	u_int ec = (tx_->mtu() - HDRSIZE) << 3;
@@ -1052,6 +1053,7 @@
 
 		}
 	}
+	pb->tag = false;
 	cc += flush(pb, ((bc_ - bs_) << 3) + nbb_, 0);
 
 	// time measurement

Modified: vic/branches/cc/net/pktbuf.h
==============================================================================
--- vic/branches/cc/net/pktbuf.h	(original)
+++ vic/branches/cc/net/pktbuf.h	Wed Apr 28 15:09:39 2010
@@ -91,6 +91,7 @@
 	int layer;
 	int len;
 	int ref;
+	bool tag;
 	u_int8_t* dp;
 	u_int8_t data[PKTBUF_SIZE];
 	BufferPool* manager;



More information about the Sumover-dev mailing list