[Sumover-dev] [svn commit] r4255 - in vic/branches/cc: rtp
sumover-dev at cs.ucl.ac.uk
sumover-dev at cs.ucl.ac.uk
Fri Aug 8 20:05:37 BST 2008
Author: soohyunc
Date: Fri Aug 8 20:05:37 2008
New Revision: 4255
Modified:
vic/branches/cc/cc/tfwc_rcvr.h
vic/branches/cc/cc/tfwc_sndr.cpp
vic/branches/cc/cc/tfwc_sndr.h
vic/branches/cc/rtp/rtp.h
vic/branches/cc/rtp/session.cpp
vic/branches/cc/rtp/session.h
Log:
(1) RTCP XR block type value, now, changed to HEX code
(2) session.cpp has the fuction to send time stamp and time stamp echo
(note: gettimeofday_usec() return type needs to be resolved.)
we are sending two RTCP XR packets on every RTP data packet transmission. we can
later merge these two RTCP XR report packets in a single XR report packet.
currently, every RTP data packet is followed by two XR report packets.
Modified: vic/branches/cc/cc/tfwc_rcvr.h
==============================================================================
--- vic/branches/cc/cc/tfwc_rcvr.h (original)
+++ vic/branches/cc/cc/tfwc_rcvr.h Fri Aug 8 20:05:37 2008
@@ -50,13 +50,14 @@
void set_received_seqno(u_int16_t seqno, u_int16_t lastseq);
protected:
- inline u_int32_t get_ackvec() { return tfwcAV; }
- inline u_int32_t get_timestamp() { return tfwcAV; }
+ inline u_int32_t tfwc_rcvr_getvec() { return tfwcAV; }
+ inline u_int32_t tfwc_rcvr_ts_echo() { return ts_echo_; }
u_int32_t tfwcAV; // AckVec (bit vector)
u_int16_t seqno_; // received RTP packet seqno
u_int16_t lastseq_; // last RTP packet seqno
private:
void ackvec_manager(u_int16_t seqno, u_int16_t latseq);
+ u_int32_t ts_echo_; // for time stamp echoing
};
#endif
Modified: vic/branches/cc/cc/tfwc_sndr.cpp
==============================================================================
--- vic/branches/cc/cc/tfwc_sndr.cpp (original)
+++ vic/branches/cc/cc/tfwc_sndr.cpp Fri Aug 8 20:05:37 2008
@@ -63,10 +63,11 @@
debug_msg("sent seqno: %d\n", seqno_);
}
-void TfwcSndr::tfwc_sndr_recv(u_int32_t ackv)
+void TfwcSndr::tfwc_sndr_recv(u_int32_t ackv, u_int32_t ts_echo)
{
// the most recent 3 packets will be marked as 1 using marginvec_
ackv_ = ackv | marginvec_;
+ ts_echo_ = ts_echo;
}
void TfwcSndr::ackofack() {
Modified: vic/branches/cc/cc/tfwc_sndr.h
==============================================================================
--- vic/branches/cc/cc/tfwc_sndr.h (original)
+++ vic/branches/cc/cc/tfwc_sndr.h Fri Aug 8 20:05:37 2008
@@ -41,9 +41,9 @@
TfwcSndr();
// parse RTP data packet from Transmitter module
void tfwc_sndr_send(pktbuf*);
- void tfwc_sndr_recv(u_int32_t ackv);
- inline u_int16_t get_seqno() { return seqno_; }
- inline u_int32_t get_aoa() { return aoa_; }
+ void tfwc_sndr_recv(u_int32_t ackv, u_int32_t ts_echo);
+ inline u_int16_t tfwc_sndr_get_seqno() { return seqno_; }
+ inline u_int32_t tfwc_sndr_get_aoa() { return aoa_; }
void ackofack(); // set ack of ack
u_int16_t seqno_; // packet sequence number
@@ -52,7 +52,8 @@
u_int32_t marginvec_; // margin vec
u_int32_t ackv_; // AckVec (in TfwcSndr)
u_int32_t aoa_; // ack of ack
- u_int32_t ts_; // time stamp
+ u_int32_t ts_; // time stamp
+ u_int32_t ts_echo_; // echo time stamp from the receiver
TfwcSndr* tfwcsndr_;
private:
};
Modified: vic/branches/cc/rtp/rtp.h
==============================================================================
--- vic/branches/cc/rtp/rtp.h (original)
+++ vic/branches/cc/rtp/rtp.h Fri Aug 8 20:05:37 2008
@@ -132,10 +132,10 @@
* RTCP Extended Report.
* (RFC 3611)
*/
-#define XR_BT_1 1 // Loss RLE Report Block
-#define XR_BT_2 2 // Duplicate RLE Report Block
-#define XR_BT_3 3 // Packet Receipt Times Report Block
-#define XR_BT_4 4 // Receiver Reference Time Report Block
+#define XR_BT_1 0x01000000 // Loss RLE Report Block
+#define XR_BT_2 0x02000000 // Duplicate RLE Report Block
+#define XR_BT_3 0x03000000 // Packet Receipt Times Report Block
+#define XR_BT_4 0x04000000 // Receiver Reference Time Report Block
struct rtcp_xr_hdr {
u_int32_t xr_flags; /* BT:8 TS:8 LEN:16 */
};
Modified: vic/branches/cc/rtp/session.cpp
==============================================================================
--- vic/branches/cc/rtp/session.cpp (original)
+++ vic/branches/cc/rtp/session.cpp Fri Aug 8 20:05:37 2008
@@ -464,19 +464,37 @@
// if CC is on, send an RTCP XR (aoa) packet
// upon every RTP data packet transmission.
- if(is_cc_on())
- ch_[0].send_aoa();
+ if(is_cc_on()) {
+ ch_[0].send_aoa(); // send ack of ack
+ ch_[0].send_ts(); // send time stamp
+ }
}
}
+// sending ack of ack packet (RTCP XR report packet)
void CtrlHandler::send_aoa()
{
- sm_->build_aoapkt(this);
+ sm_->build_aoa_pkt(this);
+}
+
+// sending time stamp packet (RTCP XR report packet)
+void CtrlHandler::send_ts()
+{
+ sm_->build_ts_pkt(this);
+}
+
+void SessionManager::build_aoa_pkt(CtrlHandler* ch)
+{
+ // RTCP XR (Loss RLE Report Block)
+ // (it is XR_BT_1 defined in rtp/rtp.h)
+ send_xreport(ch, 1);
}
-void SessionManager::build_aoapkt(CtrlHandler* ch)
+void SessionManager::build_ts_pkt(CtrlHandler* ch)
{
- send_xreport(ch, 0);
+ // RTCP XR (Packet Receipt Times Report Block)
+ // (it is XR_BT_3 defined in rtp/rtp.h)
+ send_xreport(ch, 3);
}
u_char* SessionManager::build_sdes_item(u_char* p, int code, Source& s)
@@ -616,7 +634,7 @@
void SessionManager::send_xreport(CtrlHandler* ch, int bye, int app)
{
UNUSED(app);
- UNUSED(bye);
+ int bt = bye; // XR block type
SourceManager& sm = SourceManager::instance();
Source& s = *sm.localsrc();
@@ -658,15 +676,19 @@
xrh = (rtcp_xr_hdr*)(rh + 1);
// XR block length
int xrlen = (xrh->xr_flags << 16) >> 16;
- // access XR block contents
xrb = (rtcp_xr_blk*)(xrh + xrlen + 1);
+ // access XR block contents
// for ackofack
xrb->begin_seq = htonl(lastseq_);
xrb->end_seq = htonl(seqno_ + 1);
- // this chunk is ackvec
- xrb->chunk = (u_int32_t *) htonl(get_ackvec());
- // this chunk is timestamp echo
- //xrb->chunk = htonl(mt->ref_ts());
+
+ if(xrh->xr_flags & (bt << 28) == XR_BT_1) {
+ // this chunk is ackvec
+ xrb->chunk = (u_int32_t *) htonl(tfwc_rcvr_getvec());
+ } else if(xrh->xr_flags & (bt << 28) == XR_BT_3) {
+ // this chunk is timestamp echo
+ //xrb->chunk = (u_int32_t *) gettimeofday_usecs();
+ }
int nrr = 0;
int nsrc = 0;
@@ -1228,48 +1250,60 @@
* if AckVec is received, then parse it to TfwcSndr
*/
if (xrb->begin_seq == xrb->end_seq) {
+ debug_msg(" --- RTP Receiver Side Operation\n");
// we received ackofack, so do receiver stuffs here
- //trim_vec(xrb->chunk); // chunk in xrb is ackvec
- ch_[0].send(build_ackvpkt(xrh, ssrc), xrlen);
- ch_[0].send(build_tspkt(xrh, ssrc), xrlen);
+ //trim_ackvec((u_int32_t) &xrb->chunk); // chunk in xrb is ackvec
+ ch_[0].send(build_ackv_pkt(xrh, ssrc), xrlen);
+ ch_[0].send(build_ts_echo_pkt(xrh, ssrc), xrlen);
} else {
+ debug_msg(" --- RTP Sender Side Operation\n");
// we received ackvec, so do sender stuffs here
- ackvec_ = (u_int32_t) &xrb->chunk;
- ackofack_ = xrb->begin_seq;
- // time stamp update comes to here
- tfwc_sndr_recv(ackvec_); // parse AckVec
+ if((xrh->xr_flags & XR_BT_1) >> 24 == 1) {
+ // this is an XR containing ackvec
+ debug_msg(" this is AckVec XR...\n");
+ ackvec_ = (u_int32_t) &xrb->chunk;
+ ackofack_ = xrb->end_seq - 1;
+ }
+ if((xrh->xr_flags & XR_BT_3) >> 24 == 3) {
+ // this is an XR containing ts echo
+ debug_msg(" this is ts_echo XR...\n");
+ ts_echo_ = (u_int32_t) &xrb->chunk;
+ }
+ tfwc_sndr_recv(ackvec_, ts_echo_); // parse AckVec
}
}
// build ackvec packet (RTCP XR packet)
-u_char* SessionManager::build_ackvpkt(rtcp_xr_hdr* xrh, u_int32_t ssrc)
+u_char* SessionManager::build_ackv_pkt(rtcp_xr_hdr* xrh, u_int32_t ssrc)
{
+ debug_msg(" build_ackv_pkt\n");
// set XR block type
- xrh->xr_flags |= 0x01000000;
+ xrh->xr_flags |= XR_BT_1;
// take XR block contents
int xrlen = (xrh->xr_flags << 16) >> 16;
rtcp_xr_blk* xrb = (rtcp_xr_blk*)(xrh + xrlen + 1);
xrb->ssrc = ssrc;
- xrb->chunk = (u_int32_t *) get_ackvec();
+ xrb->chunk = (u_int32_t *) tfwc_rcvr_getvec();
u_char* p = (u_char*) xrh;
return (p);
}
// build timestamp packet (RTCP XR packet)
-u_char* SessionManager::build_tspkt(rtcp_xr_hdr* xrh, u_int32_t ssrc)
+u_char* SessionManager::build_ts_echo_pkt(rtcp_xr_hdr* xrh, u_int32_t ssrc)
{
+ debug_msg(" build_ts_echo_pkt\n");
// set XR block type
- xrh->xr_flags |= 0x03000000;
+ xrh->xr_flags |= XR_BT_3;
// take XR block contents
int xrlen = (xrh->xr_flags << 16) >> 16;
rtcp_xr_blk* xrb = (rtcp_xr_blk*)(xrh + xrlen + 1);
xrb->ssrc = ssrc;
- //xrb->chunk = (u_int32_t *) echo_timestamp();
+ xrb->chunk = (u_int32_t *) tfwc_rcvr_ts_echo();
u_char* p = (u_char*) xrh;
return (p);
Modified: vic/branches/cc/rtp/session.h
==============================================================================
--- vic/branches/cc/rtp/session.h (original)
+++ vic/branches/cc/rtp/session.h Fri Aug 8 20:05:37 2008
@@ -95,6 +95,7 @@
void sample_size(int cc);
inline double rint() const { return (rint_); }
void send_aoa();
+ void send_ts();
protected:
void schedule_timer();
@@ -130,7 +131,8 @@
// virtual void send_report();
virtual void send_report(CtrlHandler*, int bye, int app = 0);
virtual void send_xreport(CtrlHandler*, int bye, int app = 0);
- void build_aoapkt(CtrlHandler* ch);
+ void build_aoa_pkt(CtrlHandler* ch);
+ void build_ts_pkt(CtrlHandler* ch);
protected:
// void demux(rtphdr* rh, u_char* bp, int cc, Address & addr, int layer);
@@ -159,8 +161,8 @@
void parse_sdes(rtcphdr* rh, int flags, u_char* ep, Source* ps,
Address & addr, u_int32_t ssrc, int layer);
void parse_bye(rtcphdr* rh, int flags, u_char* ep, Source* ps);
- u_char* build_ackvpkt(rtcp_xr_hdr* xrh, u_int32_t ssrc);
- u_char* build_tspkt(rtcp_xr_hdr* xrh, u_int32_t ssrc);
+ u_char* build_ackv_pkt(rtcp_xr_hdr* xrh, u_int32_t ssrc);
+ u_char* build_ts_echo_pkt(rtcp_xr_hdr* xrh, u_int32_t ssrc);
int parseopts(const u_char* bp, int cc, Address & addr) const;
int ckid(const char*, int len);
@@ -209,6 +211,7 @@
// AckVector
u_int32_t ackvec_; // this is a bit vector
+ u_int32_t ts_echo_; // time stamp echo
};
class AudioSessionManager : public SessionManager {
More information about the Sumover-dev
mailing list