Advanced Internet Services - CS 6998-03: Homework 3

  1. Microphone amplifier (5 pts.): Write a program that opens the audio device and reads blocks of 20 ms from the device (microphone) and writes them back to audio output (loudspeaker), turning your workstation into a (somewhat expensive) microphone amplifier. Your program should simply loop indefinitely, until interrupted. You do not have to implement volume control, but can use the operating system utilities for that, as discussed below.

    On Sun systems, the audio device is treated more or less like a Unix file, i.e., open() and close() are used. See man audio for the audio API. On SGI machines, you need to link with -laudio.

    Information on SGI audio is available via man ALopenport; for Sun, with man -s 7 audio.

    Information on Linux audio can be found at http://sunsite.unc.edu/mdw/HOWTO/Sound-HOWTO.html

    Older SPARCstations (IPX, SS2, etc.) are equipped with 8-bit audio, newer SPARCstations (SS5, SS10, SS20, Ultra, etc.) with 8/16-bit audio. The plugs are in the back of the unit, with the following symbols:

    You can connect your personal electronic device such as a radio, cassette or CD player to the line input. Normal "Walkman"-style headphones will work in the headphone jack. A cable with two male 1/8" (3.5 mm) stereo headphone jacks, e.g., Radio Shack part 42-2387 for about $3.99, can be used to connect the headphone jack of a PED to the line-input jack of the workstation

    On SPARCstations, the program /usr/openwin/bin/audiocontrol or /usr/demo/SOUND/bin/gaintool allows you to choose ports and set volume. On SGI workstations, /usr/sbin/apanel may be used.


  2. Packet radio (12 pts.): Implement a simple packet audio receiver (also known as the most expensive AM radio available). This "radio" should receive RTP-over-UDP packets from either a multicast or unicast address and play them back to the audio device. Your program must implement a playout buffer that tries to minimize delay while also minimizing the number of packets dropped due to late arrival. The written part of the assignment should contain a description of your playout algorithm and the measurement values for at least 10,000 packets. You should use the input-driven timing mechanism defined in class.

    Your radio only needs to understand PCMU (mu-law) RTP packets with a sampling rate of 8000 Hz. Packets can contain up to 800 samples. All packets come from a single network source (SSRC) and thus, no mixing of audio samples is required.

    In the next assignment, your program will be turned into an Internet telephone, so you should structure your program to be able to receive events and input from several sources (network, audio input, control channel).

    Your program does not have to implement volume control or switching of output ports. No graphical user interface is required. The program must deal gracefully with a reset of the timestamp and sequence number, since the same program material will be repeated again and again.

    The program should be invoked as

      radio address port [any other options]
    

    Your program should display the RTP SDES information (details see lecture 8) transmitted by the radio station when it changes.

    For each 1000 packets starting with a sequence number divisible by 1000, your program should output the accumulated number of packets lost due to being late and the average playout delay. The average playout delay is the average delay between packet arrival and when the content of the packet is handed to the audio device.

    There will be a ``radio station'' playing a voice segment on multicast address address 224.2.0.25, port 1234. The voice segment was recorded by rtpdump in Berlin after transmission from Columbia University. If you are off campus, you can play back this sample by creating a loop such as

    #
    while (1)
      rtpplay -T -b 32.3 -e 73 -f sample.rtp 224.2.0.25/1234/16
    end
    

    If you prefer, you can also direct the output of rtpplay to a unicast address.

    Additional information about RTP for this assignment is on a separate page.

    You might find the following two papers helpful:

  3. RTP membership rate (5 pts.): For a 32 kb/s audio session with 10,000 listeners and one source, how long will it take, on average, for a new listener to get to know the identity of all the other listeners? Assume steady state, i.e., all other 10,000 listeners are already aware of each other. RTCP packets are assumed to all have the same size of 128 bytes."
  4. TCP vs. UDP (5 pts.): Compute, based on the discussion of TCP in TCP/IP Illustrated (for example), how long it would take (in addition to the time the packet would have taken if it had not been lost) for a packet that is lost to be retransmitted and reach the receiver. Assume that the TCP implementation believes the roundtrip time to be t and that packets are transmitted every 20 ms. Compute two values: one with and one without TCP fast retransmit.
  5. RTP - Synchronization (5 pts.): Assume that you receive two flows of RTP packets, one with SSRC=1 (audio) and the other with SSRC=2 (video). At time t = 0 you receive an RTP packet with PT=6, TS=11621305, SEQ=30000 and SSRC=1. At time t = 0.05, i.e., 50 msec later, you receive a second RTP packet with PT=26, TS=11763321 SEQ=20000, and SSRC=2.

    The last sender reports for each of the flows contained the following information: for SSRC=1, NTP=123456.4829, RTP-TS=11582265 and for SSRC=2, NTP=123452.2439, RTP-TS=11169321.

    You want to playback the two RTP packets with minimum delay so that the two streams are lip-synced. In which order do you need to play them back? What is their playback times and what is the time interval between the two playback times? Draw a time axis with the respective position of the packets.

    Note: RTP profiles for audio and video are defined in RFC1890