#include <rtp.h>
Public Member Functions | |
RTPSession () | |
~RTPSession () | |
virtual void | recv (Packet *p, Handler *) |
virtual void | recv_ctrl (Packet *p) |
int | command (int argc, const char *const *argv) |
u_int32_t | srcid () |
int | build_report (int bye) |
void | localsrc_update (int) |
void | update_rate () |
void | pass_sr (sender_report *) |
void | localsrc_update_nbytes (int n) |
void | smooth_rate (double rate) |
int | build_sdes () |
int | build_bye () |
hdr_rtp * | access_hdr_rtp () |
void | print_rcv () |
Public Attributes | |
RTPSource * | allsrcs_ |
RTPSource * | localsrc_ |
RTPReceiver * | receivers_ |
int | last_np_ |
int | enableFlowControl_ |
double | rx_recv_ |
double | jitter_ |
Protected Member Functions | |
RTPSource * | lookup (u_int32_t) |
RTPReceiver * | lookup_rcv (u_int32_t) |
void | enter (RTPSource *) |
void | enter_rcv (RTPReceiver *) |
void | calculate_RTT () |
void | increase_rate (int a) |
void | measure_smooth_loss (double n) |
void | calculateR_tcp (int a) |
void | initial_rate (double a) |
void | remove_receiver (RTPReceiver *) |
void | calculate_alpha (double value) |
Protected Attributes | |
list< double > | lst |
double | T_one_way_ |
hdr_rtp * | rh_ |
int | we_sent |
double | RTT_ |
double | weight [8] |
double | pkt_loss_history [8] |
double | smooth_loss_ |
int | last_pkts_lost_ |
int | last_ehsr_ |
double | tx_rate_ |
double | time_elapsed_ |
double | last_time_report_ |
double | alpha |
Definition at line 257 of file rtp.h.
RTPSession::RTPSession | ( | ) |
zero argument constructor
Definition at line 73 of file session-rtp.cc.
References alpha, enableFlowControl_, jitter_, last_time_report_, RTT_, rx_recv_, smooth_loss_, and weight.
RTPSession::~RTPSession | ( | ) |
destructor
Definition at line 98 of file session-rtp.cc.
References allsrcs_, localsrc_, lst, RTPReceiver::next, RTPSource::next, and receivers_.
void RTPSession::recv | ( | Packet * | p, | |
Handler * | ||||
) | [virtual] |
this method accesses the RTP packets it adds a newly heard source, which is the originator of the RTP packet, calculates the one way trip time and calls the calculate_RTT(T_one_way_ , eff_rtt) method for the RTT calculation. It measures also the delay jitter time of the RTP packets. Use this method to update any wished field of the Source class instances
p | the RTP packet that just received by the RTP Agent |
Definition at line 271 of file session-rtp.cc.
References hdr_rtp::access(), RTPSource::cum_pkts_lost(), RTPSource::ehsr(), RTPSource::jitter(), jitter_, localsrc_, lookup(), RTPSource::nbytes(), RTPSource::np(), RTPSource::ps(), hdr_rtp::seqno(), RTPSource::srcid(), hdr_rtp::srcid(), T_one_way_, hdr_rtp::timestamp(), and RTPSource::transit().
Referenced by RTPAgent::recv().
void RTPSession::recv_ctrl | ( | Packet * | p | ) | [virtual] |
the function that accesses and exploits the SR and RR here is where the sender calculates the effective RTT time based on the receiver's RR. The sender also updates its transmission rate based on the receivers' RR. We don't exploit the SR in this implementation but a third party eg a network controller can exploit both SR and RR, witout in fact joining the session
p | the RTCP packet |
Definition at line 425 of file session-rtp.cc.
References hdr_rtp::access(), alpha, receiver_report::bye(), calculate_alpha(), receiver_report::DLSR(), RTPReceiver::eff_rtt(), enableFlowControl_, enter_rcv(), RTPSource::is_sender(), localsrc_, lookup(), lookup_rcv(), receiver_report::LSR(), RTPSource::LSR(), RTPReceiver::next, receiver_report::R_tcp(), RTPReceiver::rate(), sender_report::rcvrs_, receivers_, remove_receiver(), hdr_rtp::rr_, sender_report::sender_srcid(), hdr_rtp::sr_, RTPReceiver::srcid(), hdr_rtp::srcid(), RTPSource::srcid(), RTPSource::SRT(), hdr_rtp::timestamp(), and update_rate().
int RTPSession::command | ( | int | argc, | |
const char *const * | argv | |||
) |
the command function that handles TCL commands
Definition at line 643 of file session-rtp.cc.
References enter(), initial_rate(), and localsrc_.
int RTPSession::build_report | ( | int | bye | ) |
the method for creating the SR and RR reports the "heart" of the RTCP protocol
bye | if there is a bye event |
Definition at line 149 of file session-rtp.cc.
References allsrcs_, build_bye(), build_sdes(), calculate_RTT(), calculateR_tcp(), increase_rate(), last_ehsr_, last_np_, last_time_report_, localsrc_, measure_smooth_loss(), RTPSource::nbytes(), RTPSource::next, RTPSource::np(), sender_report::octets_sent(), sender_report::pkts_sent(), sender_report::rcvrs_, receivers_, rh_, hdr_rtp::rr_, rx_recv_, sender_report::sender_srcid(), hdr_rtp::sr_, RTPSource::srcid(), time_elapsed_, tx_rate_, and we_sent.
void RTPSession::localsrc_update | ( | int | ) |
it is called when the RTPAgent sends a RTP packet and updates the number of packets (np) field of the originator of the RTP packet
int | packet to be added |
Definition at line 121 of file session-rtp.cc.
References RTPSource::is_sender(), localsrc_, and RTPSource::np().
Referenced by RTPAgent::timeout().
void RTPSession::update_rate | ( | ) |
this method compares the reported TCP friendly bandwidth by the receivers and calls the session_bw and transmit methods in session-rtp.tcl class to adjust the sender's transmission rate
Definition at line 493 of file session-rtp.cc.
References localsrc_, lst, RTPReceiver::next, RTPReceiver::rate(), receivers_, RTPSource::srcid(), and tx_rate_.
Referenced by recv_ctrl().
void RTPSession::localsrc_update_nbytes | ( | int | n | ) |
it is called when the RTPAgent sends a RTP packet and updates the number of number of bytes (nbytes) field of the originator of the RTP packet
n | the bytes to be added |
Definition at line 133 of file session-rtp.cc.
References localsrc_, and RTPSource::nbytes().
Referenced by RTPAgent::timeout().
int RTPSession::build_sdes | ( | ) |
not implemented yet. It only returns 20 bytes that are to be added to the RTCP report
Definition at line 256 of file session-rtp.cc.
Referenced by build_report().
int RTPSession::build_bye | ( | ) |
it is called upon a bye event returns 8 bytes length
Definition at line 248 of file session-rtp.cc.
Referenced by build_report().
hdr_rtp * RTPSession::access_hdr_rtp | ( | ) |
accesses the RTP packet header
Definition at line 519 of file session-rtp.cc.
References rh_.
void RTPSession::print_rcv | ( | ) |
for debugging, prints all the receivers that a source serves
Definition at line 562 of file session-rtp.cc.
References RTPReceiver::next, receivers_, and RTPReceiver::srcid().
RTPSource * RTPSession::lookup | ( | u_int32_t | srcid | ) | [protected] |
it checks if the source has heard
srcid | the source id of this source |
Definition at line 530 of file session-rtp.cc.
References allsrcs_, RTPSource::next, and RTPSource::srcid().
Referenced by recv(), and recv_ctrl().
RTPReceiver * RTPSession::lookup_rcv | ( | u_int32_t | srcid | ) | [protected] |
Check if the receiver exists in the sender's list
srcid | the source id of this receiver |
Definition at line 547 of file session-rtp.cc.
References RTPReceiver::next, receivers_, and RTPReceiver::srcid().
Referenced by recv_ctrl().
void RTPSession::enter | ( | RTPSource * | s | ) | [protected] |
enter a new source
s | the new RTPSource |
Definition at line 576 of file session-rtp.cc.
References allsrcs_, localsrc_, RTPSource::next, and RTPSource::srcid().
Referenced by command().
void RTPSession::enter_rcv | ( | RTPReceiver * | s | ) | [protected] |
enter a new receiver
s | the new RTPReceiver |
Definition at line 589 of file session-rtp.cc.
References localsrc_, RTPReceiver::next, receivers_, RTPReceiver::srcid(), and RTPSource::srcid().
Referenced by recv_ctrl().
void RTPSession::calculate_RTT | ( | ) | [protected] |
RTT time calculation, which is performed by the receiver
Definition at line 340 of file session-rtp.cc.
References alpha, RTT_, and T_one_way_.
Referenced by build_report().
void RTPSession::increase_rate | ( | int | ps | ) | [protected] |
the estimation made by the receiver of the transmission rate when fraction loss is zero. The increase is not higher than 1 RTP packet/current rate in bytes/sec
ps | the packet size of the RTP packet |
Definition at line 352 of file session-rtp.cc.
References RTT_, and tx_rate_.
Referenced by build_report().
void RTPSession::measure_smooth_loss | ( | double | fraction | ) | [protected] |
measure_smooth_loss is called when the last measured by the receiver loss fraction is not zero.
fraction | is the fraction of lost RTP packets/expected RTP packets since last RR |
Definition at line 364 of file session-rtp.cc.
References pkt_loss_history, smooth_loss_, and weight.
Referenced by build_report().
void RTPSession::calculateR_tcp | ( | int | ps | ) | [protected] |
calculates the TCP friendly bandwidth share
ps | is the size of the RTP packet |
Definition at line 401 of file session-rtp.cc.
References localsrc_, RTT_, smooth_loss_, RTPSource::srcid(), and tx_rate_.
Referenced by build_report().
void RTPSession::initial_rate | ( | double | a | ) | [protected] |
it's good for the receiver to have a rough knowledge of the session rate
a | a rough estimation of the session rate |
Definition at line 632 of file session-rtp.cc.
References tx_rate_.
Referenced by command().
void RTPSession::remove_receiver | ( | RTPReceiver * | p | ) | [protected] |
remove a receiver from a sender's list
p | the RTPReceiver to be removed |
Definition at line 600 of file session-rtp.cc.
References localsrc_, RTPReceiver::next, receivers_, RTPReceiver::srcid(), and RTPSource::srcid().
Referenced by recv_ctrl().
void RTPSession::calculate_alpha | ( | double | value | ) | [protected] |
we calculate alpha based on the RTP sender measurements of an effective RTT
value | the effective RTT that is measured by the RTP sender |
Definition at line 328 of file session-rtp.cc.
References alpha, and T_one_way_.
Referenced by recv_ctrl().
double RTPSession::rx_recv_ |
the receiveing rate as it measured by the RTP receiver
Definition at line 297 of file rtp.h.
Referenced by build_report(), and RTPSession().
double RTPSession::jitter_ |
the jitter delay as is it measured by the RTP receiver
Definition at line 299 of file rtp.h.
Referenced by recv(), and RTPSession().
list<double> RTPSession::lst [protected] |
a list to store values
Definition at line 307 of file rtp.h.
Referenced by update_rate(), and ~RTPSession().
double RTPSession::T_one_way_ [protected] |
the one-way trip time
Definition at line 323 of file rtp.h.
Referenced by calculate_alpha(), calculate_RTT(), and recv().
hdr_rtp* RTPSession::rh_ [protected] |
the rtp header
Definition at line 325 of file rtp.h.
Referenced by access_hdr_rtp(), and build_report().
int RTPSession::we_sent [protected] |
true if the RTP sender sent packets since the last RTP SR
Definition at line 329 of file rtp.h.
Referenced by build_report().
double RTPSession::RTT_ [protected] |
the RTT time
Definition at line 331 of file rtp.h.
Referenced by calculate_RTT(), calculateR_tcp(), increase_rate(), and RTPSession().
double RTPSession::weight[8] [protected] |
weights for the smooth loss raton calculation
Definition at line 333 of file rtp.h.
Referenced by measure_smooth_loss(), and RTPSession().
double RTPSession::pkt_loss_history[8] [protected] |
the array to keep the packet loss history
Definition at line 335 of file rtp.h.
Referenced by measure_smooth_loss().
double RTPSession::smooth_loss_ [protected] |
the smooth loss ratio
Definition at line 337 of file rtp.h.
Referenced by calculateR_tcp(), measure_smooth_loss(), and RTPSession().
int RTPSession::last_pkts_lost_ [protected] |
int RTPSession::last_ehsr_ [protected] |
keeps the highest expected RTP sequence number
Definition at line 341 of file rtp.h.
Referenced by build_report().
double RTPSession::tx_rate_ [protected] |
the transmission rate that is measured by the receiver
Definition at line 343 of file rtp.h.
Referenced by build_report(), calculateR_tcp(), increase_rate(), initial_rate(), and update_rate().
double RTPSession::time_elapsed_ [protected] |
time elapsed since the last RR (receiver report)
Definition at line 345 of file rtp.h.
Referenced by build_report().
double RTPSession::last_time_report_ [protected] |
the time when the last RR was sent
Definition at line 347 of file rtp.h.
Referenced by build_report(), and RTPSession().
double RTPSession::alpha [protected] |
the value A
Definition at line 349 of file rtp.h.
Referenced by calculate_alpha(), calculate_RTT(), recv_ctrl(), and RTPSession().