VAT/RTP Utilities

This document describes the utilities related to playing and recording RTP streams from VAT. These utilities are used (in addition to VAT) by the different IAPs to do the bulk of the data stream generation/reception.

The "vatrec" program

The purpose of this program is to record an incoming RTP stream (from vat or vatplay). The usage is as follows:

vatrec host-name local-port-number output-file gsm/pcm [num-streams]

The "host-name" is the name of the host from which pkts are to be received. This argument was originally used to do a "connect" on a UDP socket. But this has subsequently been ignored. Hence this argument can be dummy. Only the "local-port-number" argument matters. This is the port number to which vatrec binds and listens for incoming UDP packets.

The gsm/pcm argument gives the format (gsm or pcm) of pkts to receive. The program checks the RTP header, removes it, and stores the payload onto the file.

The output file can have two special values: (a) "-" for STDOUT, and (b) "/dev/audio", in which case, vatrec directly plays the incoming packets onto the audio device (if the format of operation is gsm, it first decodes the packet).

The "num-streams" argument is to be used for debugging. If you want to check if a lot of streams are being received correctly, use the following command:

vatrec host-name starting-port-number file-name gsm/pcm num-streams 2>/tmp/err

The starting-port-number is used to listen for the first stream, and subsequent (num-streams - 1) ports are used for the rest of the streams. Only the first stream is written onto the file (if you don't care about it, you can simply give a /dev/null argument for the file-name).

The stderr prints a line for all pkts received, any packets missed (caught using the RTP sequence number), and any erroneous RTP packet. This is what you should look at see if all streams have been received correctly. For every packet received, the line output is:

format-size-streamNum

where, format is gsm or pcm, size is the RTP payload size, streamNum is the stream number to which this packet corresponds.

WARNING: Using vatrec with a large value for num_streams caused my FreeBSD machine to crash deterministically due to some mbuf overflow. So be careful with this.

The program is terminated by hitting ctrl-C. The signal is caught and the output file is closed before exiting since otherwise some pkts may be lost. Since the file closing is done in the same loop as the one for receiving incoming packets, if the program is blocked for incoming packets, the ctrl-C does'nt terminate the program. In this case, hit ctrl-C again.

The "vatplay" program

This does the reverse of the vatrec program. It plays an RTP stream from a file or STDIN. The usage is:

vatplay input-file destination-host destination-port gsm/pcm [num_streams]

The program reads from STDIN if the input-file is given as "-". Again, the num_streams argument is used for debugging purposes. The program sends a packet to subsequent port numbers, starting from destination-port, in the same destination-host.

The program originally used "sig_alarm" to time itself for the RTP packets. But this did not work well in some systems. Hence, now, the program sleeps for 2.5ms intervals and wakes up to check if it is time to send the next packet.

The program terminates on reaching end-of-file on the input stream.


Bhaskaran Raman, bhaskar@cs.berkeley.edu
Last modified: Sun May 28 16:09:43 PDT 2000