[Sumover-dev] [svn commit] r4278 - in vic/branches/cc: rtp
sumover-dev at cs.ucl.ac.uk
sumover-dev at cs.ucl.ac.uk
Mon Aug 18 17:37:21 BST 2008
Author: soohyunc
Date: Mon Aug 18 17:37:20 2008
New Revision: 4278
Modified:
vic/branches/cc/cc/tfwc_sndr.h
vic/branches/cc/rtp/session.cpp
vic/branches/cc/rtp/session.h
vic/branches/cc/rtp/transmitter.cpp
vic/branches/cc/rtp/transmitter.h
Log:
o now, video traffic is driven by TFWC's Ack
-- i.e., removed output(pb) method in Transmitter::send() method, and
moved it to SessionManager::parse_xr_records().
Modified: vic/branches/cc/cc/tfwc_sndr.h
==============================================================================
--- vic/branches/cc/cc/tfwc_sndr.h (original)
+++ vic/branches/cc/cc/tfwc_sndr.h Mon Aug 18 17:37:20 2008
@@ -82,6 +82,9 @@
// return ackofack
inline u_int16_t tfwc_sndr_get_aoa() { return aoa_; }
+ // return just acked seqno
+ inline u_int16_t tfwc_sndr_just_acked() { return just_acked_; }
+
// return tfwc controlled cwnd value
inline u_int32_t tfwc_magic() { return cwnd_; };
Modified: vic/branches/cc/rtp/session.cpp
==============================================================================
--- vic/branches/cc/rtp/session.cpp (original)
+++ vic/branches/cc/rtp/session.cpp Mon Aug 18 17:37:20 2008
@@ -1161,18 +1161,18 @@
UNUSED(ep);
UNUSED(addr);
+ // XR block flags
u_int16_t flags = xr->xr_flags;
- u_int16_t ackofack = ntohs(xr->begin_seq);
- u_int16_t seqno = ntohs(xr->end_seq);
+
+ // ackofack and seqno
+ ackofack_ = ntohs(xr->begin_seq);
+ seqno_ = ntohs(xr->end_seq);
// we received seqno/ackofack, so do receiver stuffs here
- if (seqno != ackofack) {
+ if (seqno_ != ackofack_) {
printf("RECEIVER RECEIVER!!\n");
// parse seqno, ackofack, and timestamp from XR report block
if(flags == XR_BT_1) {
- ackofack_ = ackofack;
- seqno_ = seqno;
-
// this is XR conveys seqno and ackofack
tfwc_rcvr_recv(flags, seqno_, ackofack_, 0);
}
@@ -1204,8 +1204,37 @@
tfwc_sndr_recv(flags, 0, ts_echo_);
}
- // we need to call Transmitter::output(pb) here
- //output(pb);
+ // we need to call Transmitter::output(pb) here (make Ack driven)
+ cc_output();
+ }
+}
+
+void SessionManager::cc_output()
+{
+ pktbuf* pb = get_packet_queue();
+ tfwc_sndr_send(pb);
+
+ // cwnd value
+ int magic = (int) tfwc_magic();
+ // last acked seqno
+ int jack = (int) tfwc_sndr_just_acked();
+ // current packet's seqno
+ int seqno = (int) tfwc_sndr_get_seqno();
+
+ // if the current packet seqno is within (cwnd + jack)
+ // then send the packets
+ if (seqno <= magic + jack) {
+ while (seqno <= magic + jack)
+ output(pb); // call Transmitter::output(pb)
+ }
+ // otherwise, just queue up the packets
+ else {
+ if (head_ != 0) {
+ tail_->next = pb;
+ tail_ = pb;
+ } else
+ tail_ = head_ = pb;
+ pb->next = 0;
}
}
@@ -1240,9 +1269,13 @@
SourceManager& sm = SourceManager::instance();
Source& s = *sm.localsrc();
- rtcphdr* rh = (rtcphdr *)pktbuf_;
+ rtcphdr* rh = (rtcphdr*)pktbuf_;
rh->rh_ssrc = s.srcid();
- int flags = RTP_VERSION << 14;
+ int flags = RTP_VERSION << 14; // RTCP flags
+ int layer = ch - ch_; //LLL
+ Source::Layer& sl = s.layer(layer);
+ timeval now = unixtime();
+ sl.lts_ctrl(now);
// set RTCP flag to XR packet
flags |= RTCP_PT_XR;
@@ -1257,7 +1290,8 @@
xr->xr_flags = htons(XR_BT_1 << 8);
// make 'begin_seq' equal to 'end_seq'
- xr->begin_seq = htons(xr->end_seq);
+ xr->begin_seq = htons(seqno_);
+ xr->end_seq = htons(seqno_);
// get ackvec from TfwcRcvr
xr->chunk = htonl(tfwc_rcvr_getvec());
Modified: vic/branches/cc/rtp/session.h
==============================================================================
--- vic/branches/cc/rtp/session.h (original)
+++ vic/branches/cc/rtp/session.h Mon Aug 18 17:37:20 2008
@@ -132,6 +132,7 @@
void build_ts_pkt(CtrlHandler* ch);
void build_ackv_pkt(CtrlHandler* ch, rtcp_xr* xr);
void build_ts_echo_pkt(CtrlHandler* ch, rtcp_xr* xr);
+ void cc_output();
protected:
// void demux(rtphdr* rh, u_char* bp, int cc, Address & addr, int layer);
Modified: vic/branches/cc/rtp/transmitter.cpp
==============================================================================
--- vic/branches/cc/rtp/transmitter.cpp (original)
+++ vic/branches/cc/rtp/transmitter.cpp Mon Aug 18 17:37:20 2008
@@ -91,7 +91,8 @@
tail_(0),
loop_layer_(1000),
loopback_(0),
- is_cc_active_(1)
+ is_cc_active_(1),
+ is_first_(1)
{
memset((char*)&mh_, 0, sizeof(mh_));
mh_.msg_iovlen = 2;
@@ -212,18 +213,16 @@
void Transmitter::send(pktbuf* pb)
{
+ // CC is active, so just follow CC routines
+ // (i.e., not sending packets here)
if (is_cc_active_) {
- // pass pktbuf to TfwcSndr
- tfwc_sndr_send(pb);
-
- // get CC'd cwnd value
- int magic = (int) tfwc_magic();
-
- // pktbuf size
- int queue = 100;
-
- if (queue <= magic)
+ // if it is the very first packet, just send it.
+ if(is_first_) {
+ tfwc_sndr_send(pb);
output(pb);
+ is_first_ = false;
+ }
+ // if it is not, just queue up the packets.
else {
if (head_ != 0) {
tail_->next = pb;
@@ -232,7 +231,12 @@
tail_ = head_ = pb;
pb->next = 0;
}
- } else {
+
+ // record the local pb pointer to the global location
+ pb_ = pb;
+ }
+ // CC is not active, so just go for the normal operation
+ else {
if (!busy_) {
double delay = txtime(pb);
nextpkttime_ = gettimeofday_secs() + delay;
Modified: vic/branches/cc/rtp/transmitter.h
==============================================================================
--- vic/branches/cc/rtp/transmitter.h (original)
+++ vic/branches/cc/rtp/transmitter.h Mon Aug 18 17:37:20 2008
@@ -86,6 +86,7 @@
void flush();
void send(pktbuf*);
inline bool is_cc_on() { return is_cc_active_; }
+ inline pktbuf* get_packet_queue() { return pb_;}
/*
* Buffer allocation hooks.
*/
@@ -115,6 +116,7 @@
int busy_;
pktbuf* head_;
pktbuf* tail_;
+ pktbuf* pb_;
int loop_layer_; /* # of layers to loop back (for testing) */
@@ -124,6 +126,7 @@
/* Cc related variables */
bool is_cc_active_; /* is Cc module activated? */
+ bool is_first_; /* is this first CC'd data packet? */
private:
static pktbuf* freehdrs_;
More information about the Sumover-dev
mailing list