Public Member Functions | |
RTCPAgent () | |
virtual void | timeout (int) |
virtual void | recv (Packet *p, Handler *h) |
int | command (int argc, const char *const *argv) |
Protected Member Functions | |
void | start () |
void | stop () |
void | sendpkt () |
Protected Attributes | |
int | running_ |
int | random_ |
int | seqno_ |
double | interval_ |
RTPSession * | session_ |
RTCP_Timer | rtcpup_timer_ |
Definition at line 52 of file rtcp.cc.
RTCPAgent::RTCPAgent | ( | ) |
zero argument constructor
Definition at line 82 of file rtcp.cc.
References interval_, random_, running_, and seqno_.
00083 : Agent(PT_RTCP), session_(0), rtcpup_timer_(this) 00084 { 00085 size_ = 128; 00086 bind_time("interval_", &interval_); 00087 bind("random_", &random_); 00088 bind("seqno_", &seqno_); 00089 running_ = 0; 00090 00091 }
void RTCPAgent::timeout | ( | int | ) | [virtual] |
it defines how often RTCP packets are to be sent take it into concideration for QoS measurements as the bigger the interval of the RTCP packets the less accurate the network measurements
int |
Definition at line 138 of file rtcp.cc.
References RTPSession::build_report(), interval_, random_, rtcpup_timer_, running_, sendpkt(), and session_.
Referenced by RTCP_Timer::expire().
00139 { 00140 if (running_) { 00141 size_ = session_->build_report(0); 00142 sendpkt(); 00143 double t = interval_; 00144 if (random_) 00145 /* add some zero-mean white noise */ 00146 t += interval_ * Random::uniform(-0.5, 0.5); 00147 rtcpup_timer_.resched(t); 00148 /* XXX */ 00149 Tcl::instance().evalf("%s rtcp_timeout", session_->name()); 00150 } 00151 }
void RTCPAgent::recv | ( | Packet * | p, | |
Handler * | h | |||
) | [virtual] |
int RTCPAgent::command | ( | int | argc, | |
const char *const * | argv | |||
) |
handles the events defined in the TCP scripts
Definition at line 153 of file rtcp.cc.
References RTPSession::build_report(), sendpkt(), session_, start(), and stop().
00154 { 00155 if (argc == 2) { 00156 if (strcmp(argv[1], "start") == 0) { 00157 start(); 00158 return (TCL_OK); 00159 } 00160 if (strcmp(argv[1], "stop") == 0) { 00161 stop(); 00162 return (TCL_OK); 00163 } 00164 if (strcmp(argv[1], "bye") == 0) { 00165 size_ = session_->build_report(1); 00166 sendpkt(); 00167 stop(); 00168 return (TCL_OK); 00169 } 00170 } else if (argc == 3) { 00171 if (strcmp(argv[1], "session") == 0) { 00172 session_ = (RTPSession*)TclObject::lookup(argv[2]); 00173 return (TCL_OK); 00174 } 00175 } 00176 00177 return (Agent::command(argc, argv)); 00178 }
void RTCPAgent::start | ( | ) | [protected] |
the start method for the RTCP agent
Definition at line 93 of file rtcp.cc.
References interval_, rtcpup_timer_, and running_.
Referenced by command().
00094 { 00095 running_ = 1; 00096 00097 rtcpup_timer_.resched(interval_); 00098 00099 }
void RTCPAgent::stop | ( | ) | [protected] |
stop is called by a timer event
Definition at line 101 of file rtcp.cc.
References rtcpup_timer_, and running_.
Referenced by command().
00102 { 00103 rtcpup_timer_.cancel(); 00104 running_ = 0; 00105 }
void RTCPAgent::sendpkt | ( | ) | [protected] |
it creates the RTCP packet and fills in the packet header and the SR, RR reports
Definition at line 115 of file rtcp.cc.
References hdr_rtp::access(), RTPSession::access_hdr_rtp(), hdr_rtp::rr_, hdr_rtp::seqno(), seqno_, session_, hdr_rtp::sr_, RTPSession::srcid(), hdr_rtp::srcid(), and hdr_rtp::timestamp().
Referenced by command(), and timeout().
00116 { 00117 Packet* p = allocpkt(); 00118 hdr_rtp* rh = hdr_rtp::access(p); 00119 hdr_rtp* tmp = new hdr_rtp; 00120 tmp = session_->access_hdr_rtp(); 00121 /* Fill in srcid_ and seqno */ 00122 rh->seqno() = seqno_++; 00123 rh->srcid() = session_->srcid(); 00124 rh->timestamp() = Scheduler::instance().clock(); 00125 rh->sr_ = tmp->sr_; 00126 rh->rr_ = tmp->rr_; 00127 target_->recv(p); 00128 }
int RTCPAgent::running_ [protected] |
int RTCPAgent::random_ [protected] |
int RTCPAgent::seqno_ [protected] |
double RTCPAgent::interval_ [protected] |
RTPSession* RTCPAgent::session_ [protected] |
RTCP_Timer RTCPAgent::rtcpup_timer_ [protected] |