[Sumover-dev] [svn commit] r3995 - vic/branches/mpeg4/rtp
sumover-dev at cs.ucl.ac.uk
sumover-dev at cs.ucl.ac.uk
Wed May 2 22:32:48 BST 2007
Author: piers
Date: Wed May 2 22:33:07 2007
New Revision: 3995
Modified:
vic/branches/mpeg4/rtp/session.cpp
vic/branches/mpeg4/rtp/session.h
Log:
Site-ID additions from AG-VIC - triggered by setting os 'site' vic resource
Modified: vic/branches/mpeg4/rtp/session.cpp
==============================================================================
--- vic/branches/mpeg4/rtp/session.cpp (original)
+++ vic/branches/mpeg4/rtp/session.cpp Wed May 2 22:33:07 2007
@@ -528,6 +528,47 @@
return (len);
}
+int SessionManager::build_app(rtcphdr* rh, Source& ls, char *name, void *data, int datalen)
+{
+ int flags = RTP_VERSION << 14 | 1 << 8 | RTCP_PT_APP;
+ rh->rh_flags = htons(flags);
+ rh->rh_ssrc = ls.srcid();
+ u_char* p = (u_char*)(rh + 1);
+ int len;
+
+ // write the name field
+ len = strlen(name);
+ if( len < 4 ) {
+ memcpy(p,name,len);
+ p += len;
+
+ // pad short names
+ while( p - (u_char*)(rh+1) < 4 )
+ *p++ = 0;
+ }
+ else {
+ // use first four chars of given name
+ memcpy(p,name,4);
+ p += 4;
+ }
+
+ // write the app data
+ memcpy(p,data,datalen);
+ p += datalen;
+
+ // pad as needed
+ len = p - (u_char*)rh;
+ int pad = 4 - (len & 3);
+ while( --pad >= 0 )
+ *p++ = 0;
+ len = p - (u_char*)rh;
+
+ // set the length now that it's known
+ rh->rh_len = htons((len >> 2) - 1);
+
+ return (len);
+}
+
/*void SessionManager::send_report()
{
send_report(0);
@@ -566,6 +607,8 @@
sl.lts_ctrl(now);
int we_sent = 0;
rtcp_rr* rr;
+ Tcl& tcl = Tcl::instance();
+
/*
* If we've sent data since our last sender report send a
* new report. The MediaTimer check is to make sure we still
@@ -658,11 +701,18 @@
else
len += build_sdes((rtcphdr*)rr, s);
+ // build "site" app data if specified
+ const char *data = tcl.attr("site");
+ if(data)
+ {
+ rr = (rtcp_rr*)(((u_char*)rh) + len);
+ len += build_app((rtcphdr*)rr, s, "site", (void *)data, strlen(data));
+ }
//LLL ch_.send(pktbuf_, len);
ch->send(pktbuf_, len);
- /* rtcp_avg_size_ += RTCP_SIZE_GAIN * (double(len + 28) - rtcp_avg_size_);
-
+ /*
+ rtcp_avg_size_ += RTCP_SIZE_GAIN * (double(len + 28) - rtcp_avg_size_);
// compute the time to the next report. we do this here
// because we need to know if there were any active sources
Modified: vic/branches/mpeg4/rtp/session.h
==============================================================================
--- vic/branches/mpeg4/rtp/session.h (original)
+++ vic/branches/mpeg4/rtp/session.h Wed May 2 22:33:07 2007
@@ -128,8 +128,9 @@
virtual void transmit(pktbuf* pb);
void send_report(int bye);
int build_bye(rtcphdr* rh, Source& local);
- int build_sdes(rtcphdr* rh, Source& s);
u_char* build_sdes_item(u_char* p, int code, Source&);
+ int build_sdes(rtcphdr* rh, Source& s);
+ int build_app(rtcphdr* rh, Source& ls, char *name, void *data, int datalen);
void parse_sr(rtcphdr* rh, int flags, u_char* ep,
Source* ps, Address & addr, int layer);
More information about the Sumover-dev
mailing list