[Sumover-dev] [svn commit] r4621 - in vic/branches/cc: codec rtp
sumover-dev at cs.ucl.ac.uk
sumover-dev at cs.ucl.ac.uk
Thu Feb 18 19:14:21 GMT 2010
Author: soohyunc
Date: Thu Feb 18 19:14:21 2010
New Revision: 4621
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/rtp/session.cpp
vic/branches/cc/rtp/transmitter.cpp
Log:
(1) TfwcSndr had a different gettimeofday for any kind of timing related
calculation - TfwcSndr's gettimeofday is sync'ed with Tx/Encoder/SM etc.
(2) When send packets, we do not need to parse RTP seqno again at TfwcSndr.
Instead we could simply pass the seqno specifically to TfwcSndr.
- hoping to save some time when sending packets at the data sender.
These changes are related to tfwc_send_sndr() method and calling funcs.
(3) Commented out a lot of unnecessary debug messages
- these can be enabled anytime in the future.
Modified: vic/branches/cc/cc/tfwc_sndr.cpp
==============================================================================
--- vic/branches/cc/cc/tfwc_sndr.cpp (original)
+++ vic/branches/cc/cc/tfwc_sndr.cpp Thu Feb 18 19:14:21 2010
@@ -71,9 +71,6 @@
clear_sqv(SSZ);
num_seqvec_ = 0;
- // is TFWC running?
- is_running_ = false;
-
// for simulating TCP's 3 dupack rule
// (allowing packet re-ordering issue)
for (int i = 0; i < DUPACKS; i++)
@@ -106,37 +103,23 @@
tot_weight_ = 0.0;
}
-void TfwcSndr::tfwc_sndr_send(pktbuf* pb) {
-
- // get RTP header information
- rtphdr* rh =(rtphdr*) pb->data;
+void TfwcSndr::tfwc_sndr_send(int seqno, double now, double offset) {
- // get seqno and mark timestamp for this data packet
- seqno_ = ntohs(rh->rh_seqno);
- now_ = tfwc_sndr_now(); // (double) type
- t_now_ = tfwc_sndr_t_now(); // (u_int32_t) type
-
- // is TFWC running? (is this the first data packet?)
- if (!is_running_) {
- ref_time_ = now_;
- ref_t_time_ = t_now_;
- is_running_ = true;
- }
-
- // interpret human-readable time format
- now_ -= ref_time_; // (double) type
- //t_now_ -= ref_t_time_; // (u_int32_t) type
+ // parse seqno and mark timestamp for this data packet
+ seqno_ = seqno;
+ now_ = now;
+ ts_off_ = offset;
// timestamp vector for loss history update
tsvec_[seqno_%TSZ - 1] = now_;
- fprintf(stderr, "\t>> now_:%f, tsvec_[%d]:%f\n",
- now(), seqno_%TSZ - 1, tsvec_[seqno_%TSZ-1]);
+ //fprintf(stderr, "\t>> now_:%f, tsvec_[%d]:%f\n",
+ // now_, seqno_%TSZ - 1, tsvec_[seqno_%TSZ-1]);
// sequence number must be greater than zero
- assert (seqno_ > 0);
+ //assert (seqno_ > 0);
// number of total data packet sent
- ndtp_++;
+ //ndtp_++;
}
/*
@@ -146,7 +129,7 @@
u_int16_t *chunk)
{
// number of ack received
- nakp_++;
+ //nakp_++;
// get start/end seqno that this XR chunk reports
begins_ = begin; // lowest packet seqno
@@ -172,9 +155,9 @@
// clone AckVec from Vic
clone_ackv(chunk, num_vec_);
- fprintf(stderr,
- " [%s +%d] begins:%d, ends:%d, jacked:%d\n",
- __FILE__, __LINE__, begins_, ends_, jacked_);
+ //fprintf(stderr,
+ //" [%s +%d] begins:%d, ends:%d, jacked:%d\n",
+ // __FILE__, __LINE__, begins_, ends_, jacked_);
// generate seqno vector
gen_seqvec(ackv_, num_vec_);
@@ -203,7 +186,7 @@
else {
control();
}
- fprintf(stderr, "\tnow: %f\tcwnd: %d\n", now_, cwnd_);
+ fprintf(stderr, "\tnow: %f\tcwnd: %d\n", now(), cwnd_);
// set ackofack (real number)
aoa_ = ackofack();
Modified: vic/branches/cc/cc/tfwc_sndr.h
==============================================================================
--- vic/branches/cc/cc/tfwc_sndr.h (original)
+++ vic/branches/cc/cc/tfwc_sndr.h Thu Feb 18 19:14:21 2010
@@ -55,8 +55,8 @@
class TfwcSndr {
public:
TfwcSndr();
- // parse RTP data packet from Transmitter module
- void tfwc_sndr_send(pktbuf*);
+ // parse seqno and timestamp
+ void tfwc_sndr_send(int, double, double);
// main reception path (XR packet)
void tfwc_sndr_recv(u_int16_t type, u_int16_t begin, u_int16_t end,
@@ -86,7 +86,7 @@
}
// return the current time
- inline double now() { return now_; }
+ inline double now() { return (tfwc_sndr_now()-ts_off_); }
// return timestamp in u_int32_t type
inline u_int32_t tfwc_sndr_get_ts() { return t_now_; }
@@ -136,15 +136,15 @@
}
// print mvec
inline void print_mvec() {
- printf("\tmargin numbers: ( %d %d %d )\n",
+ fprintf(stderr, "\tmargin numbers: ( %d %d %d )\n",
mvec_[0], mvec_[1], mvec_[2]);
}
// printf seqvec
inline void print_seqvec(int numelm) {
- printf("\tsequence numbers: (");
+ fprintf(stderr, "\tsequence numbers: (");
for (int i = 0; i < numelm; i++)
- printf(" %d", seqvec_[i]);
- printf(" )\n");
+ fprintf(stderr, " %d", seqvec_[i]);
+ fprintf(stderr, " )\n");
}
int mvec_[DUPACKS]; // margin vec (simulatinmg TCP 3 dupacks)
@@ -215,7 +215,7 @@
int epoch_; // communication epoch
bool is_running_; // is TFWC running?
- double ref_time_; // reference time for gettimeofday
+ double ts_off_; // timestamp offset for gettimeofday
u_int32_t ref_t_time_; // reference time (uint32 format)
u_int32_t *seqvec_; // generated seqno vec
Modified: vic/branches/cc/codec/encoder-h261.cpp
==============================================================================
--- vic/branches/cc/codec/encoder-h261.cpp (original)
+++ vic/branches/cc/codec/encoder-h261.cpp Thu Feb 18 19:14:21 2010
@@ -800,7 +800,7 @@
ts_off_ = offset();
tx_->tx_now_offset_ = ts_off_;
enc_start_ = h261_now() - ts_off_;
- fprintf(stderr,"h261_encode_start\tnow: %f\n", enc_start_);
+ fprintf(stderr,">>>h261_encode_start\tnow: %f\n", enc_start_);
tx_->flush();
@@ -898,8 +898,8 @@
// time measurement
enc_end_ = h261_now() - ts_off_;
- fprintf(stderr,"\nh261_encode_end\tnow: %f\n", enc_end_);
- fprintf(stderr,"num: %d\tenc_time: %f\n",
+ fprintf(stderr,"\n>>>h261_encode_end\tnow: %f\n", enc_end_);
+ fprintf(stderr," num: %d\tenc_time: %f\n\n",
encno_++, (enc_end_ - enc_start_));
return (cc);
Modified: vic/branches/cc/rtp/session.cpp
==============================================================================
--- vic/branches/cc/rtp/session.cpp (original)
+++ vic/branches/cc/rtp/session.cpp Thu Feb 18 19:14:21 2010
@@ -648,8 +648,8 @@
*/
void SessionManager::build_xreport(CtrlHandler* ch, int bt)
{
- fprintf(stderr, "\tentering build_xreport().................. %s +%d\n",
- __FILE__,__LINE__);
+ //fprintf(stderr, "\tentering build_xreport().................. %s +%d\n",
+ // __FILE__,__LINE__);
// declare chunks
u_int16_t *chunks = NULL;
@@ -767,11 +767,11 @@
u_int16_t *xrchunks = (u_int16_t *) (xr + 1);
// copy XR chunks and printing
- fprintf(stderr, "\t printing chunks: ");
+ //fprintf(stderr, "\t printing chunks: ");
for (i = 0; i < num_chunks; i++) {
- fprintf(stderr, "[%d:%x] ", i, chunks[i]);
+ // fprintf(stderr, "[%d:%x] ", i, chunks[i]);
xrchunks[i] = htons(chunks[i]);
- } fprintf(stderr, "...........%s +%d\n",__FILE__,__LINE__);
+ } //fprintf(stderr, "...........%s +%d\n",__FILE__,__LINE__);
// if num_chunks is odd then increment it by one as packet size is
// measured in 32-bits pieces. And add Null chunk onto the end.
@@ -791,7 +791,7 @@
// RTCP packet length
int len = (u_char *) ++xr + (num_chunks * 2) - pktbuf_;
- fprintf(stderr, "\t RTCP XR: len: %d, xrlen: %d\n", len, xrlen);
+ //fprintf(stderr, "\t RTCP XR: len: %d, xrlen: %d\n", len, xrlen);
len = sizeof(rtcphdr) + sizeof(rtcp_xr_BT_1_hdr) + (num_chunks * 2);
rh->rh_len = htons((len >> 2) - 1);
@@ -1312,9 +1312,9 @@
// i am an RTP data sender, so do the sender stuffs (AoA)
if (am_i_sender()) {
fprintf(stderr, ">>> parse_xr - i_am_sender\n");
- fprintf(stderr,
- " [%s +%d] beg:%d, end:%d, xr1len:%d (xrlen:%d)\n",
- __FILE__,__LINE__,begin, end, ntohs(xr1->xr_len), xrlen);
+ //fprintf(stderr,
+ // " [%s +%d] beg:%d, end:%d, xr1len:%d (xrlen:%d)\n",
+ // __FILE__,__LINE__,begin, end, ntohs(xr1->xr_len), xrlen);
switch (cc_type_) {
case WBCC:
Modified: vic/branches/cc/rtp/transmitter.cpp
==============================================================================
--- vic/branches/cc/rtp/transmitter.cpp (original)
+++ vic/branches/cc/rtp/transmitter.cpp Thu Feb 18 19:14:21 2010
@@ -313,7 +313,9 @@
fprintf(stderr, "\n\tnow: %f\tseqno: %d\n\n",
tx_now()-tx_now_offset_, ntohs(rh->rh_seqno));
// record seqno and timestamp at TfwcSndr side
- tfwc_sndr_send(pb);
+ tfwc_sndr_send(ntohs(rh->rh_seqno),
+ tx_now()-tx_now_offset_,
+ tx_now_offset_);
// move head pointer
head_ = pb->next;
@@ -367,7 +369,9 @@
fprintf(stderr, "\n\tnow: %f\tseqno: %d\n\n",
tx_now()-tx_now_offset_, ntohs(rh->rh_seqno));
// record seqno and timestamp at TfwcSndr side
- tfwc_sndr_send(pb);
+ tfwc_sndr_send(ntohs(rh->rh_seqno),
+ tx_now()-tx_now_offset_,
+ tx_now_offset_);
// move head pointer
head_ = pb->next;
More information about the Sumover-dev
mailing list