next up previous
Next: MPEG2 sender/receiver installation Up: Installation of video-streaming implementations Previous: Introduction

RTP/RTCP installation

In order to install the RTP/RTCP implementation, we have to decompress the file "rtp.tar.gz". After decompression a folder named "rtp_v2" will be created. Then, move the folder "rtp_v2" into the directory where the source of the simulator is stored, i.e. "ns-2.xx" (where xx is the version of the ns-2 simulator installed). After this, it is necessary to modify the file "" (stored in the "ns-2.xx" folder of the simulator), in order to add the source files of this new RTP implementation. These are the steps to follow:

  1. Add the following lines to the file "" at the end of the "OBJ_CC" section (but before the line "@V_STLOBJ@"):
    rtp_v2/rtp_v2.o $\backslash$
    rtp_v2/rtcp_v2.o $\backslash$
  2. Add "-I/rtp_v2" to the "INCLUDES = " section at the beginning of ""
  3. Exit, saving changes.
  4. Copy file "" to folder "ns-2.xx/common/".
  5. Copy files "" and "rtp.h" to folder "ns-2.xx/apps/".
  6. Add the following at the end of the file "ns-2.xx/tcl/lib/ns-default.tcl":
    Agent/RTP_v2 set seqno_ 0
    Agent/RTP_v2 set interval_ 3.75ms
    Agent/RTP_v2 set random_ 0
    Agent/RTP_v2 set packetSize_ 210
    Agent/RTP_v2 set maxpkts_ 0x10000000
    Agent/RTP_v2 instproc done {} { }
    Agent/RTP_v2 set rtcp_in_use_ 0
    Agent/RTP_v2 set codification_ -1
    Agent/RTP_v2 set lostcounter_ 0
    Agent/RTP_v2 set losses_ 0
    Agent/RTP_v2 set multipath_ 1
    Agent/RTP_v2 set flow_id_ 0
    Agent/RTCP_v2 set seqno_ 0
    Agent/RTCP_v2 set interval_ 375ms
    Agent/RTCP_v2 set random_ 0
    Agent/RTCP_v2 set flow_id_ 0
    Session/RTP set debug_ 0

  7. Add the packet type "RTP_v2" in file "common/packet.h". This is done by adding the following lines:

    - In the structure "enum packet_t", write the two following lines before the line "PT_NTYPE // This MUST be the LAST one":

    - In the class "p_info public: p_info()" write the two following lines but before "name_[PT_NTYPE]= "undefined";" line:
  8. Exit, saving changes.
  9. Run "make".

Once it is finished, a new binary file named "ns" in the ns-2.xx will be available with the new RTP/RTCP protocol implementation. Set configuration settings related to this RTP Agent in the TCL simulation file as shown in the TCL script sample shown below:

set ns [new Simulator] 
set end_sim_time 10.0
#Open the nam trace file 
set nf [open final.nam w] 
set tf [open w] 
$ns namtrace-all $nf 
$ns trace-all $tf 
#Define a 'finish' procedure 
proc finish {} { 
        global ns nf tf 
        $ns flush-trace 
        #Close the trace file 
        close $nf 
        close $tf 
        #Execute nam on the trace file 
        exec nam final.nam & 
        exit 0 
set node_(s1) [$ns node] 
set node_(s2) [$ns node] 
set node_(r1) [$ns node] 
$ns duplex-link $node_(s1) $node_(r1) 10Mb 5ms DropTail 
$ns duplex-link $node_(s2) $node_(r1) 10Mb 5ms DropTail 
set trace_file [new Tracefile] 
$trace_file filename starwars.nsformat 
set RTP_s [new Agent/RTP_v2] 
set RTCP_r [new Agent/RTCP_v2] 
set self [new Session/RTP] 
$ns attach-agent $node_(s1) $RTP_s 
$ns attach-agent $node_(s2) $RTCP_r 
$ns connect $RTP_s $RTCP_r 
set video [new Application/Traffic/Trace] 
$video attach-tracefile $trace_file 
$video attach-agent $RTP_s 
$RTCP_r session $self 
$RTP_s session $self 
$RTCP_r set interval_ 100ms 
$RTCP_r set seqno_ 0
$RTP_s set packetSize_ 1064 
$ns at 0.0 "$video start" 
$ns at 0.0 "$RTCP_r start" 
$ns at $end_sim_time    { 
                        $video stop 
                        $RTCP_r stop 
                        #$RTP_s stop 
$ns run

The information contained in the periodic RTCP-RR packets sent between destination and source are displayed in the display by default (you can watch it on the terminal screen). If you want to store it to a file, you can try this command:

ns rtp-rtcp-simulation.tcl $>$ rtcps-info.log

The information will be stored in a new file named "rtcps-info.log".

next up previous
Next: MPEG2 sender/receiver installation Up: Installation of video-streaming implementations Previous: Introduction
vico 2009-03-10