home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / rfc / 1800s / rfc1889.txt < prev    next >
Text File  |  1996-01-23  |  189KB  |  4,204 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Network Working Group                Audio-Video Transport Working Group
  8. Request for Comments: 1889                                H. Schulzrinne
  9. Category: Standards Track                                      GMD Fokus
  10.                                                                S. Casner
  11.                                                   Precept Software, Inc.
  12.                                                             R. Frederick
  13.                                          Xerox Palo Alto Research Center
  14.                                                              V. Jacobson
  15.                                    Lawrence Berkeley National Laboratory
  16.                                                             January 1996
  17.  
  18.  
  19.           RTP: A Transport Protocol for Real-Time Applications
  20.  
  21. Status of this Memo
  22.  
  23.    This document specifies an Internet standards track protocol for the
  24.    Internet community, and requests discussion and suggestions for
  25.    improvements.  Please refer to the current edition of the "Internet
  26.    Official Protocol Standards" (STD 1) for the standardization state
  27.    and status of this protocol.  Distribution of this memo is unlimited.
  28.  
  29. Abstract
  30.  
  31.    This memorandum describes RTP, the real-time transport protocol. RTP
  32.    provides end-to-end network transport functions suitable for
  33.    applications transmitting real-time data, such as audio, video or
  34.    simulation data, over multicast or unicast network services. RTP does
  35.    not address resource reservation and does not guarantee quality-of-
  36.    service for real-time services. The data transport is augmented by a
  37.    control protocol (RTCP) to allow monitoring of the data delivery in a
  38.    manner scalable to large multicast networks, and to provide minimal
  39.    control and identification functionality. RTP and RTCP are designed
  40.    to be independent of the underlying transport and network layers. The
  41.    protocol supports the use of RTP-level translators and mixers.
  42.  
  43. Table of Contents
  44.  
  45.    1.         Introduction ........................................    3
  46.    2.         RTP Use Scenarios ...................................    5
  47.    2.1        Simple Multicast Audio Conference ...................    5
  48.    2.2        Audio and Video Conference ..........................    6
  49.    2.3        Mixers and Translators ..............................    6
  50.    3.         Definitions .........................................    7
  51.    4.         Byte Order, Alignment, and Time Format ..............    9
  52.    5.         RTP Data Transfer Protocol ..........................   10
  53.    5.1        RTP Fixed Header Fields .............................   10
  54.    5.2        Multiplexing RTP Sessions ...........................   13
  55.  
  56.  
  57.  
  58. Schulzrinne, et al          Standards Track                     [Page 1]
  59.  
  60. RFC 1889                          RTP                       January 1996
  61.  
  62.  
  63.    5.3        Profile-Specific Modifications to the RTP Header.....   14
  64.    5.3.1      RTP Header Extension ................................   14
  65.    6.         RTP Control Protocol -- RTCP ........................   15
  66.    6.1        RTCP Packet Format ..................................   17
  67.    6.2        RTCP Transmission Interval ..........................   19
  68.    6.2.1      Maintaining the number of session members ...........   21
  69.    6.2.2      Allocation of source description bandwidth ..........   21
  70.    6.3        Sender and Receiver Reports .........................   22
  71.    6.3.1      SR: Sender report RTCP packet .......................   23
  72.    6.3.2      RR: Receiver report RTCP packet .....................   28
  73.    6.3.3      Extending the sender and receiver reports ...........   29
  74.    6.3.4      Analyzing sender and receiver reports ...............   29
  75.    6.4        SDES: Source description RTCP packet ................   31
  76.    6.4.1      CNAME: Canonical end-point identifier SDES item .....   32
  77.    6.4.2      NAME: User name SDES item ...........................   34
  78.    6.4.3      EMAIL: Electronic mail address SDES item ............   34
  79.    6.4.4      PHONE: Phone number SDES item .......................   34
  80.    6.4.5      LOC: Geographic user location SDES item .............   35
  81.    6.4.6      TOOL: Application or tool name SDES item ............   35
  82.    6.4.7      NOTE: Notice/status SDES item .......................   35
  83.    6.4.8      PRIV: Private extensions SDES item ..................   36
  84.    6.5        BYE: Goodbye RTCP packet ............................   37
  85.    6.6        APP: Application-defined RTCP packet ................   38
  86.    7.         RTP Translators and Mixers ..........................   39
  87.    7.1        General Description .................................   39
  88.    7.2        RTCP Processing in Translators ......................   41
  89.    7.3        RTCP Processing in Mixers ...........................   43
  90.    7.4        Cascaded Mixers .....................................   44
  91.    8.         SSRC Identifier Allocation and Use ..................   44
  92.    8.1        Probability of Collision ............................   44
  93.    8.2        Collision Resolution and Loop Detection .............   45
  94.    9.         Security ............................................   49
  95.    9.1        Confidentiality .....................................   49
  96.    9.2        Authentication and Message Integrity ................   50
  97.    10.        RTP over Network and Transport Protocols ............   51
  98.    11.        Summary of Protocol Constants .......................   51
  99.    11.1       RTCP packet types ...................................   52
  100.    11.2       SDES types ..........................................   52
  101.    12.        RTP Profiles and Payload Format Specifications ......   53
  102.    A.         Algorithms ..........................................   56
  103.    A.1        RTP Data Header Validity Checks .....................   59
  104.    A.2        RTCP Header Validity Checks .........................   63
  105.    A.3        Determining the Number of RTP Packets Expected and
  106.               Lost ................................................   63
  107.    A.4        Generating SDES RTCP Packets ........................   64
  108.    A.5        Parsing RTCP SDES Packets ...........................   65
  109.    A.6        Generating a Random 32-bit Identifier ...............   66
  110.    A.7        Computing the RTCP Transmission Interval ............   68
  111.  
  112.  
  113.  
  114. Schulzrinne, et al          Standards Track                     [Page 2]
  115.  
  116. RFC 1889                          RTP                       January 1996
  117.  
  118.  
  119.    A.8        Estimating the Interarrival Jitter ..................   71
  120.    B.         Security Considerations .............................   72
  121.    C.         Addresses of Authors ................................   72
  122.    D.         Bibliography ........................................   73
  123.  
  124. 1.  Introduction
  125.  
  126.    This memorandum specifies the real-time transport protocol (RTP),
  127.    which provides end-to-end delivery services for data with real-time
  128.    characteristics, such as interactive audio and video. Those services
  129.    include payload type identification, sequence numbering, timestamping
  130.    and delivery monitoring. Applications typically run RTP on top of UDP
  131.    to make use of its multiplexing and checksum services; both protocols
  132.    contribute parts of the transport protocol functionality. However,
  133.    RTP may be used with other suitable underlying network or transport
  134.    protocols (see Section 10). RTP supports data transfer to multiple
  135.    destinations using multicast distribution if provided by the
  136.    underlying network.
  137.  
  138.    Note that RTP itself does not provide any mechanism to ensure timely
  139.    delivery or provide other quality-of-service guarantees, but relies
  140.    on lower-layer services to do so. It does not guarantee delivery or
  141.    prevent out-of-order delivery, nor does it assume that the underlying
  142.    network is reliable and delivers packets in sequence. The sequence
  143.    numbers included in RTP allow the receiver to reconstruct the
  144.    sender's packet sequence, but sequence numbers might also be used to
  145.    determine the proper location of a packet, for example in video
  146.    decoding, without necessarily decoding packets in sequence.
  147.  
  148.    While RTP is primarily designed to satisfy the needs of multi-
  149.    participant multimedia conferences, it is not limited to that
  150.    particular application. Storage of continuous data, interactive
  151.    distributed simulation, active badge, and control and measurement
  152.    applications may also find RTP applicable.
  153.  
  154.    This document defines RTP, consisting of two closely-linked parts:
  155.  
  156.         o the real-time transport protocol (RTP), to carry data that has
  157.          real-time properties.
  158.  
  159.         o the RTP control protocol (RTCP), to monitor the quality of
  160.          service and to convey information about the participants in an
  161.          on-going session. The latter aspect of RTCP may be sufficient
  162.          for "loosely controlled" sessions, i.e., where there is no
  163.          explicit membership control and set-up, but it is not
  164.          necessarily intended to support all of an application's control
  165.          communication requirements.  This functionality may be fully or
  166.          partially subsumed by a separate session control protocol,
  167.  
  168.  
  169.  
  170. Schulzrinne, et al          Standards Track                     [Page 3]
  171.  
  172. RFC 1889                          RTP                       January 1996
  173.  
  174.  
  175.          which is beyond the scope of this document.
  176.  
  177.    RTP represents a new style of protocol following the principles of
  178.    application level framing and integrated layer processing proposed by
  179.    Clark and Tennenhouse [1]. That is, RTP is intended to be malleable
  180.    to provide the information required by a particular application and
  181.    will often be integrated into the application processing rather than
  182.    being implemented as a separate layer. RTP is a protocol framework
  183.    that is deliberately not complete.  This document specifies those
  184.    functions expected to be common across all the applications for which
  185.    RTP would be appropriate. Unlike conventional protocols in which
  186.    additional functions might be accommodated by making the protocol
  187.    more general or by adding an option mechanism that would require
  188.    parsing, RTP is intended to be tailored through modifications and/or
  189.    additions to the headers as needed. Examples are given in Sections
  190.    5.3 and 6.3.3.
  191.  
  192.    Therefore, in addition to this document, a complete specification of
  193.    RTP for a particular application will require one or more companion
  194.    documents (see Section 12):
  195.  
  196.         o a profile specification document, which defines a set of
  197.          payload type codes and their mapping to payload formats (e.g.,
  198.          media encodings). A profile may also define extensions or
  199.          modifications to RTP that are specific to a particular class of
  200.          applications.  Typically an application will operate under only
  201.          one profile. A profile for audio and video data may be found in
  202.          the companion RFC TBD.
  203.  
  204.         o payload format specification documents, which define how a
  205.          particular payload, such as an audio or video encoding, is to
  206.          be carried in RTP.
  207.  
  208.    A discussion of real-time services and algorithms for their
  209.    implementation as well as background discussion on some of the RTP
  210.    design decisions can be found in [2].
  211.  
  212.    Several RTP applications, both experimental and commercial, have
  213.    already been implemented from draft specifications. These
  214.    applications include audio and video tools along with diagnostic
  215.    tools such as traffic monitors. Users of these tools number in the
  216.    thousands.  However, the current Internet cannot yet support the full
  217.    potential demand for real-time services. High-bandwidth services
  218.    using RTP, such as video, can potentially seriously degrade the
  219.    quality of service of other network services. Thus, implementors
  220.    should take appropriate precautions to limit accidental bandwidth
  221.    usage. Application documentation should clearly outline the
  222.    limitations and possible operational impact of high-bandwidth real-
  223.  
  224.  
  225.  
  226. Schulzrinne, et al          Standards Track                     [Page 4]
  227.  
  228. RFC 1889                          RTP                       January 1996
  229.  
  230.  
  231.    time services on the Internet and other network services.
  232.  
  233. 2.  RTP Use Scenarios
  234.  
  235.    The following sections describe some aspects of the use of RTP. The
  236.    examples were chosen to illustrate the basic operation of
  237.    applications using RTP, not to limit what RTP may be used for. In
  238.    these examples, RTP is carried on top of IP and UDP, and follows the
  239.    conventions established by the profile for audio and video specified
  240.    in the companion Internet-Draft draft-ietf-avt-profile
  241.  
  242. 2.1 Simple Multicast Audio Conference
  243.  
  244.    A working group of the IETF meets to discuss the latest protocol
  245.    draft, using the IP multicast services of the Internet for voice
  246.    communications. Through some allocation mechanism the working group
  247.    chair obtains a multicast group address and pair of ports. One port
  248.    is used for audio data, and the other is used for control (RTCP)
  249.    packets.  This address and port information is distributed to the
  250.    intended participants. If privacy is desired, the data and control
  251.    packets may be encrypted as specified in Section 9.1, in which case
  252.    an encryption key must also be generated and distributed.  The exact
  253.    details of these allocation and distribution mechanisms are beyond
  254.    the scope of RTP.
  255.  
  256.    The audio conferencing application used by each conference
  257.    participant sends audio data in small chunks of, say, 20 ms duration.
  258.    Each chunk of audio data is preceded by an RTP header; RTP header and
  259.    data are in turn contained in a UDP packet. The RTP header indicates
  260.    what type of audio encoding (such as PCM, ADPCM or LPC) is contained
  261.    in each packet so that senders can change the encoding during a
  262.    conference, for example, to accommodate a new participant that is
  263.    connected through a low-bandwidth link or react to indications of
  264.    network congestion.
  265.  
  266.    The Internet, like other packet networks, occasionally loses and
  267.    reorders packets and delays them by variable amounts of time. To cope
  268.    with these impairments, the RTP header contains timing information
  269.    and a sequence number that allow the receivers to reconstruct the
  270.    timing produced by the source, so that in this example, chunks of
  271.    audio are contiguously played out the speaker every 20 ms. This
  272.    timing reconstruction is performed separately for each source of RTP
  273.    packets in the conference. The sequence number can also be used by
  274.    the receiver to estimate how many packets are being lost.
  275.  
  276.    Since members of the working group join and leave during the
  277.    conference, it is useful to know who is participating at any moment
  278.    and how well they are receiving the audio data. For that purpose,
  279.  
  280.  
  281.  
  282. Schulzrinne, et al          Standards Track                     [Page 5]
  283.  
  284. RFC 1889                          RTP                       January 1996
  285.  
  286.  
  287.    each instance of the audio application in the conference periodically
  288.    multicasts a reception report plus the name of its user on the RTCP
  289.    (control) port. The reception report indicates how well the current
  290.    speaker is being received and may be used to control adaptive
  291.    encodings. In addition to the user name, other identifying
  292.    information may also be included subject to control bandwidth limits.
  293.    A site sends the RTCP BYE packet (Section 6.5) when it leaves the
  294.    conference.
  295.  
  296. 2.2 Audio and Video Conference
  297.  
  298.    If both audio and video media are used in a conference, they are
  299.    transmitted as separate RTP sessions RTCP packets are transmitted for
  300.    each medium using two different UDP port pairs and/or multicast
  301.    addresses. There is no direct coupling at the RTP level between the
  302.    audio and video sessions, except that a user participating in both
  303.    sessions should use the same distinguished (canonical) name in the
  304.    RTCP packets for both so that the sessions can be associated.
  305.  
  306.    One motivation for this separation is to allow some participants in
  307.    the conference to receive only one medium if they choose. Further
  308.    explanation is given in Section 5.2. Despite the separation,
  309.    synchronized playback of a source's audio and video can be achieved
  310.    using timing information carried in the RTCP packets for both
  311.    sessions.
  312.  
  313. 2.3 Mixers and Translators
  314.  
  315.    So far, we have assumed that all sites want to receive  media data in
  316.    the same format. However, this may not always be appropriate.
  317.    Consider the case where participants in one area are connected
  318.    through a low-speed link to the majority of the conference
  319.    participants who enjoy high-speed network access. Instead of forcing
  320.    everyone to use a lower-bandwidth, reduced-quality audio encoding, an
  321.    RTP-level relay called a mixer may be placed near the low-bandwidth
  322.    area. This mixer resynchronizes incoming audio packets to reconstruct
  323.    the constant 20 ms spacing generated by the sender, mixes these
  324.    reconstructed audio streams into a single stream, translates the
  325.    audio encoding to a lower-bandwidth one and forwards the lower-
  326.    bandwidth packet stream across the low-speed link. These packets
  327.    might be unicast to a single recipient or multicast on a different
  328.    address to multiple recipients. The RTP header includes a means for
  329.    mixers to identify the sources that contributed to a mixed packet so
  330.    that correct talker indication can be provided at the receivers.
  331.  
  332.    Some of the intended participants in the audio conference may be
  333.    connected with high bandwidth links but might not be directly
  334.    reachable via IP multicast. For example, they might be behind an
  335.  
  336.  
  337.  
  338. Schulzrinne, et al          Standards Track                     [Page 6]
  339.  
  340. RFC 1889                          RTP                       January 1996
  341.  
  342.  
  343.    application-level firewall that will not let any IP packets pass. For
  344.    these sites, mixing may not be necessary, in which case another type
  345.    of RTP-level relay called a translator may be used. Two translators
  346.    are installed, one on either side of the firewall, with the outside
  347.    one funneling all multicast packets received through a secure
  348.    connection to the translator inside the firewall. The translator
  349.    inside the firewall sends them again as multicast packets to a
  350.    multicast group restricted to the site's internal network.
  351.  
  352.    Mixers and translators may be designed for a variety of purposes. An
  353.    example is a video mixer that scales the images of individual people
  354.    in separate video streams and composites them into one video stream
  355.    to simulate a group scene. Other examples of translation include the
  356.    connection of a group of hosts speaking only IP/UDP to a group of
  357.    hosts that understand only ST-II, or the packet-by-packet encoding
  358.    translation of video streams from individual sources without
  359.    resynchronization or mixing. Details of the operation of mixers and
  360.    translators are given in Section 7.
  361.  
  362. 3.  Definitions
  363.  
  364.    RTP payload: The data transported by RTP in a packet, for example
  365.         audio samples or compressed video data. The payload format and
  366.         interpretation are beyond the scope of this document.
  367.  
  368.    RTP packet: A data packet consisting of the fixed RTP header, a
  369.         possibly empty list of contributing sources (see below), and the
  370.         payload data. Some underlying protocols may require an
  371.         encapsulation of the RTP packet to be defined. Typically one
  372.         packet of the underlying protocol contains a single RTP packet,
  373.         but several RTP packets may be contained if permitted by the
  374.         encapsulation method (see Section 10).
  375.  
  376.    RTCP packet: A control packet consisting of a fixed header part
  377.         similar to that of RTP data packets, followed by structured
  378.         elements that vary depending upon the RTCP packet type. The
  379.         formats are defined in Section 6. Typically, multiple RTCP
  380.         packets are sent together as a compound RTCP packet in a single
  381.         packet of the underlying protocol; this is enabled by the length
  382.         field in the fixed header of each RTCP packet.
  383.  
  384.    Port: The "abstraction that transport protocols use to distinguish
  385.         among multiple destinations within a given host computer. TCP/IP
  386.         protocols identify ports using small positive integers." [3] The
  387.         transport selectors (TSEL) used by the OSI transport layer are
  388.         equivalent to ports.  RTP depends upon the lower-layer protocol
  389.         to provide some mechanism such as ports to multiplex the RTP and
  390.         RTCP packets of a session.
  391.  
  392.  
  393.  
  394. Schulzrinne, et al          Standards Track                     [Page 7]
  395.  
  396. RFC 1889                          RTP                       January 1996
  397.  
  398.  
  399.    Transport address: The combination of a network address and port that
  400.         identifies a transport-level endpoint, for example an IP address
  401.         and a UDP port. Packets are transmitted from a source transport
  402.         address to a destination transport address.
  403.  
  404.    RTP session: The association among a set of participants
  405.         communicating with RTP. For each participant, the session is
  406.         defined by a particular pair of destination transport addresses
  407.         (one network address plus a port pair for RTP and RTCP). The
  408.         destination transport address pair may be common for all
  409.         participants, as in the case of IP multicast, or may be
  410.         different for each, as in the case of individual unicast network
  411.         addresses plus a common port pair.  In a multimedia session,
  412.         each medium is carried in a separate RTP session with its own
  413.         RTCP packets. The multiple RTP sessions are distinguished by
  414.         different port number pairs and/or different multicast
  415.         addresses.
  416.  
  417.    Synchronization source (SSRC): The source of a stream of RTP packets,
  418.         identified by a 32-bit numeric SSRC identifier carried in the
  419.         RTP header so as not to be dependent upon the network address.
  420.         All packets from a synchronization source form part of the same
  421.         timing and sequence number space, so a receiver groups packets
  422.         by synchronization source for playback. Examples of
  423.         synchronization sources include the sender of a stream of
  424.         packets derived from a signal source such as a microphone or a
  425.         camera, or an RTP mixer (see below). A synchronization source
  426.         may change its data format, e.g., audio encoding, over time. The
  427.         SSRC identifier is a randomly chosen value meant to be globally
  428.         unique within a particular RTP session (see Section 8). A
  429.         participant need not use the same SSRC identifier for all the
  430.         RTP sessions in a multimedia session; the binding of the SSRC
  431.         identifiers is provided through RTCP (see Section 6.4.1).  If a
  432.         participant generates multiple streams in one RTP session, for
  433.         example from separate video cameras, each must be identified as
  434.         a different SSRC.
  435.  
  436.    Contributing source (CSRC): A source of a stream of RTP packets that
  437.         has contributed to the combined stream produced by an RTP mixer
  438.         (see below). The mixer inserts a list of the SSRC identifiers of
  439.         the sources that contributed to the generation of a particular
  440.         packet into the RTP header of that packet. This list is called
  441.         the CSRC list. An example application is audio conferencing
  442.         where a mixer indicates all the talkers whose speech was
  443.         combined to produce the outgoing packet, allowing the receiver
  444.         to indicate the current talker, even though all the audio
  445.         packets contain the same SSRC identifier (that of the mixer).
  446.  
  447.  
  448.  
  449.  
  450. Schulzrinne, et al          Standards Track                     [Page 8]
  451.  
  452. RFC 1889                          RTP                       January 1996
  453.  
  454.  
  455.    End system: An application that generates the content to be sent in
  456.         RTP packets and/or consumes the content of received RTP packets.
  457.         An end system can act as one or more synchronization sources in
  458.         a particular RTP session, but typically only one.
  459.  
  460.    Mixer: An intermediate system that receives RTP packets from one or
  461.         more sources, possibly changes the data format, combines the
  462.         packets in some manner and then forwards a new RTP packet. Since
  463.         the timing among multiple input sources will not generally be
  464.         synchronized, the mixer will make timing adjustments among the
  465.         streams and generate its own timing for the combined stream.
  466.         Thus, all data packets originating from a mixer will be
  467.         identified as having the mixer as their synchronization source.
  468.  
  469.    Translator: An intermediate system that forwards RTP packets with
  470.         their synchronization source identifier intact. Examples of
  471.         translators include devices that convert encodings without
  472.         mixing, replicators from multicast to unicast, and application-
  473.         level filters in firewalls.
  474.  
  475.    Monitor: An application that receives RTCP packets sent by
  476.         participants in an RTP session, in particular the reception
  477.         reports, and estimates the current quality of service for
  478.         distribution monitoring, fault diagnosis and long-term
  479.         statistics. The monitor function is likely to be built into the
  480.         application(s) participating in the session, but may also be a
  481.         separate application that does not otherwise participate and
  482.         does not send or receive the RTP data packets. These are called
  483.         third party monitors.
  484.  
  485.    Non-RTP means: Protocols and mechanisms that may be needed in
  486.         addition to RTP to provide a usable service. In particular, for
  487.         multimedia conferences, a conference control application may
  488.         distribute multicast addresses and keys for encryption,
  489.         negotiate the encryption algorithm to be used, and define
  490.         dynamic mappings between RTP payload type values and the payload
  491.         formats they represent for formats that do not have a predefined
  492.         payload type value. For simple applications, electronic mail or
  493.         a conference database may also be used. The specification of
  494.         such protocols and mechanisms is outside the scope of this
  495.         document.
  496.  
  497. 4.  Byte Order, Alignment, and Time Format
  498.  
  499.    All integer fields are carried in network byte order, that is, most
  500.    significant byte (octet) first. This byte order is commonly known as
  501.    big-endian. The transmission order is described in detail in [4].
  502.    Unless otherwise noted, numeric constants are in decimal (base 10).
  503.  
  504.  
  505.  
  506. Schulzrinne, et al          Standards Track                     [Page 9]
  507.  
  508. RFC 1889                          RTP                       January 1996
  509.  
  510.  
  511.    All header data is aligned to its natural length, i.e., 16-bit fields
  512.    are aligned on even offsets, 32-bit fields are aligned at offsets
  513.    divisible by four, etc. Octets designated as padding have the value
  514.    zero.
  515.  
  516.    Wallclock time (absolute time) is represented using the timestamp
  517.    format of the Network Time Protocol (NTP), which is in seconds
  518.    relative to 0h UTC on 1 January 1900 [5]. The full resolution NTP
  519.    timestamp is a 64-bit unsigned fixed-point number with the integer
  520.    part in the first 32 bits and the fractional part in the last 32
  521.    bits. In some fields where a more compact representation is
  522.    appropriate, only the middle 32 bits are used; that is, the low 16
  523.    bits of the integer part and the high 16 bits of the fractional part.
  524.    The high 16 bits of the integer part must be determined
  525.    independently.
  526.  
  527. 5.  RTP Data Transfer Protocol
  528.  
  529. 5.1 RTP Fixed Header Fields
  530.  
  531.       The RTP header has the following format:
  532.  
  533.     0                   1                   2                   3
  534.     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  535.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  536.    |V=2|P|X|  CC   |M|     PT      |       sequence number         |
  537.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  538.    |                           timestamp                           |
  539.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  540.    |           synchronization source (SSRC) identifier            |
  541.    +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  542.    |            contributing source (CSRC) identifiers             |
  543.    |                             ....                              |
  544.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  545.  
  546.    The first twelve octets are present in every RTP packet, while the
  547.    list of CSRC identifiers is present only when inserted by a mixer.
  548.    The fields have the following meaning:
  549.  
  550.    version (V): 2 bits
  551.         This field identifies the version of RTP. The version defined by
  552.         this specification is two (2). (The value 1 is used by the first
  553.         draft version of RTP and the value 0 is used by the protocol
  554.         initially implemented in the "vat" audio tool.)
  555.  
  556.    padding (P): 1 bit
  557.         If the padding bit is set, the packet contains one or more
  558.         additional padding octets at the end which are not part of the
  559.  
  560.  
  561.  
  562. Schulzrinne, et al          Standards Track                    [Page 10]
  563.  
  564. RFC 1889                          RTP                       January 1996
  565.  
  566.  
  567.         payload. The last octet of the padding contains a count of how
  568.         many padding octets should be ignored. Padding may be needed by
  569.         some encryption algorithms with fixed block sizes or for
  570.         carrying several RTP packets in a lower-layer protocol data
  571.         unit.
  572.  
  573.    extension (X): 1 bit
  574.         If the extension bit is set, the fixed header is followed by
  575.         exactly one header extension, with a format defined in Section
  576.         5.3.1.
  577.  
  578.    CSRC count (CC): 4 bits
  579.         The CSRC count contains the number of CSRC identifiers that
  580.         follow the fixed header.
  581.  
  582.    marker (M): 1 bit
  583.         The interpretation of the marker is defined by a profile. It is
  584.         intended to allow significant events such as frame boundaries to
  585.         be marked in the packet stream. A profile may define additional
  586.         marker bits or specify that there is no marker bit by changing
  587.         the number of bits in the payload type field (see Section 5.3).
  588.  
  589.    payload type (PT): 7 bits
  590.         This field identifies the format of the RTP payload and
  591.         determines its interpretation by the application. A profile
  592.         specifies a default static mapping of payload type codes to
  593.         payload formats. Additional payload type codes may be defined
  594.         dynamically through non-RTP means (see Section 3). An initial
  595.         set of default mappings for audio and video is specified in the
  596.         companion profile Internet-Draft draft-ietf-avt-profile, and
  597.         may be extended in future editions of the Assigned Numbers RFC
  598.         [6].  An RTP sender emits a single RTP payload type at any given
  599.         time; this field is not intended for multiplexing separate media
  600.         streams (see Section 5.2).
  601.  
  602.    sequence number: 16 bits
  603.         The sequence number increments by one for each RTP data packet
  604.         sent, and may be used by the receiver to detect packet loss and
  605.         to restore packet sequence. The initial value of the sequence
  606.         number is random (unpredictable) to make known-plaintext attacks
  607.         on encryption more difficult, even if the source itself does not
  608.         encrypt, because the packets may flow through a translator that
  609.         does. Techniques for choosing unpredictable numbers are
  610.         discussed in [7].
  611.  
  612.    timestamp: 32 bits
  613.         The timestamp reflects the sampling instant of the first octet
  614.         in the RTP data packet. The sampling instant must be derived
  615.  
  616.  
  617.  
  618. Schulzrinne, et al          Standards Track                    [Page 11]
  619.  
  620. RFC 1889                          RTP                       January 1996
  621.  
  622.  
  623.         from a clock that increments monotonically and linearly in time
  624.         to allow synchronization and jitter calculations (see Section
  625.         6.3.1).  The resolution of the clock must be sufficient for the
  626.         desired synchronization accuracy and for measuring packet
  627.         arrival jitter (one tick per video frame is typically not
  628.         sufficient).  The clock frequency is dependent on the format of
  629.         data carried as payload and is specified statically in the
  630.         profile or payload format specification that defines the format,
  631.         or may be specified dynamically for payload formats defined
  632.         through non-RTP means. If RTP packets are generated
  633.         periodically, the nominal sampling instant as determined from
  634.         the sampling clock is to be used, not a reading of the system
  635.         clock. As an example, for fixed-rate audio the timestamp clock
  636.         would likely increment by one for each sampling period.  If an
  637.         audio application reads blocks covering 160 sampling periods
  638.         from the input device, the timestamp would be increased by 160
  639.         for each such block, regardless of whether the block is
  640.         transmitted in a packet or dropped as silent.
  641.  
  642.    The initial value of the timestamp is random, as for the sequence
  643.    number. Several consecutive RTP packets may have equal timestamps if
  644.    they are (logically) generated at once, e.g., belong to the same
  645.    video frame. Consecutive RTP packets may contain timestamps that are
  646.    not monotonic if the data is not transmitted in the order it was
  647.    sampled, as in the case of MPEG interpolated video frames. (The
  648.    sequence numbers of the packets as transmitted will still be
  649.    monotonic.)
  650.  
  651.    SSRC: 32 bits
  652.         The SSRC field identifies the synchronization source. This
  653.         identifier is chosen randomly, with the intent that no two
  654.         synchronization sources within the same RTP session will have
  655.         the same SSRC identifier. An example algorithm for generating a
  656.         random identifier is presented in Appendix A.6. Although the
  657.         probability of multiple sources choosing the same identifier is
  658.         low, all RTP implementations must be prepared to detect and
  659.         resolve collisions.  Section 8 describes the probability of
  660.         collision along with a mechanism for resolving collisions and
  661.         detecting RTP-level forwarding loops based on the uniqueness of
  662.         the SSRC identifier. If a source changes its source transport
  663.         address, it must also choose a new SSRC identifier to avoid
  664.         being interpreted as a looped source.
  665.  
  666.    CSRC list: 0 to 15 items, 32 bits each
  667.         The CSRC list identifies the contributing sources for the
  668.         payload contained in this packet. The number of identifiers is
  669.         given by the CC field. If there are more than 15 contributing
  670.         sources, only 15 may be identified. CSRC identifiers are
  671.  
  672.  
  673.  
  674. Schulzrinne, et al          Standards Track                    [Page 12]
  675.  
  676. RFC 1889                          RTP                       January 1996
  677.  
  678.  
  679.         inserted by mixers, using the SSRC identifiers of contributing
  680.         sources. For example, for audio packets the SSRC identifiers of
  681.         all sources that were mixed together to create a packet are
  682.         listed, allowing correct talker indication at the receiver.
  683.  
  684. 5.2 Multiplexing RTP Sessions
  685.  
  686.    For efficient protocol processing, the number of multiplexing points
  687.    should be minimized, as described in the integrated layer processing
  688.    design principle [1]. In RTP, multiplexing is provided by the
  689.    destination transport address (network address and port number) which
  690.    define an RTP session. For example, in a teleconference composed of
  691.    audio and video media encoded separately, each medium should be
  692.    carried in a separate RTP session with its own destination transport
  693.    address. It is not intended that the audio and video be carried in a
  694.    single RTP session and demultiplexed based on the payload type or
  695.    SSRC fields. Interleaving packets with different payload types but
  696.    using the same SSRC would introduce several problems:
  697.  
  698.         1.   If one payload type were switched during a session, there
  699.              would be no general means to identify which of the old
  700.              values the new one replaced.
  701.  
  702.         2.   An SSRC is defined to identify a single timing and sequence
  703.              number space. Interleaving multiple payload types would
  704.              require different timing spaces if the media clock rates
  705.              differ and would require different sequence number spaces
  706.              to tell which payload type suffered packet loss.
  707.  
  708.         3.   The RTCP sender and receiver reports (see Section 6.3) can
  709.              only describe one timing and sequence number space per SSRC
  710.              and do not carry a payload type field.
  711.  
  712.         4.   An RTP mixer would not be able to combine interleaved
  713.              streams of incompatible media into one stream.
  714.  
  715.         5.   Carrying multiple media in one RTP session precludes: the
  716.              use of different network paths or network resource
  717.              allocations if appropriate; reception of a subset of the
  718.              media if desired, for example just audio if video would
  719.              exceed the available bandwidth; and receiver
  720.              implementations that use separate processes for the
  721.              different media, whereas using separate RTP sessions
  722.              permits either single- or multiple-process implementations.
  723.  
  724.    Using a different SSRC for each medium but sending them in the same
  725.    RTP session would avoid the first three problems but not the last
  726.    two.
  727.  
  728.  
  729.  
  730. Schulzrinne, et al          Standards Track                    [Page 13]
  731.  
  732. RFC 1889                          RTP                       January 1996
  733.  
  734.  
  735. 5.3 Profile-Specific Modifications to the RTP Header
  736.  
  737.    The existing RTP data packet header is believed to be complete for
  738.    the set of functions required in common across all the application
  739.    classes that RTP might support. However, in keeping with the ALF
  740.    design principle, the header may be tailored through modifications or
  741.    additions defined in a profile specification while still allowing
  742.    profile-independent monitoring and recording tools to function.
  743.  
  744.         o The marker bit and payload type field carry profile-specific
  745.          information, but they are allocated in the fixed header since
  746.          many applications are expected to need them and might otherwise
  747.          have to add another 32-bit word just to hold them. The octet
  748.          containing these fields may be redefined by a profile to suit
  749.          different requirements, for example with a more or fewer marker
  750.          bits. If there are any marker bits, one should be located in
  751.          the most significant bit of the octet since profile-independent
  752.          monitors may be able to observe a correlation between packet
  753.          loss patterns and the marker bit.
  754.  
  755.         o Additional information that is required for a particular
  756.          payload format, such as a video encoding, should be carried in
  757.          the payload section of the packet. This might be in a header
  758.          that is always present at the start of the payload section, or
  759.          might be indicated by a reserved value in the data pattern.
  760.  
  761.         o If a particular class of applications needs additional
  762.          functionality independent of payload format, the profile under
  763.          which those applications operate should define additional fixed
  764.          fields to follow immediately after the SSRC field of the
  765.          existing fixed header.  Those applications will be able to
  766.          quickly and directly access the additional fields while
  767.          profile-independent monitors or recorders can still process the
  768.          RTP packets by interpreting only the first twelve octets.
  769.  
  770.    If it turns out that additional functionality is needed in common
  771.    across all profiles, then a new version of RTP should be defined to
  772.    make a permanent change to the fixed header.
  773.  
  774. 5.3.1 RTP Header Extension
  775.  
  776.    An extension mechanism is provided to allow individual
  777.    implementations to experiment with new payload-format-independent
  778.    functions that require additional information to be carried in the
  779.    RTP data packet header. This mechanism is designed so that the header
  780.    extension may be ignored by other interoperating implementations that
  781.    have not been extended.
  782.  
  783.  
  784.  
  785.  
  786. Schulzrinne, et al          Standards Track                    [Page 14]
  787.  
  788. RFC 1889                          RTP                       January 1996
  789.  
  790.  
  791.    Note that this header extension is intended only for limited use.
  792.    Most potential uses of this mechanism would be better done another
  793.    way, using the methods described in the previous section. For
  794.    example, a profile-specific extension to the fixed header is less
  795.    expensive to process because it is not conditional nor in a variable
  796.    location. Additional information required for a particular payload
  797.    format should not use this header extension, but should be carried in
  798.    the payload section of the packet.
  799.  
  800.     0                   1                   2                   3
  801.     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  802.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  803.    |      defined by profile       |           length              |
  804.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  805.    |                        header extension                       |
  806.    |                             ....                              |
  807.  
  808.  
  809.    If the X bit in the RTP header is one, a variable-length header
  810.    extension is appended to the RTP header, following the CSRC list if
  811.    present. The header extension contains a 16-bit length field that
  812.    counts the number of 32-bit words in the extension, excluding the
  813.    four-octet extension header (therefore zero is a valid length). Only
  814.    a single extension may be appended to the RTP data header. To allow
  815.    multiple interoperating implementations to each experiment
  816.    independently with different header extensions, or to allow a
  817.    particular implementation to experiment with more than one type of
  818.    header extension, the first 16 bits of the header extension are left
  819.    open for distinguishing identifiers or parameters. The format of
  820.    these 16 bits is to be defined by the profile specification under
  821.    which the implementations are operating. This RTP specification does
  822.    not define any header extensions itself.
  823.  
  824. 6.  RTP Control Protocol -- RTCP
  825.  
  826.    The RTP control protocol (RTCP) is based on the periodic transmission
  827.    of control packets to all participants in the session, using the same
  828.    distribution mechanism as the data packets. The underlying protocol
  829.    must provide multiplexing of the data and control packets, for
  830.    example using separate port numbers with UDP. RTCP performs four
  831.    functions:
  832.  
  833.         1.   The primary function is to provide feedback on the quality
  834.              of the data distribution. This is an integral part of the
  835.              RTP's role as a transport protocol and is related to the
  836.              flow and congestion control functions of other transport
  837.              protocols. The feedback may be directly useful for control
  838.              of adaptive encodings [8,9], but experiments with IP
  839.  
  840.  
  841.  
  842. Schulzrinne, et al          Standards Track                    [Page 15]
  843.  
  844. RFC 1889                          RTP                       January 1996
  845.  
  846.  
  847.              multicasting have shown that it is also critical to get
  848.              feedback from the receivers to diagnose faults in the
  849.              distribution. Sending reception feedback reports to all
  850.              participants allows one who is observing problems to
  851.              evaluate whether those problems are local or global. With a
  852.              distribution mechanism like IP multicast, it is also
  853.              possible for an entity such as a network service provider
  854.              who is not otherwise involved in the session to receive the
  855.              feedback information and act as a third-party monitor to
  856.              diagnose network problems. This feedback function is
  857.              performed by the RTCP sender and receiver reports,
  858.              described below in Section 6.3.
  859.  
  860.         2.   RTCP carries a persistent transport-level identifier for an
  861.              RTP source called the canonical name or CNAME, Section
  862.              6.4.1. Since the SSRC identifier may change if a conflict
  863.              is discovered or a program is restarted, receivers require
  864.              the CNAME to keep track of each participant. Receivers also
  865.              require the CNAME to associate multiple data streams from a
  866.              given participant in a set of related RTP sessions, for
  867.              example to synchronize audio and video.
  868.  
  869.         3.   The first two functions require that all participants send
  870.              RTCP packets, therefore the rate must be controlled in
  871.              order for RTP to scale up to a large number of
  872.              participants. By having each participant send its control
  873.              packets to all the others, each can independently observe
  874.              the number of participants. This number is used to
  875.              calculate the rate at which the packets are sent, as
  876.              explained in Section 6.2.
  877.  
  878.         4.   A fourth, optional function is to convey minimal session
  879.              control information, for example participant identification
  880.              to be displayed in the user interface. This is most likely
  881.              to be useful in "loosely controlled" sessions where
  882.              participants enter and leave without membership control or
  883.              parameter negotiation. RTCP serves as a convenient channel
  884.              to reach all the participants, but it is not necessarily
  885.              expected to support all the control communication
  886.              requirements of an application. A higher-level session
  887.              control protocol, which is beyond the scope of this
  888.              document, may be needed.
  889.  
  890.    Functions 1-3 are mandatory when RTP is used in the IP multicast
  891.    environment, and are recommended for all environments. RTP
  892.    application designers are advised to avoid mechanisms that can only
  893.    work in unicast mode and will not scale to larger numbers.
  894.  
  895.  
  896.  
  897.  
  898. Schulzrinne, et al          Standards Track                    [Page 16]
  899.  
  900. RFC 1889                          RTP                       January 1996
  901.  
  902.  
  903. 6.1 RTCP Packet Format
  904.  
  905.    This specification defines several RTCP packet types to carry a
  906.    variety of control information:
  907.  
  908.    SR: Sender report, for transmission and reception statistics from
  909.         participants that are active senders
  910.  
  911.    RR: Receiver report, for reception statistics from participants that
  912.         are not active senders
  913.  
  914.    SDES: Source description items, including CNAME
  915.  
  916.    BYE: Indicates end of participation
  917.  
  918.    APP: Application specific functions
  919.  
  920.    Each RTCP packet begins with a fixed part similar to that of RTP data
  921.    packets, followed by structured elements that may be of variable
  922.    length according to the packet type but always end on a 32-bit
  923.    boundary. The alignment requirement and a length field in the fixed
  924.    part are included to make RTCP packets "stackable". Multiple RTCP
  925.    packets may be concatenated without any intervening separators to
  926.    form a compound RTCP packet that is sent in a single packet of the
  927.    lower layer protocol, for example UDP. There is no explicit count of
  928.    individual RTCP packets in the compound packet since the lower layer
  929.    protocols are expected to provide an overall length to determine the
  930.    end of the compound packet.
  931.  
  932.    Each individual RTCP packet in the compound packet may be processed
  933.    independently with no requirements upon the order or combination of
  934.    packets. However, in order to perform the functions of the protocol,
  935.    the following constraints are imposed:
  936.  
  937.         o Reception statistics (in SR or RR) should be sent as often as
  938.          bandwidth constraints will allow to maximize the resolution of
  939.          the statistics, therefore each periodically transmitted
  940.          compound RTCP packet should include a report packet.
  941.  
  942.         o New receivers need to receive the CNAME for a source as soon
  943.          as possible to identify the source and to begin associating
  944.          media for purposes such as lip-sync, so each compound RTCP
  945.          packet should also include the SDES CNAME.
  946.  
  947.         o The number of packet types that may appear first in the
  948.          compound packet should be limited to increase the number of
  949.          constant bits in the first word and the probability of
  950.          successfully validating RTCP packets against misaddressed RTP
  951.  
  952.  
  953.  
  954. Schulzrinne, et al          Standards Track                    [Page 17]
  955.  
  956. RFC 1889                          RTP                       January 1996
  957.  
  958.  
  959.          data packets or other unrelated packets.
  960.  
  961.    Thus, all RTCP packets must be sent in a compound packet of at least
  962.    two individual packets, with the following format recommended:
  963.  
  964.    Encryption prefix:  If and only if the compound packet is to be
  965.         encrypted, it is prefixed by a random 32-bit quantity redrawn
  966.         for every compound packet transmitted.
  967.  
  968.    SR or RR:  The first RTCP packet in the compound packet must always
  969.         be a report packet to facilitate header validation as described
  970.         in Appendix A.2. This is true even if no data has been sent nor
  971.         received, in which case an empty RR is sent, and even if the
  972.         only other RTCP packet in the compound packet is a BYE.
  973.  
  974.    Additional RRs:  If the number of sources for which reception
  975.         statistics are being reported exceeds 31, the number that will
  976.         fit into one SR or RR packet, then additional RR packets should
  977.         follow the initial report packet.
  978.  
  979.    SDES:  An SDES packet containing a CNAME item must be included in
  980.         each compound RTCP packet. Other source description items may
  981.         optionally be included if required by a particular application,
  982.         subject to bandwidth constraints (see Section 6.2.2).
  983.  
  984.    BYE or APP:  Other RTCP packet types, including those yet to be
  985.         defined, may follow in any order, except that BYE should be the
  986.         last packet sent with a given SSRC/CSRC. Packet types may appear
  987.         more than once.
  988.  
  989.    It is advisable for translators and mixers to combine individual RTCP
  990.    packets from the multiple sources they are forwarding into one
  991.    compound packet whenever feasible in order to amortize the packet
  992.    overhead (see Section 7). An example RTCP compound packet as might be
  993.    produced by a mixer is shown in Fig. 1.  If the overall length of a
  994.    compound packet would exceed the maximum transmission unit (MTU) of
  995.    the network path, it may be segmented into multiple shorter compound
  996.    packets to be transmitted in separate packets of the underlying
  997.    protocol. Note that each of the compound packets must begin with an
  998.    SR or RR packet.
  999.  
  1000.    An implementation may ignore incoming RTCP packets with types unknown
  1001.    to it. Additional RTCP packet types may be registered with the
  1002.    Internet Assigned Numbers Authority (IANA).
  1003.  
  1004.  
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010. Schulzrinne, et al          Standards Track                    [Page 18]
  1011.  
  1012. RFC 1889                          RTP                       January 1996
  1013.  
  1014.  
  1015. 6.2 RTCP Transmission Interval
  1016.  
  1017.    if encrypted: random 32-bit integer
  1018.     |
  1019.     |[------- packet -------][----------- packet -----------][-packet-]
  1020.     |
  1021.     |             receiver reports          chunk        chunk
  1022.     V                                    item  item     item  item
  1023.    --------------------------------------------------------------------
  1024.    |R[SR|# sender #site#site][SDES|# CNAME PHONE |#CNAME LOC][BYE##why]
  1025.    |R[  |# report #  1 #  2 ][    |#             |#         ][   ##   ]
  1026.    |R[  |#        #    #    ][    |#             |#         ][   ##   ]
  1027.    |R[  |#        #    #    ][    |#             |#         ][   ##   ]
  1028.    --------------------------------------------------------------------
  1029.    |<------------------  UDP packet (compound packet) --------------->|
  1030.  
  1031.    #: SSRC/CSRC
  1032.  
  1033.               Figure 1: Example of an RTCP compound packet
  1034.  
  1035.    RTP is designed to allow an application to scale automatically over
  1036.    session sizes ranging from a few participants to thousands. For
  1037.    example, in an audio conference the data traffic is inherently self-
  1038.    limiting because only one or two people will speak at a time, so with
  1039.    multicast distribution the data rate on any given link remains
  1040.    relatively constant independent of the number of participants.
  1041.    However, the control traffic is not self-limiting. If the reception
  1042.    reports from each participant were sent at a constant rate, the
  1043.    control traffic would grow linearly with the number of participants.
  1044.    Therefore, the rate must be scaled down.
  1045.  
  1046.    For each session, it is assumed that the data traffic is subject to
  1047.    an aggregate limit called the "session bandwidth" to be divided among
  1048.    the participants. This bandwidth might be reserved and the limit
  1049.    enforced by the network, or it might just be a reasonable share. The
  1050.    session bandwidth may be chosen based or some cost or a priori
  1051.    knowledge of the available network bandwidth for the session. It is
  1052.    somewhat independent of the media encoding, but the encoding choice
  1053.    may be limited by the session bandwidth. The session bandwidth
  1054.    parameter is expected to be supplied by a session management
  1055.    application when it invokes a media application, but media
  1056.    applications may also set a default based on the single-sender data
  1057.    bandwidth for the encoding selected for the session. The application
  1058.    may also enforce bandwidth limits based on multicast scope rules or
  1059.    other criteria.
  1060.  
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066. Schulzrinne, et al          Standards Track                    [Page 19]
  1067.  
  1068. RFC 1889                          RTP                       January 1996
  1069.  
  1070.  
  1071.    Bandwidth calculations for control and data traffic include lower-
  1072.    layer transport and network protocols (e.g., UDP and IP) since that
  1073.    is what the resource reservation system would need to know. The
  1074.    application can also be expected to know which of these protocols are
  1075.    in use. Link level headers are not included in the calculation since
  1076.    the packet will be encapsulated with different link level headers as
  1077.    it travels.
  1078.  
  1079.    The control traffic should be limited to a small and known fraction
  1080.    of the session bandwidth: small so that the primary function of the
  1081.    transport protocol to carry data is not impaired; known so that the
  1082.    control traffic can be included in the bandwidth specification given
  1083.    to a resource reservation protocol, and so that each participant can
  1084.    independently calculate its share. It is suggested that the fraction
  1085.    of the session bandwidth allocated to RTCP be fixed at 5%. While the
  1086.    value of this and other constants in the interval calculation is not
  1087.    critical, all participants in the session must use the same values so
  1088.    the same interval will be calculated. Therefore, these constants
  1089.    should be fixed for a particular profile.
  1090.  
  1091.    The algorithm described in Appendix A.7 was designed to meet the
  1092.    goals outlined above. It calculates the interval between sending
  1093.    compound RTCP packets to divide the allowed control traffic bandwidth
  1094.    among the participants. This allows an application to provide fast
  1095.    response for small sessions where, for example, identification of all
  1096.    participants is important, yet automatically adapt to large sessions.
  1097.    The algorithm incorporates the following characteristics:
  1098.  
  1099.         o Senders are collectively allocated at least 1/4 of the control
  1100.          traffic bandwidth so that in sessions with a large number of
  1101.          receivers but a small number of senders, newly joining
  1102.          participants will more quickly receive the CNAME for the
  1103.          sending sites.
  1104.  
  1105.         o The calculated interval between RTCP packets is required to be
  1106.          greater than a minimum of 5 seconds to avoid having bursts of
  1107.          RTCP packets exceed the allowed bandwidth when the number of
  1108.          participants is small and the traffic isn't smoothed according
  1109.          to the law of large numbers.
  1110.  
  1111.         o The interval between RTCP packets is varied randomly over the
  1112.          range [0.5,1.5] times the calculated interval to avoid
  1113.          unintended synchronization of all participants [10].  The first
  1114.          RTCP packet sent after joining a session is also delayed by a
  1115.          random variation of half the minimum RTCP interval in case the
  1116.          application is started at multiple sites simultaneously, for
  1117.          example as initiated by a session announcement.
  1118.  
  1119.  
  1120.  
  1121.  
  1122. Schulzrinne, et al          Standards Track                    [Page 20]
  1123.  
  1124. RFC 1889                          RTP                       January 1996
  1125.  
  1126.  
  1127.         o A dynamic estimate of the average compound RTCP packet size is
  1128.          calculated, including all those received and sent, to
  1129.          automatically adapt to changes in the amount of control
  1130.          information carried.
  1131.  
  1132.    This algorithm may be used for sessions in which all participants are
  1133.    allowed to send. In that case, the session bandwidth parameter is the
  1134.    product of the individual sender's bandwidth times the number of
  1135.    participants, and the RTCP bandwidth is 5% of that.
  1136.  
  1137. 6.2.1 Maintaining the number of session members
  1138.  
  1139.    Calculation of the RTCP packet interval depends upon an estimate of
  1140.    the number of sites participating in the session. New sites are added
  1141.    to the count when they are heard, and an entry for each is created in
  1142.    a table indexed by the SSRC or CSRC identifier (see Section 8.2) to
  1143.    keep track of them. New entries may not be considered valid until
  1144.    multiple packets carrying the new SSRC have been received (see
  1145.    Appendix A.1). Entries may be deleted from the table when an RTCP BYE
  1146.    packet with the corresponding SSRC identifier is received.
  1147.  
  1148.    A participant may mark another site inactive, or delete it if not yet
  1149.    valid, if no RTP or RTCP packet has been received for a small number
  1150.    of RTCP report intervals (5 is suggested). This provides some
  1151.    robustness against packet loss. All sites must calculate roughly the
  1152.    same value for the RTCP report interval in order for this timeout to
  1153.    work properly.
  1154.  
  1155.    Once a site has been validated, then if it is later marked inactive
  1156.    the state for that site should still be retained and the site should
  1157.    continue to be counted in the total number of sites sharing RTCP
  1158.    bandwidth for a period long enough to span typical network
  1159.    partitions.  This is to avoid excessive traffic, when the partition
  1160.    heals, due to an RTCP report interval that is too small. A timeout of
  1161.    30 minutes is suggested. Note that this is still larger than 5 times
  1162.    the largest value to which the RTCP report interval is expected to
  1163.    usefully scale, about 2 to 5 minutes.
  1164.  
  1165. 6.2.2 Allocation of source description bandwidth
  1166.  
  1167.    This specification defines several source description (SDES) items in
  1168.    addition to the mandatory CNAME item, such as NAME (personal name)
  1169.    and EMAIL (email address). It also provides a means to define new
  1170.    application-specific RTCP packet types. Applications should exercise
  1171.    caution in allocating control bandwidth to this additional
  1172.    information because it will slow down the rate at which reception
  1173.    reports and CNAME are sent, thus impairing the performance of the
  1174.    protocol. It is recommended that no more than 20% of the RTCP
  1175.  
  1176.  
  1177.  
  1178. Schulzrinne, et al          Standards Track                    [Page 21]
  1179.  
  1180. RFC 1889                          RTP                       January 1996
  1181.  
  1182.  
  1183.    bandwidth allocated to a single participant be used to carry the
  1184.    additional information.  Furthermore, it is not intended that all
  1185.    SDES items should be included in every application. Those that are
  1186.    included should be assigned a fraction of the bandwidth according to
  1187.    their utility.  Rather than estimate these fractions dynamically, it
  1188.    is recommended that the percentages be translated statically into
  1189.    report interval counts based on the typical length of an item.
  1190.  
  1191.    For example, an application may be designed to send only CNAME, NAME
  1192.    and EMAIL and not any others. NAME might be given much higher
  1193.    priority than EMAIL because the NAME would be displayed continuously
  1194.    in the application's user interface, whereas EMAIL would be displayed
  1195.    only when requested. At every RTCP interval, an RR packet and an SDES
  1196.    packet with the CNAME item would be sent. For a small session
  1197.    operating at the minimum interval, that would be every 5 seconds on
  1198.    the average. Every third interval (15 seconds), one extra item would
  1199.    be included in the SDES packet. Seven out of eight times this would
  1200.    be the NAME item, and every eighth time (2 minutes) it would be the
  1201.    EMAIL item.
  1202.  
  1203.    When multiple applications operate in concert using cross-application
  1204.    binding through a common CNAME for each participant, for example in a
  1205.    multimedia conference composed of an RTP session for each medium, the
  1206.    additional SDES information might be sent in only one RTP session.
  1207.    The other sessions would carry only the CNAME item.
  1208.  
  1209. 6.3 Sender and Receiver Reports
  1210.  
  1211.    RTP receivers provide reception quality feedback using RTCP report
  1212.    packets which may take one of two forms depending upon whether or not
  1213.    the receiver is also a sender. The only difference between the sender
  1214.    report (SR) and receiver report (RR) forms, besides the packet type
  1215.    code, is that the sender report includes a 20-byte sender information
  1216.    section for use by active senders. The SR is issued if a site has
  1217.    sent any data packets during the interval since issuing the last
  1218.    report or the previous one, otherwise the RR is issued.
  1219.  
  1220.    Both the SR and RR forms include zero or more reception report
  1221.    blocks, one for each of the synchronization sources from which this
  1222.    receiver has received RTP data packets since the last report. Reports
  1223.    are not issued for contributing sources listed in the CSRC list. Each
  1224.    reception report block provides statistics about the data received
  1225.    from the particular source indicated in that block. Since a maximum
  1226.    of 31 reception report blocks will fit in an SR or RR packet,
  1227.    additional RR packets may be stacked after the initial SR or RR
  1228.    packet as needed to contain the reception reports for all sources
  1229.    heard during the interval since the last report.
  1230.  
  1231.  
  1232.  
  1233.  
  1234. Schulzrinne, et al          Standards Track                    [Page 22]
  1235.  
  1236. RFC 1889                          RTP                       January 1996
  1237.  
  1238.  
  1239.    The next sections define the formats of the two reports, how they may
  1240.    be extended in a profile-specific manner if an application requires
  1241.    additional feedback information, and how the reports may be used.
  1242.    Details of reception reporting by translators and mixers is given in
  1243.    Section 7.
  1244.  
  1245. 6.3.1 SR: Sender report RTCP packet
  1246.  
  1247.  0                   1                   2                   3
  1248.  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  1249. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1250. |V=2|P|    RC   |   PT=SR=200   |             length            | header
  1251. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1252. |                         SSRC of sender                        |
  1253. +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  1254. |              NTP timestamp, most significant word             | sender
  1255. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ info
  1256. |             NTP timestamp, least significant word             |
  1257. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1258. |                         RTP timestamp                         |
  1259. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1260. |                     sender's packet count                     |
  1261. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1262. |                      sender's octet count                     |
  1263. +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  1264. |                 SSRC_1 (SSRC of first source)                 | report
  1265. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ block
  1266. | fraction lost |       cumulative number of packets lost       |   1
  1267. -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1268. |           extended highest sequence number received           |
  1269. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1270. |                      interarrival jitter                      |
  1271. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1272. |                         last SR (LSR)                         |
  1273. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1274. |                   delay since last SR (DLSR)                  |
  1275. +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  1276. |                 SSRC_2 (SSRC of second source)                | report
  1277. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ block
  1278. :                               ...                             :   2
  1279. +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  1280. |                  profile-specific extensions                  |
  1281. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1282.  
  1283.    The sender report packet consists of three sections, possibly
  1284.    followed by a fourth profile-specific extension section if defined.
  1285.    The first section, the header, is 8 octets long. The fields have the
  1286.    following meaning:
  1287.  
  1288.  
  1289.  
  1290. Schulzrinne, et al          Standards Track                    [Page 23]
  1291.  
  1292. RFC 1889                          RTP                       January 1996
  1293.  
  1294.  
  1295.    version (V): 2 bits
  1296.         Identifies the version of RTP, which is the same in RTCP packets
  1297.         as in RTP data packets. The version defined by this
  1298.         specification is two (2).
  1299.  
  1300.    padding (P): 1 bit
  1301.         If the padding bit is set, this RTCP packet contains some
  1302.         additional padding octets at the end which are not part of the
  1303.         control information. The last octet of the padding is a count of
  1304.         how many padding octets should be ignored. Padding may be needed
  1305.         by some encryption algorithms with fixed block sizes. In a
  1306.         compound RTCP packet, padding should only be required on the
  1307.         last individual packet because the compound packet is encrypted
  1308.         as a whole.
  1309.  
  1310.    reception report count (RC): 5 bits
  1311.         The number of reception report blocks contained in this packet.
  1312.         A value of zero is valid.
  1313.  
  1314.    packet type (PT): 8 bits
  1315.         Contains the constant 200 to identify this as an RTCP SR packet.
  1316.  
  1317.    length: 16 bits
  1318.         The length of this RTCP packet in 32-bit words minus one,
  1319.         including the header and any padding. (The offset of one makes
  1320.         zero a valid length and avoids a possible infinite loop in
  1321.         scanning a compound RTCP packet, while counting 32-bit words
  1322.         avoids a validity check for a multiple of 4.)
  1323.  
  1324.    SSRC: 32 bits
  1325.         The synchronization source identifier for the originator of this
  1326.         SR packet.
  1327.  
  1328.    The second section, the sender information, is 20 octets long and is
  1329.    present in every sender report packet. It summarizes the data
  1330.    transmissions from this sender. The fields have the following
  1331.    meaning:
  1332.  
  1333.    NTP timestamp: 64 bits
  1334.         Indicates the wallclock time when this report was sent so that
  1335.         it may be used in combination with timestamps returned in
  1336.         reception reports from other receivers to measure round-trip
  1337.         propagation to those receivers. Receivers should expect that the
  1338.         measurement accuracy of the timestamp may be limited to far less
  1339.         than the resolution of the NTP timestamp. The measurement
  1340.         uncertainty of the timestamp is not indicated as it may not be
  1341.         known. A sender that can keep track of elapsed time but has no
  1342.         notion of wallclock time may use the elapsed time since joining
  1343.  
  1344.  
  1345.  
  1346. Schulzrinne, et al          Standards Track                    [Page 24]
  1347.  
  1348. RFC 1889                          RTP                       January 1996
  1349.  
  1350.  
  1351.         the session instead. This is assumed to be less than 68 years,
  1352.         so the high bit will be zero. It is permissible to use the
  1353.         sampling clock to estimate elapsed wallclock time. A sender that
  1354.         has no notion of wallclock or elapsed time may set the NTP
  1355.         timestamp to zero.
  1356.  
  1357.    RTP timestamp: 32 bits
  1358.         Corresponds to the same time as the NTP timestamp (above), but
  1359.         in the same units and with the same random offset as the RTP
  1360.         timestamps in data packets. This correspondence may be used for
  1361.         intra- and inter-media synchronization for sources whose NTP
  1362.         timestamps are synchronized, and may be used by media-
  1363.         independent receivers to estimate the nominal RTP clock
  1364.         frequency. Note that in most cases this timestamp will not be
  1365.         equal to the RTP timestamp in any adjacent data packet. Rather,
  1366.         it is calculated from the corresponding NTP timestamp using the
  1367.         relationship between the RTP timestamp counter and real time as
  1368.         maintained by periodically checking the wallclock time at a
  1369.         sampling instant.
  1370.  
  1371.    sender's packet count: 32 bits
  1372.         The total number of RTP data packets transmitted by the sender
  1373.         since starting transmission up until the time this SR packet was
  1374.         generated.  The count is reset if the sender changes its SSRC
  1375.         identifier.
  1376.  
  1377.    sender's octet count: 32 bits
  1378.         The total number of payload octets (i.e., not including header
  1379.         or padding) transmitted in RTP data packets by the sender since
  1380.         starting transmission up until the time this SR packet was
  1381.         generated. The count is reset if the sender changes its SSRC
  1382.         identifier. This field can be used to estimate the average
  1383.         payload data rate.
  1384.  
  1385.    The third section contains zero or more reception report blocks
  1386.    depending on the number of other sources heard by this sender since
  1387.    the last report. Each reception report block conveys statistics on
  1388.    the reception of RTP packets from a single synchronization source.
  1389.    Receivers do not carry over statistics when a source changes its SSRC
  1390.    identifier due to a collision. These statistics are:
  1391.  
  1392.    SSRC_n (source identifier): 32 bits
  1393.         The SSRC identifier of the source to which the information in
  1394.         this reception report block pertains.
  1395.  
  1396.    fraction lost: 8 bits
  1397.         The fraction of RTP data packets from source SSRC_n lost since
  1398.         the previous SR or RR packet was sent, expressed as a fixed
  1399.  
  1400.  
  1401.  
  1402. Schulzrinne, et al          Standards Track                    [Page 25]
  1403.  
  1404. RFC 1889                          RTP                       January 1996
  1405.  
  1406.  
  1407.         point number with the binary point at the left edge of the
  1408.         field. (That is equivalent to taking the integer part after
  1409.         multiplying the loss fraction by 256.) This fraction is defined
  1410.         to be the number of packets lost divided by the number of
  1411.         packets expected,  as defined in the next paragraph.  An
  1412.         implementation is shown in Appendix A.3. If the loss is negative
  1413.         due to duplicates, the fraction lost is set to zero. Note that a
  1414.         receiver cannot tell whether any packets were lost after the
  1415.         last one received, and that there will be no reception report
  1416.         block issued for a source if all packets from that source sent
  1417.         during the last reporting interval have been lost.
  1418.  
  1419.    cumulative number of packets lost: 24 bits
  1420.         The total number of RTP data packets from source SSRC_n that
  1421.         have been lost since the beginning of reception. This number is
  1422.         defined to be the number of packets expected less the number of
  1423.         packets actually received, where the number of packets received
  1424.         includes any which are late or duplicates. Thus packets that
  1425.         arrive late are not counted as lost, and the loss may be
  1426.         negative if there are duplicates.  The number of packets
  1427.         expected is defined to be the extended last sequence number
  1428.         received, as defined next, less the initial sequence number
  1429.         received. This may be calculated as shown in Appendix A.3.
  1430.  
  1431.    extended highest sequence number received: 32 bits
  1432.         The low 16 bits contain the highest sequence number received in
  1433.         an RTP data packet from source SSRC_n, and the most significant
  1434.         16 bits extend that sequence number with the corresponding count
  1435.         of sequence number cycles, which may be maintained according to
  1436.         the algorithm in Appendix A.1. Note that different receivers
  1437.         within the same session will generate different extensions to
  1438.         the sequence number if their start times differ significantly.
  1439.  
  1440.    interarrival jitter: 32 bits
  1441.         An estimate of the statistical variance of the RTP data packet
  1442.         interarrival time, measured in timestamp units and expressed as
  1443.         an unsigned integer. The interarrival jitter J is defined to be
  1444.         the mean deviation (smoothed absolute value) of the difference D
  1445.         in packet spacing at the receiver compared to the sender for a
  1446.         pair of packets. As shown in the equation below, this is
  1447.         equivalent to the difference in the "relative transit time" for
  1448.         the two packets; the relative transit time is the difference
  1449.         between a packet's RTP timestamp and the receiver's clock at the
  1450.         time of arrival, measured in the same units.
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.  
  1457.  
  1458. Schulzrinne, et al          Standards Track                    [Page 26]
  1459.  
  1460. RFC 1889                          RTP                       January 1996
  1461.  
  1462.  
  1463.    If Si is the RTP timestamp from packet i, and Ri is the time of
  1464.    arrival in RTP timestamp units for packet i, then for two packets i
  1465.    and j, D may be expressed as
  1466.  
  1467.                  D(i,j)=(Rj-Ri)-(Sj-Si)=(Rj-Sj)-(Ri-Si)
  1468.  
  1469.    The interarrival jitter is calculated continuously as each data
  1470.    packet i is received from source SSRC_n, using this difference D for
  1471.    that packet and the previous packet i-1 in order of arrival (not
  1472.    necessarily in sequence), according to the formula
  1473.  
  1474.                     J=J+(|D(i-1,i)|-J)/16
  1475.  
  1476.    Whenever a reception report is issued, the current value of J is
  1477.    sampled.
  1478.  
  1479.    The jitter calculation is prescribed here to allow profile-
  1480.    independent monitors to make valid interpretations of reports coming
  1481.    from different implementations. This algorithm is the optimal first-
  1482.    order estimator and the gain parameter 1/16 gives a good noise
  1483.    reduction ratio while maintaining a reasonable rate of convergence
  1484.    [11].  A sample implementation is shown in Appendix A.8.
  1485.  
  1486.    last SR timestamp (LSR): 32 bits
  1487.         The middle 32 bits out of 64 in the NTP timestamp (as explained
  1488.         in Section 4) received as part of the most recent RTCP sender
  1489.         report (SR) packet from source SSRC_n.  If no SR has been
  1490.         received yet, the field is set to zero.
  1491.  
  1492.    delay since last SR (DLSR): 32 bits
  1493.         The delay, expressed in units of 1/65536 seconds, between
  1494.         receiving the last SR packet from source SSRC_n and sending this
  1495.         reception report block.  If no SR packet has been received yet
  1496.         from SSRC_n, the DLSR field is set to zero.
  1497.  
  1498.    Let SSRC_r denote the receiver issuing this receiver report. Source
  1499.    SSRC_n can compute the round propagation delay to SSRC_r by recording
  1500.    the time A when this reception report block is received.  It
  1501.    calculates the total round-trip time A-LSR using the last SR
  1502.    timestamp (LSR) field, and then subtracting this field to leave the
  1503.    round-trip propagation delay as (A- LSR - DLSR).  This is illustrated
  1504.    in Fig. 2.
  1505.  
  1506.    This may be used as an approximate measure of distance to cluster
  1507.    receivers, although some links have very asymmetric delays.
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514. Schulzrinne, et al          Standards Track                    [Page 27]
  1515.  
  1516. RFC 1889                          RTP                       January 1996
  1517.  
  1518.  
  1519. 6.3.2 RR: Receiver report RTCP packet
  1520.  
  1521.    [10 Nov 1995 11:33:25.125]           [10 Nov 1995 11:33:36.5]
  1522.    n                 SR(n)              A=b710:8000 (46864.500 s)
  1523.    ---------------------------------------------------------------->
  1524.                       v                 ^
  1525.    ntp_sec =0xb44db705 v               ^ dlsr=0x0005.4000 (    5.250s)
  1526.    ntp_frac=0x20000000  v             ^  lsr =0xb705:2000 (46853.125s)
  1527.      (3024992016.125 s)  v           ^
  1528.    r                      v         ^ RR(n)
  1529.    ---------------------------------------------------------------->
  1530.                           |<-DLSR->|
  1531.                            (5.250 s)
  1532.  
  1533.    A     0xb710:8000 (46864.500 s)
  1534.    DLSR -0x0005:4000 (    5.250 s)
  1535.    LSR  -0xb705:2000 (46853.125 s)
  1536.    -------------------------------
  1537.    delay 0x   6:2000 (    6.125 s)
  1538.  
  1539.            Figure 2: Example for round-trip time computation
  1540.  
  1541.  0                   1                   2                   3
  1542.  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  1543. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1544. |V=2|P|    RC   |   PT=RR=201   |             length            | header
  1545. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1546. |                     SSRC of packet sender                     |
  1547. +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  1548. |                 SSRC_1 (SSRC of first source)                 | report
  1549. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ block
  1550. | fraction lost |       cumulative number of packets lost       |   1
  1551. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1552. |           extended highest sequence number received           |
  1553. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1554. |                      interarrival jitter                      |
  1555. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1556. |                         last SR (LSR)                         |
  1557. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1558. |                   delay since last SR (DLSR)                  |
  1559. +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  1560. |                 SSRC_2 (SSRC of second source)                | report
  1561. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ block
  1562. :                               ...                             :   2
  1563. +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  1564. |                  profile-specific extensions                  |
  1565. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1566.  
  1567.  
  1568.  
  1569.  
  1570. Schulzrinne, et al          Standards Track                    [Page 28]
  1571.  
  1572. RFC 1889                          RTP                       January 1996
  1573.  
  1574.  
  1575.    The format of the receiver report (RR) packet is the same as that of
  1576.    the SR packet except that the packet type field contains the constant
  1577.    201 and the five words of sender information are omitted (these are
  1578.    the NTP and RTP timestamps and sender's packet and octet counts). The
  1579.    remaining fields have the same meaning as for the SR packet.
  1580.  
  1581.    An empty RR packet (RC = 0) is put at the head of a compound RTCP
  1582.    packet when there is no data transmission or reception to report.
  1583.  
  1584. 6.3.3 Extending the sender and receiver reports
  1585.  
  1586.    A profile should define profile- or application-specific extensions
  1587.    to the sender report and receiver if there is additional information
  1588.    that should be reported regularly about the sender or receivers. This
  1589.    method should be used in preference to defining another RTCP packet
  1590.    type because it requires less overhead:
  1591.  
  1592.         o fewer octets in the packet (no RTCP header or SSRC field);
  1593.  
  1594.         o simpler and faster parsing because applications running under
  1595.          that profile would be programmed to always expect the extension
  1596.          fields in the directly accessible location after the reception
  1597.          reports.
  1598.  
  1599.    If additional sender information is required, it should be included
  1600.    first in the extension for sender reports, but would not be present
  1601.    in receiver reports. If information about receivers is to be
  1602.    included, that data may be structured as an array of blocks parallel
  1603.    to the existing array of reception report blocks; that is, the number
  1604.    of blocks would be indicated by the RC field.
  1605.  
  1606. 6.3.4 Analyzing sender and receiver reports
  1607.  
  1608.    It is expected that reception quality feedback will be useful not
  1609.    only for the sender but also for other receivers and third-party
  1610.    monitors.  The sender may modify its transmissions based on the
  1611.    feedback; receivers can determine whether problems are local,
  1612.    regional or global; network managers may use profile-independent
  1613.    monitors that receive only the RTCP packets and not the corresponding
  1614.    RTP data packets to evaluate the performance of their networks for
  1615.    multicast distribution.
  1616.  
  1617.    Cumulative counts are used in both the sender information and
  1618.    receiver report blocks so that differences may be calculated between
  1619.    any two reports to make measurements over both short and long time
  1620.    periods, and to provide resilience against the loss of a report. The
  1621.    difference between the last two reports received can be used to
  1622.    estimate the recent quality of the distribution. The NTP timestamp is
  1623.  
  1624.  
  1625.  
  1626. Schulzrinne, et al          Standards Track                    [Page 29]
  1627.  
  1628. RFC 1889                          RTP                       January 1996
  1629.  
  1630.  
  1631.    included so that rates may be calculated from these differences over
  1632.    the interval between two reports. Since that timestamp is independent
  1633.    of the clock rate for the data encoding, it is possible to implement
  1634.    encoding- and profile-independent quality monitors.
  1635.  
  1636.    An example calculation is the packet loss rate over the interval
  1637.    between two reception reports. The difference in the cumulative
  1638.    number of packets lost gives the number lost during that interval.
  1639.    The difference in the extended last sequence numbers received gives
  1640.    the number of packets expected during the interval. The ratio of
  1641.    these two is the packet loss fraction over the interval. This ratio
  1642.    should equal the fraction lost field if the two reports are
  1643.    consecutive, but otherwise not. The loss rate per second can be
  1644.    obtained by dividing the loss fraction by the difference in NTP
  1645.    timestamps, expressed in seconds. The number of packets received is
  1646.    the number of packets expected minus the number lost. The number of
  1647.    packets expected may also be used to judge the statistical validity
  1648.    of any loss estimates.  For example, 1 out of 5 packets lost has a
  1649.    lower significance than 200 out of 1000.
  1650.  
  1651.    From the sender information, a third-party monitor can calculate the
  1652.    average payload data rate and the average packet rate over an
  1653.    interval without receiving the data. Taking the ratio of the two
  1654.    gives the average payload size. If it can be assumed that packet loss
  1655.    is independent of packet size, then the number of packets received by
  1656.    a particular receiver times the average payload size (or the
  1657.    corresponding packet size) gives the apparent throughput available to
  1658.    that receiver.
  1659.  
  1660.    In addition to the cumulative counts which allow long-term packet
  1661.    loss measurements using differences between reports, the fraction
  1662.    lost field provides a short-term measurement from a single report.
  1663.    This becomes more important as the size of a session scales up enough
  1664.    that reception state information might not be kept for all receivers
  1665.    or the interval between reports becomes long enough that only one
  1666.    report might have been received from a particular receiver.
  1667.  
  1668.    The interarrival jitter field provides a second short-term measure of
  1669.    network congestion. Packet loss tracks persistent congestion while
  1670.    the jitter measure tracks transient congestion. The jitter measure
  1671.    may indicate congestion before it leads to packet loss. Since the
  1672.    interarrival jitter field is only a snapshot of the jitter at the
  1673.    time of a report, it may be necessary to analyze a number of reports
  1674.    from one receiver over time or from multiple receivers, e.g., within
  1675.    a single network.
  1676.  
  1677.  
  1678.  
  1679.  
  1680.  
  1681.  
  1682. Schulzrinne, et al          Standards Track                    [Page 30]
  1683.  
  1684. RFC 1889                          RTP                       January 1996
  1685.  
  1686.  
  1687. 6.4 SDES: Source description RTCP packet
  1688.  
  1689.  0                   1                   2                   3
  1690.  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  1691. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1692. |V=2|P|    SC   |  PT=SDES=202  |             length            | header
  1693. +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  1694. |                          SSRC/CSRC_1                          | chunk
  1695. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+   1
  1696. |                           SDES items                          |
  1697. |                              ...                              |
  1698. +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  1699. |                          SSRC/CSRC_2                          | chunk
  1700. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+   2
  1701. |                           SDES items                          |
  1702. |                              ...                              |
  1703. +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  1704.  
  1705.    The SDES packet is a three-level structure composed of a header and
  1706.    zero or more chunks, each of of which is composed of items describing
  1707.    the source identified in that chunk. The items are described
  1708.    individually in subsequent sections.
  1709.  
  1710.    version (V), padding (P), length:
  1711.         As described for the SR packet (see Section 6.3.1).
  1712.  
  1713.    packet type (PT): 8 bits
  1714.         Contains the constant 202 to identify this as an RTCP SDES
  1715.         packet.
  1716.  
  1717.    source count (SC): 5 bits
  1718.         The number of SSRC/CSRC chunks contained in this SDES packet. A
  1719.         value of zero is valid but useless.
  1720.  
  1721.    Each chunk consists of an SSRC/CSRC identifier followed by a list of
  1722.    zero or more items, which carry information about the SSRC/CSRC. Each
  1723.    chunk starts on a 32-bit boundary. Each item consists of an 8-bit
  1724.    type field, an 8-bit octet count describing the length of the text
  1725.    (thus, not including this two-octet header), and the text itself.
  1726.    Note that the text can be no longer than 255 octets, but this is
  1727.    consistent with the need to limit RTCP bandwidth consumption.
  1728.  
  1729.    The text is encoded according to the UTF-2 encoding specified in
  1730.    Annex F of ISO standard 10646 [12,13]. This encoding is also known as
  1731.    UTF-8 or UTF-FSS. It is described in "File System Safe UCS
  1732.    Transformation Format (FSS_UTF)", X/Open Preliminary Specification,
  1733.    Document Number P316 and Unicode Technical Report #4. US-ASCII is a
  1734.    subset of this encoding and requires no additional encoding. The
  1735.  
  1736.  
  1737.  
  1738. Schulzrinne, et al          Standards Track                    [Page 31]
  1739.  
  1740. RFC 1889                          RTP                       January 1996
  1741.  
  1742.  
  1743.    presence of multi-octet encodings is indicated by setting the most
  1744.    significant bit of a character to a value of one.
  1745.  
  1746.    Items are contiguous, i.e., items are not individually padded to a
  1747.    32-bit boundary. Text is not null terminated because some multi-octet
  1748.    encodings include null octets. The list of items in each chunk is
  1749.    terminated by one or more null octets, the first of which is
  1750.    interpreted as an item type of zero to denote the end of the list,
  1751.    and the remainder as needed to pad until the next 32-bit boundary. A
  1752.    chunk with zero items (four null octets) is valid but useless.
  1753.  
  1754.    End systems send one SDES packet containing their own source
  1755.    identifier (the same as the SSRC in the fixed RTP header). A mixer
  1756.    sends one SDES packet containing a chunk for each contributing source
  1757.    from which it is receiving SDES information, or multiple complete
  1758.    SDES packets in the format above if there are more than 31 such
  1759.    sources (see Section 7).
  1760.  
  1761.    The SDES items currently defined are described in the next sections.
  1762.    Only the CNAME item is mandatory. Some items shown here may be useful
  1763.    only for particular profiles, but the item types are all assigned
  1764.    from one common space to promote shared use and to simplify profile-
  1765.    independent applications. Additional items may be defined in a
  1766.    profile by registering the type numbers with IANA.
  1767.  
  1768. 6.4.1 CNAME: Canonical end-point identifier SDES item
  1769.  
  1770.     0                   1                   2                   3
  1771.     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  1772.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1773.    |    CNAME=1    |     length    | user and domain name         ...
  1774.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1775.  
  1776.    The CNAME identifier has the following properties:
  1777.  
  1778.         o Because the randomly allocated SSRC identifier may change if a
  1779.          conflict is discovered or if a program is restarted, the CNAME
  1780.          item is required to provide the binding from the SSRC
  1781.          identifier to an identifier for the source that remains
  1782.          constant.
  1783.  
  1784.         o Like the SSRC identifier, the CNAME identifier should also be
  1785.          unique among all participants within one RTP session.
  1786.  
  1787.         o To provide a binding across multiple media tools used by one
  1788.          participant in a set of related RTP sessions, the CNAME should
  1789.          be fixed for that participant.
  1790.  
  1791.  
  1792.  
  1793.  
  1794. Schulzrinne, et al          Standards Track                    [Page 32]
  1795.  
  1796. RFC 1889                          RTP                       January 1996
  1797.  
  1798.  
  1799.         o To facilitate third-party monitoring, the CNAME should be
  1800.          suitable for either a program or a person to locate the source.
  1801.  
  1802.    Therefore, the CNAME should be derived algorithmically and not
  1803.    entered manually, when possible. To meet these requirements, the
  1804.    following format should be used unless a profile specifies an
  1805.    alternate syntax or semantics. The CNAME item should have the format
  1806.    "user@host", or "host" if a user name is not available as on single-
  1807.    user systems.  For both formats, "host" is either the fully qualified
  1808.    domain name of the host from which the real-time data originates,
  1809.    formatted according to the rules specified in RFC 1034 [14], RFC 1035
  1810.    [15] and Section 2.1 of RFC 1123 [16]; or the standard ASCII
  1811.    representation of the host's numeric address on the interface used
  1812.    for the RTP communication. For example, the standard ASCII
  1813.    representation of an IP Version 4 address is "dotted decimal", also
  1814.    known as dotted quad. Other address types are expected to have ASCII
  1815.    representations that are mutually unique.  The fully qualified domain
  1816.    name is more convenient for a human observer and may avoid the need
  1817.    to send a NAME item in addition, but it may be difficult or
  1818.    impossible to obtain reliably in some operating environments.
  1819.    Applications that may be run in such environments should use the
  1820.    ASCII representation of the address instead.
  1821.  
  1822.    Examples are "doe@sleepy.megacorp.com" or "doe@192.0.2.89" for a
  1823.    multi-user system. On a system with no user name, examples would be
  1824.    "sleepy.megacorp.com" or "192.0.2.89".
  1825.  
  1826.    The user name should be in a form that a program such as "finger" or
  1827.    "talk" could use, i.e., it typically is the login name rather than
  1828.    the personal name. The host name is not necessarily identical to the
  1829.    one in the participant's electronic mail address.
  1830.  
  1831.    This syntax will not provide unique identifiers for each source if an
  1832.    application permits a user to generate multiple sources from one
  1833.    host.  Such an application would have to rely on the SSRC to further
  1834.    identify the source, or the profile for that application would have
  1835.    to specify additional syntax for the CNAME identifier.
  1836.  
  1837.    If each application creates its CNAME independently, the resulting
  1838.    CNAMEs may not be identical as would be required to provide a binding
  1839.    across multiple media tools belonging to one participant in a set of
  1840.    related RTP sessions. If cross-media binding is required, it may be
  1841.    necessary for the CNAME of each tool to be externally configured with
  1842.    the same value by a coordination tool.
  1843.  
  1844.    Application writers should be aware that private network address
  1845.    assignments such as the Net-10 assignment proposed in RFC 1597 [17]
  1846.    may create network addresses that are not globally unique. This would
  1847.  
  1848.  
  1849.  
  1850. Schulzrinne, et al          Standards Track                    [Page 33]
  1851.  
  1852. RFC 1889                          RTP                       January 1996
  1853.  
  1854.  
  1855.    lead to non-unique CNAMEs if hosts with private addresses and no
  1856.    direct IP connectivity to the public Internet have their RTP packets
  1857.    forwarded to the public Internet through an RTP-level translator.
  1858.    (See also RFC 1627 [18].) To handle this case, applications may
  1859.    provide a means to configure a unique CNAME, but the burden is on the
  1860.    translator to translate CNAMEs from private addresses to public
  1861.    addresses if necessary to keep private addresses from being exposed.
  1862.  
  1863. 6.4.2 NAME: User name SDES item
  1864.  
  1865.     0                   1                   2                   3
  1866.     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  1867.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1868.    |     NAME=2    |     length    | common name of source        ...
  1869.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1870.  
  1871.    This is the real name used to describe the source, e.g., "John Doe,
  1872.    Bit Recycler, Megacorp". It may be in any form desired by the user.
  1873.    For applications such as conferencing, this form of name may be the
  1874.    most desirable for display in participant lists, and therefore might
  1875.    be sent most frequently of those items other than CNAME. Profiles may
  1876.    establish such priorities.  The NAME value is expected to remain
  1877.    constant at least for the duration of a session. It should not be
  1878.    relied upon to be unique among all participants in the session.
  1879.  
  1880. 6.4.3 EMAIL: Electronic mail address SDES item
  1881.  
  1882.     0                   1                   2                   3
  1883.     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  1884.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1885.    |    EMAIL=3    |     length    | email address of source      ...
  1886.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1887.  
  1888.    The email address is formatted according to RFC 822 [19], for
  1889.    example, "John.Doe@megacorp.com". The EMAIL value is expected to
  1890.    remain constant for the duration of a session.
  1891.  
  1892. 6.4.4 PHONE: Phone number SDES item
  1893.  
  1894.     0                   1                   2                   3
  1895.     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  1896.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1897.    |    PHONE=4    |     length    | phone number of source       ...
  1898.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1899.  
  1900.    The phone number should be formatted with the plus sign replacing the
  1901.    international access code.  For example, "+1 908 555 1212" for a
  1902.    number in the United States.
  1903.  
  1904.  
  1905.  
  1906. Schulzrinne, et al          Standards Track                    [Page 34]
  1907.  
  1908. RFC 1889                          RTP                       January 1996
  1909.  
  1910.  
  1911. 6.4.5 LOC: Geographic user location SDES item
  1912.  
  1913.     0                   1                   2                   3
  1914.     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  1915.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1916.    |     LOC=5     |     length    | geographic location of site  ...
  1917.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1918.  
  1919.    Depending on the application, different degrees of detail are
  1920.    appropriate for this item. For conference applications, a string like
  1921.    "Murray Hill, New Jersey" may be sufficient, while, for an active
  1922.    badge system, strings like "Room 2A244, AT&T BL MH" might be
  1923.    appropriate. The degree of detail is left to the implementation
  1924.    and/or user, but format and content may be prescribed by a profile.
  1925.    The LOC value is expected to remain constant for the duration of a
  1926.    session, except for mobile hosts.
  1927.  
  1928. 6.4.6 TOOL: Application or tool name SDES item
  1929.  
  1930.     0                   1                   2                   3
  1931.     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  1932.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1933.    |     TOOL=6    |     length    | name/version of source appl. ...
  1934.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1935.  
  1936.    A string giving the name and possibly version of the application
  1937.    generating the stream, e.g., "videotool 1.2". This information may be
  1938.    useful for debugging purposes and is similar to the Mailer or Mail-
  1939.    System-Version SMTP headers. The TOOL value is expected to remain
  1940.    constant for the duration of the session.
  1941.  
  1942. 6.4.7 NOTE: Notice/status SDES item
  1943.  
  1944.     0                   1                   2                   3
  1945.     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  1946.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1947.    |     NOTE=7    |     length    | note about the source        ...
  1948.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1949.  
  1950.    The following semantics are suggested for this item, but these or
  1951.    other semantics may be explicitly defined by a profile. The NOTE item
  1952.    is intended for transient messages describing the current state of
  1953.    the source, e.g., "on the phone, can't talk". Or, during a seminar,
  1954.    this item might be used to convey the title of the talk. It should be
  1955.    used only to carry exceptional information and should not be included
  1956.    routinely by all participants because this would slow down the rate
  1957.    at which reception reports and CNAME are sent, thus impairing the
  1958.    performance of the protocol. In particular, it should not be included
  1959.  
  1960.  
  1961.  
  1962. Schulzrinne, et al          Standards Track                    [Page 35]
  1963.  
  1964. RFC 1889                          RTP                       January 1996
  1965.  
  1966.  
  1967.    as an item in a user's configuration file nor automatically generated
  1968.    as in a quote-of-the-day.
  1969.  
  1970.    Since the NOTE item may be important to display while it is active,
  1971.    the rate at which other non-CNAME items such as NAME are transmitted
  1972.    might be reduced so that the NOTE item can take that part of the RTCP
  1973.    bandwidth. When the transient message becomes inactive, the NOTE item
  1974.    should continue to be transmitted a few times at the same repetition
  1975.    rate but with a string of length zero to signal the receivers.
  1976.    However, receivers should also consider the NOTE item inactive if it
  1977.    is not received for a small multiple of the repetition rate, or
  1978.    perhaps 20-30 RTCP intervals.
  1979.  
  1980. 6.4.8 PRIV: Private extensions SDES item
  1981.  
  1982.       0                   1                   2                   3
  1983.       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  1984.      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1985.      |     PRIV=8    |     length    | prefix length | prefix string...
  1986.      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1987.     ...              |                  value string                ...
  1988.      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1989.  
  1990.    This item is used to define experimental or application-specific SDES
  1991.    extensions. The item contains a prefix consisting of a length-string
  1992.    pair, followed by the value string filling the remainder of the item
  1993.    and carrying the desired information. The prefix length field is 8
  1994.    bits long. The prefix string is a name chosen by the person defining
  1995.    the PRIV item to be unique with respect to other PRIV items this
  1996.    application might receive. The application creator might choose to
  1997.    use the application name plus an additional subtype identification if
  1998.    needed.  Alternatively, it is recommended that others choose a name
  1999.    based on the entity they represent, then coordinate the use of the
  2000.    name within that entity.
  2001.  
  2002.    Note that the prefix consumes some space within the item's total
  2003.    length of 255 octets, so the prefix should be kept as short as
  2004.    possible. This facility and the constrained RTCP bandwidth should not
  2005.    be overloaded; it is not intended to satisfy all the control
  2006.    communication requirements of all applications.
  2007.  
  2008.    SDES PRIV prefixes will not be registered by IANA. If some form of
  2009.    the PRIV item proves to be of general utility, it should instead be
  2010.    assigned a regular SDES item type registered with IANA so that no
  2011.    prefix is required. This simplifies use and increases transmission
  2012.    efficiency.
  2013.  
  2014.  
  2015.  
  2016.  
  2017.  
  2018. Schulzrinne, et al          Standards Track                    [Page 36]
  2019.  
  2020. RFC 1889                          RTP                       January 1996
  2021.  
  2022.  
  2023. 6.5 BYE: Goodbye RTCP packet
  2024.  
  2025.     0                   1                   2                   3
  2026.     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  2027.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  2028.    |V=2|P|    SC   |   PT=BYE=203  |             length            |
  2029.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  2030.    |                           SSRC/CSRC                           |
  2031.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  2032.    :                              ...                              :
  2033.    +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  2034.    |     length    |               reason for leaving             ... (opt)
  2035.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  2036.  
  2037.    The BYE packet indicates that one or more sources are no longer
  2038.    active.
  2039.  
  2040.    version (V), padding (P), length:
  2041.         As described for the SR packet (see Section 6.3.1).
  2042.  
  2043.    packet type (PT): 8 bits
  2044.         Contains the constant 203 to identify this as an RTCP BYE
  2045.         packet.
  2046.  
  2047.    source count (SC): 5 bits
  2048.         The number of SSRC/CSRC identifiers included in this BYE packet.
  2049.         A count value of zero is valid, but useless.
  2050.  
  2051.    If a BYE packet is received by a mixer, the mixer forwards the BYE
  2052.    packet with the SSRC/CSRC identifier(s) unchanged. If a mixer shuts
  2053.    down, it should send a BYE packet listing all contributing sources it
  2054.    handles, as well as its own SSRC identifier. Optionally, the BYE
  2055.    packet may include an 8-bit octet count followed by that many octets
  2056.    of text indicating the reason for leaving, e.g., "camera malfunction"
  2057.    or "RTP loop detected". The string has the same encoding as that
  2058.    described for SDES. If the string fills the packet to the next 32-bit
  2059.    boundary, the string is not null terminated. If not, the BYE packet
  2060.    is padded with null octets.
  2061.  
  2062.  
  2063.  
  2064.  
  2065.  
  2066.  
  2067.  
  2068.  
  2069.  
  2070.  
  2071.  
  2072.  
  2073.  
  2074. Schulzrinne, et al          Standards Track                    [Page 37]
  2075.  
  2076. RFC 1889                          RTP                       January 1996
  2077.  
  2078.  
  2079. 6.6 APP: Application-defined RTCP packet
  2080.  
  2081.     0                   1                   2                   3
  2082.     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  2083.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  2084.    |V=2|P| subtype |   PT=APP=204  |             length            |
  2085.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  2086.    |                           SSRC/CSRC                           |
  2087.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  2088.    |                          name (ASCII)                         |
  2089.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  2090.    |                   application-dependent data                 ...
  2091.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  2092.  
  2093.    The APP packet is intended for experimental use as new applications
  2094.    and new features are developed, without requiring packet type value
  2095.    registration. APP packets with unrecognized names should be ignored.
  2096.    After testing and if wider use is justified, it is recommended that
  2097.    each APP packet be redefined without the subtype and name fields and
  2098.    registered with the Internet Assigned Numbers Authority using an RTCP
  2099.    packet type.
  2100.  
  2101.    version (V), padding (P), length:
  2102.         As described for the SR packet (see Section 6.3.1).
  2103.  
  2104.    subtype: 5 bits
  2105.         May be used as a subtype to allow a set of APP packets to be
  2106.         defined under one unique name, or for any application-dependent
  2107.         data.
  2108.  
  2109.    packet type (PT): 8 bits
  2110.         Contains the constant 204 to identify this as an RTCP APP
  2111.         packet.
  2112.  
  2113.    name: 4 octets
  2114.         A name chosen by the person defining the set of APP packets to
  2115.         be unique with respect to other APP packets this application
  2116.         might receive. The application creator might choose to use the
  2117.         application name, and then coordinate the allocation of subtype
  2118.         values to others who want to define new packet types for the
  2119.         application.  Alternatively, it is recommended that others
  2120.         choose a name based on the entity they represent, then
  2121.         coordinate the use of the name within that entity. The name is
  2122.         interpreted as a sequence of four ASCII characters, with
  2123.         uppercase and lowercase characters treated as distinct.
  2124.  
  2125.  
  2126.  
  2127.  
  2128.  
  2129.  
  2130. Schulzrinne, et al          Standards Track                    [Page 38]
  2131.  
  2132. RFC 1889                          RTP                       January 1996
  2133.  
  2134.  
  2135.    application-dependent data: variable length
  2136.         Application-dependent data may or may not appear in an APP
  2137.         packet. It is interpreted by the application and not RTP itself.
  2138.         It must be a multiple of 32 bits long.
  2139.  
  2140. 7.  RTP Translators and Mixers
  2141.  
  2142.    In addition to end systems, RTP supports the notion of "translators"
  2143.    and "mixers", which could be considered as "intermediate systems" at
  2144.    the RTP level. Although this support adds some complexity to the
  2145.    protocol, the need for these functions has been clearly established
  2146.    by experiments with multicast audio and video applications in the
  2147.    Internet. Example uses of translators and mixers given in Section 2.3
  2148.    stem from the presence of firewalls and low bandwidth connections,
  2149.    both of which are likely to remain.
  2150.  
  2151. 7.1 General Description
  2152.  
  2153.    An RTP translator/mixer connects two or more transport-level
  2154.    "clouds".  Typically, each cloud is defined by a common network and
  2155.    transport protocol (e.g., IP/UDP), multicast address or pair of
  2156.    unicast addresses, and transport level destination port.  (Network-
  2157.    level protocol translators, such as IP version 4 to IP version 6, may
  2158.    be present within a cloud invisibly to RTP.) One system may serve as
  2159.    a translator or mixer for a number of RTP sessions, but each is
  2160.    considered a logically separate entity.
  2161.  
  2162.    In order to avoid creating a loop when a translator or mixer is
  2163.    installed, the following rules must be observed:
  2164.  
  2165.         o Each of the clouds connected by translators and mixers
  2166.          participating in one RTP session either must be distinct from
  2167.          all the others in at least one of these parameters (protocol,
  2168.          address, port), or must be isolated at the network level from
  2169.          the others.
  2170.  
  2171.         o A derivative of the first rule is that there must not be
  2172.          multiple translators or mixers connected in parallel unless by
  2173.          some arrangement they partition the set of sources to be
  2174.          forwarded.
  2175.  
  2176.    Similarly, all RTP end systems that can communicate through one or
  2177.    more RTP translators or mixers share the same SSRC space, that is,
  2178.    the SSRC identifiers must be unique among all these end systems.
  2179.    Section 8.2 describes the collision resolution algorithm by which
  2180.    SSRC identifiers are kept unique and loops are detected.
  2181.  
  2182.  
  2183.  
  2184.  
  2185.  
  2186. Schulzrinne, et al          Standards Track                    [Page 39]
  2187.  
  2188. RFC 1889                          RTP                       January 1996
  2189.  
  2190.  
  2191.    There may be many varieties of translators and mixers designed for
  2192.    different purposes and applications. Some examples are to add or
  2193.    remove encryption, change the encoding of the data or the underlying
  2194.    protocols, or replicate between a multicast address and one or more
  2195.    unicast addresses. The distinction between translators and mixers is
  2196.    that a translator passes through the data streams from different
  2197.    sources separately, whereas a mixer combines them to form one new
  2198.    stream:
  2199.  
  2200.    Translator: Forwards RTP packets with their SSRC identifier intact;
  2201.         this makes it possible for receivers to identify individual
  2202.         sources even though packets from all the sources pass through
  2203.         the same translator and carry the translator's network source
  2204.         address. Some kinds of translators will pass through the data
  2205.         untouched, but others may change the encoding of the data and
  2206.         thus the RTP data payload type and timestamp. If multiple data
  2207.         packets are re-encoded into one, or vice versa, a translator
  2208.         must assign new sequence numbers to the outgoing packets. Losses
  2209.         in the incoming packet stream may induce corresponding gaps in
  2210.         the outgoing sequence numbers. Receivers cannot detect the
  2211.         presence of a translator unless they know by some other means
  2212.         what payload type or transport address was used by the original
  2213.         source.
  2214.  
  2215.    Mixer: Receives streams of RTP data packets from one or more sources,
  2216.         possibly changes the data format, combines the streams in some
  2217.         manner and then forwards the combined stream. Since the timing
  2218.         among multiple input sources will not generally be synchronized,
  2219.         the mixer will make timing adjustments among the streams and
  2220.         generate its own timing for the combined stream, so it is the
  2221.         synchronization source. Thus, all data packets forwarded by a
  2222.         mixer will be marked with the mixer's own SSRC identifier. In
  2223.         order to preserve the identity of the original sources
  2224.         contributing to the mixed packet, the mixer should insert their
  2225.         SSRC identifiers into the CSRC identifier list following the
  2226.         fixed RTP header of the packet. A mixer that is also itself a
  2227.         contributing source for some packet should explicitly include
  2228.         its own SSRC identifier in the CSRC list for that packet.
  2229.  
  2230.    For some applications, it may be acceptable for a mixer not to
  2231.    identify sources in the CSRC list. However, this introduces the
  2232.    danger that loops involving those sources could not be detected.
  2233.  
  2234.    The advantage of a mixer over a translator for applications like
  2235.    audio is that the output bandwidth is limited to that of one source
  2236.    even when multiple sources are active on the input side. This may be
  2237.    important for low-bandwidth links. The disadvantage is that receivers
  2238.    on the output side don't have any control over which sources are
  2239.  
  2240.  
  2241.  
  2242. Schulzrinne, et al          Standards Track                    [Page 40]
  2243.  
  2244. RFC 1889                          RTP                       January 1996
  2245.  
  2246.  
  2247.    passed through or muted, unless some mechanism is implemented for
  2248.    remote control of the mixer. The regeneration of synchronization
  2249.    information by mixers also means that receivers can't do inter-media
  2250.    synchronization of the original streams. A multi-media mixer could do
  2251.    it.
  2252.  
  2253.  
  2254.          [E1]                                    [E6]
  2255.           |                                       |
  2256.     E1:17 |                                 E6:15 |
  2257.           |                                       |   E6:15
  2258.           V  M1:48 (1,17)         M1:48 (1,17)    V   M1:48 (1,17)
  2259.          (M1)-------------><T1>-----------------><T2>-------------->[E7]
  2260.           ^                 ^     E4:47           ^   E4:47
  2261.      E2:1 |           E4:47 |                     |   M3:89 (64,45)
  2262.           |                 |                     |
  2263.          [E2]              [E4]     M3:89 (64,45) |
  2264.                                                   |        legend:
  2265.    [E3] --------->(M2)----------->(M3)------------|        [End system]
  2266.           E3:64        M2:12 (64)  ^                       (Mixer)
  2267.                                    | E5:45                 <Translator>
  2268.                                    |
  2269.                                   [E5]          source: SSRC (CSRCs)
  2270.                                                 ------------------->
  2271.  
  2272.  Figure 3: Sample RTP network with end systems, mixers and translators
  2273.  
  2274.    A collection of mixers and translators is shown in Figure 3 to
  2275.    illustrate their effect on SSRC and CSRC identifiers. In the figure,
  2276.    end systems are shown as rectangles (named E), translators as
  2277.    triangles (named T) and mixers as ovals (named M). The notation "M1:
  2278.    48(1,17)" designates a packet originating a mixer M1, identified with
  2279.    M1's (random) SSRC value of 48 and two CSRC identifiers, 1 and 17,
  2280.    copied from the SSRC identifiers of packets from E1 and E2.
  2281.  
  2282. 7.2 RTCP Processing in Translators
  2283.  
  2284.    In addition to forwarding data packets, perhaps modified, translators
  2285.    and mixers must also process RTCP packets. In many cases, they will
  2286.    take apart the compound RTCP packets received from end systems to
  2287.    aggregate SDES information and to modify the SR or RR packets.
  2288.    Retransmission of this information may be triggered by the packet
  2289.    arrival or by the RTCP interval timer of the translator or mixer
  2290.    itself.
  2291.  
  2292.    A translator that does not modify the data packets, for example one
  2293.    that just replicates between a multicast address and a unicast
  2294.    address, may simply forward RTCP packets unmodified as well. A
  2295.  
  2296.  
  2297.  
  2298. Schulzrinne, et al          Standards Track                    [Page 41]
  2299.  
  2300. RFC 1889                          RTP                       January 1996
  2301.  
  2302.  
  2303.    translator that transforms the payload in some way must make
  2304.    corresponding transformations in the SR and RR information so that it
  2305.    still reflects the characteristics of the data and the reception
  2306.    quality. These translators must not simply forward RTCP packets. In
  2307.    general, a translator should not aggregate SR and RR packets from
  2308.    different sources into one packet since that would reduce the
  2309.    accuracy of the propagation delay measurements based on the LSR and
  2310.    DLSR fields.
  2311.  
  2312.    SR sender information:  A translator does not generate its own sender
  2313.         information, but forwards the SR packets received from one cloud
  2314.         to the others. The SSRC is left intact but the sender
  2315.         information must be modified if required by the translation. If
  2316.         a translator changes the data encoding, it must change the
  2317.         "sender's byte count" field. If it also combines several data
  2318.         packets into one output packet, it must change the "sender's
  2319.         packet count" field. If it changes the timestamp frequency, it
  2320.         must change the "RTP timestamp" field in the SR packet.
  2321.  
  2322.    SR/RR reception report blocks:  A translator forwards reception
  2323.         reports received from one cloud to the others. Note that these
  2324.         flow in the direction opposite to the data.  The SSRC is left
  2325.         intact. If a translator combines several data packets into one
  2326.         output packet, and therefore changes the sequence numbers, it
  2327.         must make the inverse manipulation for the packet loss fields
  2328.         and the "extended last sequence number" field. This may be
  2329.         complex. In the extreme case, there may be no meaningful way to
  2330.         translate the reception reports, so the translator may pass on
  2331.         no reception report at all or a synthetic report based on its
  2332.         own reception. The general rule is to do what makes sense for a
  2333.         particular translation.
  2334.  
  2335.    A translator does not require an SSRC identifier of its own, but may
  2336.    choose to allocate one for the purpose of sending reports about what
  2337.    it has received. These would be sent to all the connected clouds,
  2338.    each corresponding to the translation of the data stream as sent to
  2339.    that cloud, since reception reports are normally multicast to all
  2340.    participants.
  2341.  
  2342.    SDES:  Translators typically forward without change the SDES
  2343.         information they receive from one cloud to the others, but may,
  2344.         for example, decide to filter non-CNAME SDES information if
  2345.         bandwidth is limited. The CNAMEs must be forwarded to allow SSRC
  2346.         identifier collision detection to work. A translator that
  2347.         generates its own RR packets must send SDES CNAME information
  2348.         about itself to the same clouds that it sends those RR packets.
  2349.  
  2350.  
  2351.  
  2352.  
  2353.  
  2354. Schulzrinne, et al          Standards Track                    [Page 42]
  2355.  
  2356. RFC 1889                          RTP                       January 1996
  2357.  
  2358.  
  2359.    BYE:  Translators forward BYE packets unchanged. Translators with
  2360.         their own SSRC should generate BYE packets with that SSRC
  2361.         identifier if they are about to cease forwarding packets.
  2362.  
  2363.    APP:  Translators forward APP packets unchanged.
  2364.  
  2365. 7.3 RTCP Processing in Mixers
  2366.  
  2367.    Since a mixer generates a new data stream of its own, it does not
  2368.    pass through SR or RR packets at all and instead generates new
  2369.    information for both sides.
  2370.  
  2371.    SR sender information:  A mixer does not pass through sender
  2372.         information from the sources it mixes because the
  2373.         characteristics of the source streams are lost in the mix. As a
  2374.         synchronization source, the mixer generates its own SR packets
  2375.         with sender information about the mixed data stream and sends
  2376.         them in the same direction as the mixed stream.
  2377.  
  2378.    SR/RR reception report blocks:  A mixer generates its own reception
  2379.         reports for sources in each cloud and sends them out only to the
  2380.         same cloud. It does not send these reception reports to the
  2381.         other clouds and does not forward reception reports from one
  2382.         cloud to the others because the sources would not be SSRCs there
  2383.         (only CSRCs).
  2384.  
  2385.    SDES:  Mixers typically forward without change the SDES information
  2386.         they receive from one cloud to the others, but may, for example,
  2387.         decide to filter non-CNAME SDES information if bandwidth is
  2388.         limited. The CNAMEs must be forwarded to allow SSRC identifier
  2389.         collision detection to work. (An identifier in a CSRC list
  2390.         generated by a mixer might collide with an SSRC identifier
  2391.         generated by an end system.) A mixer must send SDES CNAME
  2392.         information about itself to the same clouds that it sends SR or
  2393.         RR packets.
  2394.  
  2395.    Since mixers do not forward SR or RR packets, they will typically be
  2396.    extracting SDES packets from a compound RTCP packet. To minimize
  2397.    overhead, chunks from the SDES packets may be aggregated into a
  2398.    single SDES packet which is then stacked on an SR or RR packet
  2399.    originating from the mixer. The RTCP packet rate may be different on
  2400.    each side of the mixer.
  2401.  
  2402.    A mixer that does not insert CSRC identifiers may also refrain from
  2403.    forwarding SDES CNAMEs. In this case, the SSRC identifier spaces in
  2404.    the two clouds are independent. As mentioned earlier, this mode of
  2405.    operation creates a danger that loops can't be detected.
  2406.  
  2407.  
  2408.  
  2409.  
  2410. Schulzrinne, et al          Standards Track                    [Page 43]
  2411.  
  2412. RFC 1889                          RTP                       January 1996
  2413.  
  2414.  
  2415.    BYE:  Mixers need to forward BYE packets. They should generate BYE
  2416.         packets with their own SSRC identifiers if they are about to
  2417.         cease forwarding packets.
  2418.  
  2419.    APP:  The treatment of APP packets by mixers is application-specific.
  2420.  
  2421. 7.4 Cascaded Mixers
  2422.  
  2423.    An RTP session may involve a collection of mixers and translators as
  2424.    shown in Figure 3. If two mixers are cascaded, such as M2 and M3 in
  2425.    the figure, packets received by a mixer may already have been mixed
  2426.    and may include a CSRC list with multiple identifiers. The second
  2427.    mixer should build the CSRC list for the outgoing packet using the
  2428.    CSRC identifiers from already-mixed input packets and the SSRC
  2429.    identifiers from unmixed input packets. This is shown in the output
  2430.    arc from mixer M3 labeled M3:89(64,45) in the figure. As in the case
  2431.    of mixers that are not cascaded, if the resulting CSRC list has more
  2432.    than 15 identifiers, the remainder cannot be included.
  2433.  
  2434. 8.  SSRC Identifier Allocation and Use
  2435.  
  2436.    The SSRC identifier carried in the RTP header and in various fields
  2437.    of RTCP packets is a random 32-bit number that is required to be
  2438.    globally unique within an RTP session. It is crucial that the number
  2439.    be chosen with care in order that participants on the same network or
  2440.    starting at the same time are not likely to choose the same number.
  2441.  
  2442.    It is not sufficient to use the local network address (such as an
  2443.    IPv4 address) for the identifier because the address may not be
  2444.    unique. Since RTP translators and mixers enable interoperation among
  2445.    multiple networks with different address spaces, the allocation
  2446.    patterns for addresses within two spaces might result in a much
  2447.    higher rate of collision than would occur with random allocation.
  2448.  
  2449.    Multiple sources running on one host would also conflict.
  2450.  
  2451.    It is also not sufficient to obtain an SSRC identifier simply by
  2452.    calling random() without carefully initializing the state. An example
  2453.    of how to generate a random identifier is presented in Appendix A.6.
  2454.  
  2455. 8.1 Probability of Collision
  2456.  
  2457.    Since the identifiers are chosen randomly, it is possible that two or
  2458.    more sources will choose the same number. Collision occurs with the
  2459.    highest probability when all sources are started simultaneously, for
  2460.    example when triggered automatically by some session management
  2461.    event. If N is the number of sources and L the length of the
  2462.    identifier (here, 32 bits), the probability that two sources
  2463.  
  2464.  
  2465.  
  2466. Schulzrinne, et al          Standards Track                    [Page 44]
  2467.  
  2468. RFC 1889                          RTP                       January 1996
  2469.  
  2470.  
  2471.    independently pick the same value can be approximated for large N
  2472.    [20] as 1 - exp(-N**2 / 2**(L+1)). For N=1000, the probability is
  2473.    roughly 10**-4.
  2474.  
  2475.    The typical collision probability is much lower than the worst-case
  2476.    above. When one new source joins an RTP session in which all the
  2477.    other sources already have unique identifiers, the probability of
  2478.    collision is just the fraction of numbers used out of the space.
  2479.    Again, if N is the number of sources and L the length of the
  2480.    identifier, the probability of collision is N / 2**L. For N=1000, the
  2481.    probability is roughly 2*10**-7.
  2482.  
  2483.    The probability of collision is further reduced by the opportunity
  2484.    for a new source to receive packets from other participants before
  2485.    sending its first packet (either data or control). If the new source
  2486.    keeps track of the other participants (by SSRC identifier), then
  2487.    before transmitting its first packet the new source can verify that
  2488.    its identifier does not conflict with any that have been received, or
  2489.    else choose again.
  2490.  
  2491. 8.2 Collision Resolution and Loop Detection
  2492.  
  2493.    Although the probability of SSRC identifier collision is low, all RTP
  2494.    implementations must be prepared to detect collisions and take the
  2495.    appropriate actions to resolve them. If a source discovers at any
  2496.    time that another source is using the same SSRC identifier as its
  2497.    own, it must send an RTCP BYE packet for the old identifier and
  2498.    choose another random one. If a receiver discovers that two other
  2499.    sources are colliding, it may keep the packets from one and discard
  2500.    the packets from the other when this can be detected by different
  2501.    source transport addresses or CNAMEs. The two sources are expected to
  2502.    resolve the collision so that the situation doesn't last.
  2503.  
  2504.    Because the random identifiers are kept globally unique for each RTP
  2505.    session, they can also be used to detect loops that may be introduced
  2506.    by mixers or translators. A loop causes duplication of data and
  2507.    control information, either unmodified or possibly mixed, as in the
  2508.    following examples:
  2509.  
  2510.         o A translator may incorrectly forward a packet to the same
  2511.          multicast group from which it has received the packet, either
  2512.          directly or through a chain of translators. In that case, the
  2513.          same packet appears several times, originating from different
  2514.          network sources.
  2515.  
  2516.         o Two translators incorrectly set up in parallel, i.e., with the
  2517.          same multicast groups on both sides, would both forward packets
  2518.          from one multicast group to the other. Unidirectional
  2519.  
  2520.  
  2521.  
  2522. Schulzrinne, et al          Standards Track                    [Page 45]
  2523.  
  2524. RFC 1889                          RTP                       January 1996
  2525.  
  2526.  
  2527.          translators would produce two copies; bidirectional translators
  2528.          would form a loop.
  2529.  
  2530.         o A mixer can close a loop by sending to the same transport
  2531.          destination upon which it receives packets, either directly or
  2532.          through another mixer or translator. In this case a source
  2533.          might show up both as an SSRC on a data packet and a CSRC in a
  2534.          mixed data packet.
  2535.  
  2536.    A source may discover that its own packets are being looped, or that
  2537.    packets from another source are being looped (a third-party loop).
  2538.  
  2539.    Both loops and collisions in the random selection of a source
  2540.    identifier result in packets arriving with the same SSRC identifier
  2541.    but a different source transport address, which may be that of the
  2542.    end system originating the packet or an intermediate system.
  2543.    Consequently, if a source changes its source transport address, it
  2544.    must also choose a new SSRC identifier to avoid being interpreted as
  2545.    a looped source. Loops or collisions occurring on the far side of a
  2546.    translator or mixer cannot be detected using the source transport
  2547.    address if all copies of the packets go through the translator or
  2548.    mixer, however collisions may still be detected when chunks from two
  2549.    RTCP SDES packets contain the same SSRC identifier but different
  2550.    CNAMEs.
  2551.  
  2552.    To detect and resolve these conflicts, an RTP implementation must
  2553.    include an algorithm similar to the one described below. It ignores
  2554.    packets from a new source or loop that collide with an established
  2555.    source. It resolves collisions with the participant's own SSRC
  2556.    identifier by sending an RTCP BYE for the old identifier and choosing
  2557.    a new one. However, when the collision was induced by a loop of the
  2558.    participant's own packets, the algorithm will choose a new identifier
  2559.    only once and thereafter ignore packets from the looping source
  2560.    transport address. This is required to avoid a flood of BYE packets.
  2561.  
  2562.    This algorithm depends upon the source transport address being the
  2563.    same for both RTP and RTCP packets from a source. The algorithm would
  2564.    require modifications to support applications that don't meet this
  2565.    constraint.
  2566.  
  2567.    This algorithm requires keeping a table indexed by source identifiers
  2568.    and containing the source transport address from which the identifier
  2569.    was (first) received, along with other state for that source. Each
  2570.    SSRC or CSRC identifier received in a data or control packet is
  2571.    looked up in this table in order to process that data or control
  2572.    information.  For control packets, each element with its own SSRC,
  2573.    for example an SDES chunk, requires a separate lookup. (The SSRC in a
  2574.    reception report block is an exception.) If the SSRC or CSRC is not
  2575.  
  2576.  
  2577.  
  2578. Schulzrinne, et al          Standards Track                    [Page 46]
  2579.  
  2580. RFC 1889                          RTP                       January 1996
  2581.  
  2582.  
  2583.    found, a new entry is created. These table entries are removed when
  2584.    an RTCP BYE packet is received with the corresponding SSRC, or after
  2585.    no packets have arrived for a relatively long time (see Section
  2586.    6.2.1).
  2587.  
  2588.    In order to track loops of the participant's own data packets, it is
  2589.    also necessary to keep a separate list of source transport addresses
  2590.    (not identifiers) that have been found to be conflicting. Note that
  2591.    this should be a short list, usually empty. Each element in this list
  2592.    stores the source address plus the time when the most recent
  2593.    conflicting packet was received. An element may be removed from the
  2594.    list when no conflicting packet has arrived from that source for a
  2595.    time on the order of 10 RTCP report intervals (see Section 6.2).
  2596.  
  2597.    For the algorithm as shown, it is assumed that the participant's own
  2598.    source identifier and state are included in the source identifier
  2599.    table. The algorithm could be restructured to first make a separate
  2600.    comparison against the participant's own source identifier.
  2601.  
  2602.        IF the SSRC or CSRC identifier is not found in the source
  2603.           identifier table:
  2604.        THEN create a new entry storing the source transport address
  2605.             and the SSRC or CSRC along with other state.
  2606.             CONTINUE with normal processing.
  2607.  
  2608.        (identifier is found in the table)
  2609.  
  2610.        IF the source transport address from the packet matches
  2611.           the one saved in the table entry for this identifier:
  2612.        THEN CONTINUE with normal processing.
  2613.  
  2614.        (an identifier collision or a loop is indicated)
  2615.  
  2616.        IF the source identifier is not the participant's own:
  2617.        THEN IF the source identifier is from an RTCP SDES chunk
  2618.                containing a CNAME item that differs from the CNAME
  2619.                in the table entry:
  2620.             THEN (optionally) count a third-party collision.
  2621.             ELSE (optionally) count a third-party loop.
  2622.             ABORT processing of data packet or control element.
  2623.  
  2624.        (a collision or loop of the participant's own data)
  2625.  
  2626.        IF the source transport address is found in the list of
  2627.          conflicting addresses:
  2628.        THEN IF the source identifier is not from an RTCP SDES chunk
  2629.                containing a CNAME item OR if that CNAME is the
  2630.                participant's own:
  2631.  
  2632.  
  2633.  
  2634. Schulzrinne, et al          Standards Track                    [Page 47]
  2635.  
  2636. RFC 1889                          RTP                       January 1996
  2637.  
  2638.  
  2639.             THEN (optionally) count occurrence of own traffic looped.
  2640.                  mark current time in conflicting address list entry.
  2641.                  ABORT processing of data packet or control element.
  2642.        log occurrence of a collision.
  2643.        create a new entry in the conflicting address list and
  2644.        mark current time.
  2645.        send an RTCP BYE packet with the old SSRC identifier.
  2646.        choose a new identifier.
  2647.        create a new entry in the source identifier table with the
  2648.          old SSRC plus the source transport address from the packet
  2649.          being processed.
  2650.        CONTINUE with normal processing.
  2651.  
  2652.    In this algorithm, packets from a newly conflicting source address
  2653.    will be ignored and packets from the original source will be kept.
  2654.    (If the original source was through a mixer and later the same source
  2655.    is received directly, the receiver may be well advised to switch
  2656.    unless other sources in the mix would be lost.) If no packets arrive
  2657.    from the original source for an extended period, the table entry will
  2658.    be timed out and the new source will be able to take over. This might
  2659.    occur if the original source detects the collision and moves to a new
  2660.    source identifier, but in the usual case an RTCP BYE packet will be
  2661.    received from the original source to delete the state without having
  2662.    to wait for a timeout.
  2663.  
  2664.    When a new SSRC identifier is chosen due to a collision, the
  2665.    candidate identifier should first be looked up in the source
  2666.    identifier table to see if it was already in use by some other
  2667.    source. If so, another candidate should be generated and the process
  2668.    repeated.
  2669.  
  2670.    A loop of data packets to a multicast destination can cause severe
  2671.    network flooding. All mixers and translators are required to
  2672.    implement a loop detection algorithm like the one here so that they
  2673.    can break loops. This should limit the excess traffic to no more than
  2674.    one duplicate copy of the original traffic, which may allow the
  2675.    session to continue so that the cause of the loop can be found and
  2676.    fixed. However, in extreme cases where a mixer or translator does not
  2677.    properly break the loop and high traffic levels result, it may be
  2678.    necessary for end systems to cease transmitting data or control
  2679.    packets entirely. This decision may depend upon the application. An
  2680.    error condition should be indicated as appropriate. Transmission
  2681.    might be attempted again periodically after a long, random time (on
  2682.    the order of minutes).
  2683.  
  2684.  
  2685.  
  2686.  
  2687.  
  2688.  
  2689.  
  2690. Schulzrinne, et al          Standards Track                    [Page 48]
  2691.  
  2692. RFC 1889                          RTP                       January 1996
  2693.  
  2694.  
  2695. 9.  Security
  2696.  
  2697.    Lower layer protocols may eventually provide all the security
  2698.    services that may be desired for applications of RTP, including
  2699.    authentication, integrity, and confidentiality. These services  have
  2700.    recently been specified for IP. Since the need for a confidentiality
  2701.    service is well established in the initial audio and video
  2702.    applications that are expected to use RTP, a confidentiality service
  2703.    is defined in the next section for use with RTP and RTCP until lower
  2704.    layer services are available. The overhead on the protocol for this
  2705.    service is low, so the penalty will be minimal if this service is
  2706.    obsoleted by lower layer services in the future.
  2707.  
  2708.    Alternatively, other services, other implementations of services and
  2709.    other algorithms may be defined for RTP in the future if warranted.
  2710.    The selection presented here is meant to simplify implementation of
  2711.    interoperable, secure applications and provide guidance to
  2712.    implementors. No claim is made that the methods presented here are
  2713.    appropriate for a particular security need. A profile may specify
  2714.    which services and algorithms should be offered by applications, and
  2715.    may provide guidance as to their appropriate use.
  2716.  
  2717.    Key distribution and certificates are outside the scope of this
  2718.    document.
  2719.  
  2720. 9.1 Confidentiality
  2721.  
  2722.    Confidentiality means that only the intended receiver(s) can decode
  2723.    the received packets; for others, the packet contains no useful
  2724.    information. Confidentiality of the content is achieved by
  2725.    encryption.
  2726.  
  2727.    When encryption of RTP or RTCP is desired, all the octets that will
  2728.    be encapsulated for transmission in a single lower-layer packet are
  2729.    encrypted as a unit. For RTCP, a 32-bit random number is prepended to
  2730.    the unit before encryption to deter known plaintext attacks. For RTP,
  2731.    no prefix is required because the sequence number and timestamp
  2732.    fields are initialized with random offsets.
  2733.  
  2734.    For RTCP, it is allowed to split a compound RTCP packet into two
  2735.    lower-layer packets, one to be encrypted and one to be sent in the
  2736.    clear. For example, SDES information might be encrypted while
  2737.    reception reports were sent in the clear to accommodate third-party
  2738.    monitors that are not privy to the encryption key. In this example,
  2739.    depicted in Fig. 4, the SDES information must be appended to an RR
  2740.    packet with no reports (and the encrypted) to satisfy the requirement
  2741.    that all compound RTCP packets begin with an SR or RR packet.
  2742.  
  2743.  
  2744.  
  2745.  
  2746. Schulzrinne, et al          Standards Track                    [Page 49]
  2747.  
  2748. RFC 1889                          RTP                       January 1996
  2749.  
  2750.  
  2751.                  UDP packet                        UDP packet
  2752.    -------------------------------------  -------------------------
  2753.    [32-bit ][       ][     #           ]  [    # sender # receiver]
  2754.    [random ][  RR   ][SDES # CNAME, ...]  [ SR # report # report  ]
  2755.    [integer][(empty)][     #           ]  [    #        #         ]
  2756.    -------------------------------------  -------------------------
  2757.                  encrypted                       not encrypted
  2758.  
  2759.    #: SSRC
  2760.  
  2761.            Figure 4: Encrypted and non-encrypted RTCP packets
  2762.  
  2763.    The presence of encryption and the use of the correct key are
  2764.    confirmed by the receiver through header or payload validity checks.
  2765.    Examples of such validity checks for RTP and RTCP headers are given
  2766.    in Appendices A.1 and A.2.
  2767.  
  2768.    The default encryption algorithm is the Data Encryption Standard
  2769.    (DES) algorithm in cipher block chaining (CBC) mode, as described in
  2770.    Section 1.1 of RFC 1423 [21], except that padding to a multiple of 8
  2771.    octets is indicated as described for the P bit in Section 5.1. The
  2772.    initialization vector is zero because random values are supplied in
  2773.    the RTP header or by the random prefix for compound RTCP packets. For
  2774.    details on the use of CBC initialization vectors, see [22].
  2775.    Implementations that support encryption should always support the DES
  2776.    algorithm in CBC mode as the default to maximize interoperability.
  2777.    This method is chosen because it has been demonstrated to be easy and
  2778.    practical to use in experimental audio and video tools in operation
  2779.    on the Internet. Other encryption algorithms may be specified
  2780.    dynamically for a session by non-RTP means.
  2781.  
  2782.    As an alternative to encryption at the RTP level as described above,
  2783.    profiles may define additional payload types for encrypted encodings.
  2784.    Those encodings must specify how padding and other aspects of the
  2785.    encryption should be handled. This method allows encrypting only the
  2786.    data while leaving the headers in the clear for applications where
  2787.    that is desired. It may be particularly useful for hardware devices
  2788.    that will handle both decryption and decoding.
  2789.  
  2790. 9.2 Authentication and Message Integrity
  2791.  
  2792.    Authentication and message integrity are not defined in the current
  2793.    specification of RTP since these services would not be directly
  2794.    feasible without a key management infrastructure. It is expected that
  2795.    authentication and integrity services will be provided by lower layer
  2796.    protocols in the future.
  2797.  
  2798.  
  2799.  
  2800.  
  2801.  
  2802. Schulzrinne, et al          Standards Track                    [Page 50]
  2803.  
  2804. RFC 1889                          RTP                       January 1996
  2805.  
  2806.  
  2807. 10.  RTP over Network and Transport Protocols
  2808.  
  2809.    This section describes issues specific to carrying RTP packets within
  2810.    particular network and transport protocols. The following rules apply
  2811.    unless superseded by protocol-specific definitions outside this
  2812.    specification.
  2813.  
  2814.    RTP relies on the underlying protocol(s) to provide demultiplexing of
  2815.    RTP data and RTCP control streams. For UDP and similar protocols, RTP
  2816.    uses an even port number and the corresponding RTCP stream uses the
  2817.    next higher (odd) port number. If an application is supplied with an
  2818.    odd number for use as the RTP port, it should replace this number
  2819.    with the next lower (even) number.
  2820.  
  2821.    RTP data packets contain no length field or other delineation,
  2822.    therefore RTP relies on the underlying protocol(s) to provide a
  2823.    length indication. The maximum length of RTP packets is limited only
  2824.    by the underlying protocols.
  2825.  
  2826.    If RTP packets are to be carried in an underlying protocol that
  2827.    provides the abstraction of a continuous octet stream rather than
  2828.    messages (packets), an encapsulation of the RTP packets must be
  2829.    defined to provide a framing mechanism. Framing is also needed if the
  2830.    underlying protocol may contain padding so that the extent of the RTP
  2831.    payload cannot be determined. The framing mechanism is not defined
  2832.    here.
  2833.  
  2834.    A profile may specify a framing method to be used even when RTP is
  2835.    carried in protocols that do provide framing in order to allow
  2836.    carrying several RTP packets in one lower-layer protocol data unit,
  2837.    such as a UDP packet. Carrying several RTP packets in one network or
  2838.    transport packet reduces header overhead and may simplify
  2839.    synchronization between different streams.
  2840.  
  2841. 11.  Summary of Protocol Constants
  2842.  
  2843.    This section contains a summary listing of the constants defined in
  2844.    this specification.
  2845.  
  2846.    The RTP payload type (PT) constants are defined in profiles rather
  2847.    than this document. However, the octet of the RTP header which
  2848.    contains the marker bit(s) and payload type must avoid the reserved
  2849.    values 200 and 201 (decimal) to distinguish RTP packets from the RTCP
  2850.    SR and RR packet types for the header validation procedure described
  2851.    in Appendix A.1. For the standard definition of one marker bit and a
  2852.    7-bit payload type field as shown in this specification, this
  2853.    restriction means that payload types 72 and 73 are reserved.
  2854.  
  2855.  
  2856.  
  2857.  
  2858. Schulzrinne, et al          Standards Track                    [Page 51]
  2859.  
  2860. RFC 1889                          RTP                       January 1996
  2861.  
  2862.  
  2863. 11.1 RTCP packet types
  2864.  
  2865.    abbrev.    name                   value
  2866.    SR         sender report            200
  2867.    RR         receiver report          201
  2868.    SDES       source description       202
  2869.    BYE        goodbye                  203
  2870.    APP        application-defined      204
  2871.  
  2872.    These type values were chosen in the range 200-204 for improved
  2873.    header validity checking of RTCP packets compared to RTP packets or
  2874.    other unrelated packets. When the RTCP packet type field is compared
  2875.    to the corresponding octet of the RTP header, this range corresponds
  2876.    to the marker bit being 1 (which it usually is not in data packets)
  2877.    and to the high bit of the standard payload type field being 1 (since
  2878.    the static payload types are typically defined in the low half). This
  2879.    range was also chosen to be some distance numerically from 0 and 255
  2880.    since all-zeros and all-ones are common data patterns.
  2881.  
  2882.    Since all compound RTCP packets must begin with SR or RR, these codes
  2883.    were chosen as an even/odd pair to allow the RTCP validity check to
  2884.    test the maximum number of bits with mask and value.
  2885.  
  2886.    Other constants are assigned by IANA. Experimenters are encouraged to
  2887.    register the numbers they need for experiments, and then unregister
  2888.    those which prove to be unneeded.
  2889.  
  2890. 11.2 SDES types
  2891.  
  2892.    abbrev.    name                              value
  2893.    END        end of SDES list                      0
  2894.    CNAME      canonical name                        1
  2895.    NAME       user name                             2
  2896.    EMAIL      user's electronic mail address        3
  2897.    PHONE      user's phone number                   4
  2898.    LOC        geographic user location              5
  2899.    TOOL       name of application or tool           6
  2900.    NOTE       notice about the source               7
  2901.    PRIV       private extensions                    8
  2902.  
  2903.    Other constants are assigned by IANA. Experimenters are encouraged to
  2904.    register the numbers they need for experiments, and then unregister
  2905.    those which prove to be unneeded.
  2906.  
  2907.  
  2908.  
  2909.  
  2910.  
  2911.  
  2912.  
  2913.  
  2914. Schulzrinne, et al          Standards Track                    [Page 52]
  2915.  
  2916. RFC 1889                          RTP                       January 1996
  2917.  
  2918.  
  2919. 12.  RTP Profiles and Payload Format Specifications
  2920.  
  2921.    A complete specification of RTP for a particular application will
  2922.    require one or more companion documents of two types described here:
  2923.    profiles, and payload format specifications.
  2924.  
  2925.    RTP may be used for a variety of applications with somewhat differing
  2926.    requirements. The flexibility to adapt to those requirements is
  2927.    provided by allowing multiple choices in the main protocol
  2928.    specification, then selecting the appropriate choices or defining
  2929.    extensions for a particular environment and class of applications in
  2930.    a separate profile document. Typically an application will operate
  2931.    under only one profile so there is no explicit indication of which
  2932.    profile is in use. A profile for audio and video applications may be
  2933.    found in the companion Internet-Draft draft-ietf-avt-profile for
  2934.  
  2935.    The second type of companion document is a payload format
  2936.    specification, which defines how a particular kind of payload data,
  2937.    such as H.261 encoded video, should be carried in RTP. These
  2938.    documents are typically titled "RTP Payload Format for XYZ
  2939.    Audio/Video Encoding". Payload formats may be useful under multiple
  2940.    profiles and may therefore be defined independently of any particular
  2941.    profile. The profile documents are then responsible for assigning a
  2942.    default mapping of that format to a payload type value if needed.
  2943.  
  2944.    Within this specification, the following items have been identified
  2945.    for possible definition within a profile, but this list is not meant
  2946.    to be exhaustive:
  2947.  
  2948.    RTP data header: The octet in the RTP data header that contains the
  2949.         marker bit and payload type field may be redefined by a profile
  2950.         to suit different requirements, for example with more or fewer
  2951.         marker bits (Section 5.3).
  2952.  
  2953.    Payload types: Assuming that a payload type field is included, the
  2954.         profile will usually define a set of payload formats (e.g.,
  2955.         media encodings) and a default static mapping of those formats
  2956.         to payload type values. Some of the payload formats may be
  2957.         defined by reference to separate payload format specifications.
  2958.         For each payload type defined, the profile must specify the RTP
  2959.         timestamp clock rate to be used (Section 5.1).
  2960.  
  2961.    RTP data header additions: Additional fields may be appended to the
  2962.         fixed RTP data header if some additional functionality is
  2963.         required across the profile's class of applications independent
  2964.         of payload type (Section 5.3).
  2965.  
  2966.  
  2967.  
  2968.  
  2969.  
  2970. Schulzrinne, et al          Standards Track                    [Page 53]
  2971.  
  2972. RFC 1889                          RTP                       January 1996
  2973.  
  2974.  
  2975.    RTP data header extensions: The contents of the first 16 bits of the
  2976.         RTP data header extension structure must be defined if use of
  2977.         that mechanism is to be allowed under the profile for
  2978.         implementation-specific extensions (Section 5.3.1).
  2979.  
  2980.    RTCP packet types: New application-class-specific RTCP packet types
  2981.         may be defined and registered with IANA.
  2982.  
  2983.    RTCP report interval: A profile should specify that the values
  2984.         suggested in Section 6.2 for the constants employed in the
  2985.         calculation of the RTCP report interval will be used.  Those are
  2986.         the RTCP fraction of session bandwidth, the minimum report
  2987.         interval, and the bandwidth split between senders and receivers.
  2988.         A profile may specify alternate values if they have been
  2989.         demonstrated to work in a scalable manner.
  2990.  
  2991.    SR/RR extension: An extension section may be defined for the RTCP SR
  2992.         and RR packets if there is additional information that should be
  2993.         reported regularly about the sender or receivers (Section 6.3.3).
  2994.  
  2995.    SDES use: The profile may specify the relative priorities for RTCP
  2996.         SDES items to be transmitted or excluded entirely (Section
  2997.         6.2.2); an alternate syntax or semantics for the CNAME item
  2998.         (Section 6.4.1); the format of the LOC item (Section 6.4.5); the
  2999.         semantics and use of the NOTE item (Section 6.4.7); or new SDES
  3000.         item types to be registered with IANA.
  3001.  
  3002.    Security: A profile may specify which security services and
  3003.         algorithms should be offered by applications, and may provide
  3004.         guidance as to their appropriate use (Section 9).
  3005.  
  3006.    String-to-key mapping: A profile may specify how a user-provided
  3007.         password or pass phrase is mapped into an encryption key.
  3008.  
  3009.    Underlying protocol: Use of a particular underlying network or
  3010.         transport layer protocol to carry RTP packets may be required.
  3011.  
  3012.    Transport mapping: A mapping of RTP and RTCP to transport-level
  3013.         addresses, e.g., UDP ports, other than the standard mapping
  3014.         defined in Section 10 may be specified.
  3015.  
  3016.    Encapsulation: An encapsulation of RTP packets may be defined to
  3017.         allow multiple RTP data packets to be carried in one lower-layer
  3018.         packet or to provide framing over underlying protocols that do
  3019.         not already do so (Section 10).
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026. Schulzrinne, et al          Standards Track                    [Page 54]
  3027.  
  3028. RFC 1889                          RTP                       January 1996
  3029.  
  3030.  
  3031.    It is not expected that a new profile will be required for every
  3032.    application. Within one application class, it would be better to
  3033.    extend an existing profile rather than make a new one in order to
  3034.    facilitate interoperation among the applications since each will
  3035.    typically run under only one profile. Simple extensions such as the
  3036.    definition of additional payload type values or RTCP packet types may
  3037.    be accomplished by registering them through the Internet Assigned
  3038.    Numbers Authority and publishing their descriptions in an addendum to
  3039.    the profile or in a payload format specification.
  3040.  
  3041.  
  3042.  
  3043.  
  3044.  
  3045.  
  3046.  
  3047.  
  3048.  
  3049.  
  3050.  
  3051.  
  3052.  
  3053.  
  3054.  
  3055.  
  3056.  
  3057.  
  3058.  
  3059.  
  3060.  
  3061.  
  3062.  
  3063.  
  3064.  
  3065.  
  3066.  
  3067.  
  3068.  
  3069.  
  3070.  
  3071.  
  3072.  
  3073.  
  3074.  
  3075.  
  3076.  
  3077.  
  3078.  
  3079.  
  3080.  
  3081.  
  3082. Schulzrinne, et al          Standards Track                    [Page 55]
  3083.  
  3084. RFC 1889                          RTP                       January 1996
  3085.  
  3086.  
  3087. A.  Algorithms
  3088.  
  3089.    We provide examples of C code for aspects of RTP sender and receiver
  3090.    algorithms. There may be other implementation methods that are faster
  3091.    in particular operating environments or have other advantages. These
  3092.    implementation notes are for informational purposes only and are
  3093.    meant to clarify the RTP specification.
  3094.  
  3095.    The following definitions are used for all examples; for clarity and
  3096.    brevity, the structure definitions are only valid for 32-bit big-
  3097.    endian (most significant octet first) architectures. Bit fields are
  3098.    assumed to be packed tightly in big-endian bit order, with no
  3099.    additional padding. Modifications would be required to construct a
  3100.    portable implementation.
  3101.  
  3102.    /*
  3103.     * rtp.h  --  RTP header file (RFC XXXX)
  3104.     */
  3105.    #include <sys/types.h>
  3106.  
  3107.    /*
  3108.     * The type definitions below are valid for 32-bit architectures and
  3109.     * may have to be adjusted for 16- or 64-bit architectures.
  3110.     */
  3111.    typedef unsigned char  u_int8;
  3112.    typedef unsigned short u_int16;
  3113.    typedef unsigned int   u_int32;
  3114.    typedef          short int16;
  3115.  
  3116.    /*
  3117.     * Current protocol version.
  3118.     */
  3119.    #define RTP_VERSION    2
  3120.  
  3121.    #define RTP_SEQ_MOD (1<<16)
  3122.    #define RTP_MAX_SDES 255      /* maximum text length for SDES */
  3123.  
  3124.    typedef enum {
  3125.        RTCP_SR   = 200,
  3126.        RTCP_RR   = 201,
  3127.        RTCP_SDES = 202,
  3128.        RTCP_BYE  = 203,
  3129.        RTCP_APP  = 204
  3130.    } rtcp_type_t;
  3131.  
  3132.    typedef enum {
  3133.        RTCP_SDES_END   = 0,
  3134.        RTCP_SDES_CNAME = 1,
  3135.  
  3136.  
  3137.  
  3138. Schulzrinne, et al          Standards Track                    [Page 56]
  3139.  
  3140. RFC 1889                          RTP                       January 1996
  3141.  
  3142.  
  3143.        RTCP_SDES_NAME  = 2,
  3144.        RTCP_SDES_EMAIL = 3,
  3145.        RTCP_SDES_PHONE = 4,
  3146.        RTCP_SDES_LOC   = 5,
  3147.        RTCP_SDES_TOOL  = 6,
  3148.        RTCP_SDES_NOTE  = 7,
  3149.        RTCP_SDES_PRIV  = 8
  3150.    } rtcp_sdes_type_t;
  3151.  
  3152.    /*
  3153.     * RTP data header
  3154.     */
  3155.    typedef struct {
  3156.        unsigned int version:2;   /* protocol version */
  3157.        unsigned int p:1;         /* padding flag */
  3158.        unsigned int x:1;         /* header extension flag */
  3159.        unsigned int cc:4;        /* CSRC count */
  3160.        unsigned int m:1;         /* marker bit */
  3161.        unsigned int pt:7;        /* payload type */
  3162.        u_int16 seq;              /* sequence number */
  3163.        u_int32 ts;               /* timestamp */
  3164.        u_int32 ssrc;             /* synchronization source */
  3165.        u_int32 csrc[1];          /* optional CSRC list */
  3166.    } rtp_hdr_t;
  3167.  
  3168.    /*
  3169.     * RTCP common header word
  3170.     */
  3171.    typedef struct {
  3172.        unsigned int version:2;   /* protocol version */
  3173.        unsigned int p:1;         /* padding flag */
  3174.        unsigned int count:5;     /* varies by packet type */
  3175.        unsigned int pt:8;        /* RTCP packet type */
  3176.        u_int16 length;           /* pkt len in words, w/o this word */
  3177.    } rtcp_common_t;
  3178.  
  3179.    /*
  3180.     * Big-endian mask for version, padding bit and packet type pair
  3181.     */
  3182.    #define RTCP_VALID_MASK (0xc000 | 0x2000 | 0xfe)
  3183.    #define RTCP_VALID_VALUE ((RTP_VERSION << 14) | RTCP_SR)
  3184.  
  3185.    /*
  3186.     * Reception report block
  3187.     */
  3188.    typedef struct {
  3189.        u_int32 ssrc;             /* data source being reported */
  3190.        unsigned int fraction:8;  /* fraction lost since last SR/RR */
  3191.  
  3192.  
  3193.  
  3194. Schulzrinne, et al          Standards Track                    [Page 57]
  3195.  
  3196. RFC 1889                          RTP                       January 1996
  3197.  
  3198.  
  3199.        int lost:24;              /* cumul. no. pkts lost (signed!) */
  3200.        u_int32 last_seq;         /* extended last seq. no. received */
  3201.        u_int32 jitter;           /* interarrival jitter */
  3202.        u_int32 lsr;              /* last SR packet from this source */
  3203.        u_int32 dlsr;             /* delay since last SR packet */
  3204.    } rtcp_rr_t;
  3205.  
  3206.    /*
  3207.     * SDES item
  3208.     */
  3209.    typedef struct {
  3210.        u_int8 type;              /* type of item (rtcp_sdes_type_t) */
  3211.        u_int8 length;            /* length of item (in octets) */
  3212.        char data[1];             /* text, not null-terminated */
  3213.    } rtcp_sdes_item_t;
  3214.  
  3215.    /*
  3216.     * One RTCP packet
  3217.     */
  3218.    typedef struct {
  3219.        rtcp_common_t common;     /* common header */
  3220.        union {
  3221.            /* sender report (SR) */
  3222.            struct {
  3223.                u_int32 ssrc;     /* sender generating this report */
  3224.                u_int32 ntp_sec;  /* NTP timestamp */
  3225.                u_int32 ntp_frac;
  3226.                u_int32 rtp_ts;   /* RTP timestamp */
  3227.                u_int32 psent;    /* packets sent */
  3228.                u_int32 osent;    /* octets sent */
  3229.                rtcp_rr_t rr[1];  /* variable-length list */
  3230.            } sr;
  3231.  
  3232.            /* reception report (RR) */
  3233.            struct {
  3234.                u_int32 ssrc;     /* receiver generating this report */
  3235.                rtcp_rr_t rr[1];  /* variable-length list */
  3236.            } rr;
  3237.  
  3238.            /* source description (SDES) */
  3239.            struct rtcp_sdes {
  3240.                u_int32 src;      /* first SSRC/CSRC */
  3241.                rtcp_sdes_item_t item[1]; /* list of SDES items */
  3242.            } sdes;
  3243.  
  3244.            /* BYE */
  3245.            struct {
  3246.                u_int32 src[1];   /* list of sources */
  3247.  
  3248.  
  3249.  
  3250. Schulzrinne, et al          Standards Track                    [Page 58]
  3251.  
  3252. RFC 1889                          RTP                       January 1996
  3253.  
  3254.  
  3255.                /* can't express trailing text for reason */
  3256.            } bye;
  3257.        } r;
  3258.    } rtcp_t;
  3259.  
  3260.    typedef struct rtcp_sdes rtcp_sdes_t;
  3261.  
  3262.    /*
  3263.     * Per-source state information
  3264.     */
  3265.    typedef struct {
  3266.        u_int16 max_seq;        /* highest seq. number seen */
  3267.        u_int32 cycles;         /* shifted count of seq. number cycles */
  3268.        u_int32 base_seq;       /* base seq number */
  3269.        u_int32 bad_seq;        /* last 'bad' seq number + 1 */
  3270.        u_int32 probation;      /* sequ. packets till source is valid */
  3271.        u_int32 received;       /* packets received */
  3272.        u_int32 expected_prior; /* packet expected at last interval */
  3273.        u_int32 received_prior; /* packet received at last interval */
  3274.        u_int32 transit;        /* relative trans time for prev pkt */
  3275.        u_int32 jitter;         /* estimated jitter */
  3276.        /* ... */
  3277.    } source;
  3278.  
  3279. A.1 RTP Data Header Validity Checks
  3280.  
  3281.    An RTP receiver should check the validity of the RTP header on
  3282.    incoming packets since they might be encrypted or might be from a
  3283.    different application that happens to be misaddressed. Similarly, if
  3284.    encryption is enabled, the header validity check is needed to verify
  3285.    that incoming packets have been correctly decrypted, although a
  3286.    failure of the header validity check (e.g., unknown payload type) may
  3287.    not necessarily indicate decryption failure.
  3288.  
  3289.    Only weak validity checks are possible on an RTP data packet from a
  3290.    source that has not been heard before:
  3291.  
  3292.         o RTP version field must equal 2.
  3293.  
  3294.         o The payload type must be known, in particular it must not be
  3295.          equal to SR or RR.
  3296.  
  3297.         o If the P bit is set, then the last octet of the packet must
  3298.          contain a valid octet count, in particular, less than the total
  3299.          packet length minus the header size.
  3300.  
  3301.         o The X bit must be zero if the profile does not specify that
  3302.          the header extension mechanism may be used. Otherwise, the
  3303.  
  3304.  
  3305.  
  3306. Schulzrinne, et al          Standards Track                    [Page 59]
  3307.  
  3308. RFC 1889                          RTP                       January 1996
  3309.  
  3310.  
  3311.          extension length field must be less than the total packet size
  3312.          minus the fixed header length and padding.
  3313.  
  3314.         o The length of the packet must be consistent with CC and
  3315.          payload type (if payloads have a known length).
  3316.  
  3317.    The last three checks are somewhat complex and not always possible,
  3318.    leaving only the first two which total just a few bits. If the SSRC
  3319.    identifier in the packet is one that has been received before, then
  3320.    the packet is probably valid and checking if the sequence number is
  3321.    in the expected range provides further validation. If the SSRC
  3322.    identifier has not been seen before, then data packets carrying that
  3323.    identifier may be considered invalid until a small number of them
  3324.    arrive with consecutive sequence numbers.
  3325.  
  3326.    The routine update_seq shown below ensures that a source is declared
  3327.    valid only after MIN_SEQUENTIAL packets have been received in
  3328.    sequence. It also validates the sequence number seq of a newly
  3329.    received packet and updates the sequence state for the packet's
  3330.    source in the structure to which s points.
  3331.  
  3332.    When a new source is heard for the first time, that is, its SSRC
  3333.    identifier is not in the table (see Section 8.2), and the per-source
  3334.    state is allocated for it, s->probation should be set to the number
  3335.    of sequential packets required before declaring a source valid
  3336.    (parameter MIN_SEQUENTIAL ) and s->max_seq initialized to seq-1 s-
  3337.    >probation marks the source as not yet valid so the state may be
  3338.    discarded after a short timeout rather than a long one, as discussed
  3339.    in Section 6.2.1.
  3340.  
  3341.    After a source is considered valid, the sequence number is considered
  3342.    valid if it is no more than MAX_DROPOUT ahead of s->max_seq nor more
  3343.    than MAX_MISORDER behind. If the new sequence number is ahead of
  3344.    max_seq modulo the RTP sequence number range (16 bits), but is
  3345.    smaller than max_seq , it has wrapped around and the (shifted) count
  3346.    of sequence number cycles is incremented. A value of one is returned
  3347.    to indicate a valid sequence number.
  3348.  
  3349.    Otherwise, the value zero is returned to indicate that the validation
  3350.    failed, and the bad sequence number is stored. If the next packet
  3351.    received carries the next higher sequence number, it is considered
  3352.    the valid start of a new packet sequence presumably caused by an
  3353.    extended dropout or a source restart. Since multiple complete
  3354.    sequence number cycles may have been missed, the packet loss
  3355.    statistics are reset.
  3356.  
  3357.    Typical values for the parameters are shown, based on a maximum
  3358.    misordering time of 2 seconds at 50 packets/second and a maximum
  3359.  
  3360.  
  3361.  
  3362. Schulzrinne, et al          Standards Track                    [Page 60]
  3363.  
  3364. RFC 1889                          RTP                       January 1996
  3365.  
  3366.  
  3367.    dropout of 1 minute. The dropout parameter MAX_DROPOUT should be a
  3368.    small fraction of the 16-bit sequence number space to give a
  3369.    reasonable probability that new sequence numbers after a restart will
  3370.    not fall in the acceptable range for sequence numbers from before the
  3371.    restart.
  3372.  
  3373.    void init_seq(source *s, u_int16 seq)
  3374.    {
  3375.        s->base_seq = seq - 1;
  3376.        s->max_seq = seq;
  3377.        s->bad_seq = RTP_SEQ_MOD + 1;
  3378.        s->cycles = 0;
  3379.        s->received = 0;
  3380.        s->received_prior = 0;
  3381.        s->expected_prior = 0;
  3382.        /* other initialization */
  3383.    }
  3384.  
  3385.    int update_seq(source *s, u_int16 seq)
  3386.    {
  3387.        u_int16 udelta = seq - s->max_seq;
  3388.        const int MAX_DROPOUT = 3000;
  3389.        const int MAX_MISORDER = 100;
  3390.        const int MIN_SEQUENTIAL = 2;
  3391.  
  3392.        /*
  3393.         * Source is not valid until MIN_SEQUENTIAL packets with
  3394.         * sequential sequence numbers have been received.
  3395.         */
  3396.        if (s->probation) {
  3397.            /* packet is in sequence */
  3398.            if (seq == s->max_seq + 1) {
  3399.                s->probation--;
  3400.                s->max_seq = seq;
  3401.                if (s->probation == 0) {
  3402.                    init_seq(s, seq);
  3403.                    s->received++;
  3404.                    return 1;
  3405.                }
  3406.            } else {
  3407.                s->probation = MIN_SEQUENTIAL - 1;
  3408.                s->max_seq = seq;
  3409.            }
  3410.            return 0;
  3411.        } else if (udelta < MAX_DROPOUT) {
  3412.            /* in order, with permissible gap */
  3413.            if (seq < s->max_seq) {
  3414.                /*
  3415.  
  3416.  
  3417.  
  3418. Schulzrinne, et al          Standards Track                    [Page 61]
  3419.  
  3420. RFC 1889                          RTP                       January 1996
  3421.  
  3422.  
  3423.                 * Sequence number wrapped - count another 64K cycle.
  3424.                 */
  3425.                s->cycles += RTP_SEQ_MOD;
  3426.            }
  3427.            s->max_seq = seq;
  3428.        } else if (udelta <= RTP_SEQ_MOD - MAX_MISORDER) {
  3429.            /* the sequence number made a very large jump */
  3430.            if (seq == s->bad_seq) {
  3431.                /*
  3432.                 * Two sequential packets -- assume that the other side
  3433.                 * restarted without telling us so just re-sync
  3434.                 * (i.e., pretend this was the first packet).
  3435.                 */
  3436.                init_seq(s, seq);
  3437.            }
  3438.            else {
  3439.                s->bad_seq = (seq + 1) & (RTP_SEQ_MOD-1);
  3440.                return 0;
  3441.            }
  3442.        } else {
  3443.            /* duplicate or reordered packet */
  3444.        }
  3445.        s->received++;
  3446.        return 1;
  3447.    }
  3448.  
  3449.    The validity check can be made stronger requiring more than two
  3450.    packets in sequence.  The disadvantages are that a larger number of
  3451.    initial packets will be discarded and that high packet loss rates
  3452.    could prevent validation. However, because the RTCP header validation
  3453.    is relatively strong, if an RTCP packet is received from a source
  3454.    before the data packets, the count could be adjusted so that only two
  3455.    packets are required in sequence.  If initial data loss for a few
  3456.    seconds can be tolerated, an application could choose to discard all
  3457.    data packets from a source until a valid RTCP packet has been
  3458.    received from that source.
  3459.  
  3460.    Depending on the application and encoding, algorithms may exploit
  3461.    additional knowledge about the payload format for further validation.
  3462.    For payload types where the timestamp increment is the same for all
  3463.    packets, the timestamp values can be predicted from the previous
  3464.    packet received from the same source using the sequence number
  3465.    difference (assuming no change in payload type).
  3466.  
  3467.    A strong "fast-path" check is possible since with high probability
  3468.    the first four octets in the header of a newly received RTP data
  3469.    packet will be just the same as that of the previous packet from the
  3470.    same SSRC except that the sequence number will have increased by one.
  3471.  
  3472.  
  3473.  
  3474. Schulzrinne, et al          Standards Track                    [Page 62]
  3475.  
  3476. RFC 1889                          RTP                       January 1996
  3477.  
  3478.  
  3479.    Similarly, a single-entry cache may be used for faster SSRC lookups
  3480.    in applications where data is typically received from one source at a
  3481.    time.
  3482.  
  3483. A.2 RTCP Header Validity Checks
  3484.  
  3485.    The following checks can be applied to RTCP packets.
  3486.  
  3487.         o RTP version field must equal 2.
  3488.  
  3489.         o The payload type field of the first RTCP packet in a compound
  3490.          packet must be equal to SR or RR.
  3491.  
  3492.         o The padding bit (P) should be zero for the first packet of a
  3493.          compound RTCP packet because only the last should possibly need
  3494.          padding.
  3495.  
  3496.         o The length fields of the individual RTCP packets must total to
  3497.          the overall length of the compound RTCP packet as received.
  3498.          This is a fairly strong check.
  3499.  
  3500.    The code fragment below performs all of these checks. The packet type
  3501.    is not checked for subsequent packets since unknown packet types may
  3502.    be present and should be ignored.
  3503.  
  3504.        u_int32 len;        /* length of compound RTCP packet in words */
  3505.        rtcp_t *r;          /* RTCP header */
  3506.        rtcp_t *end;        /* end of compound RTCP packet */
  3507.  
  3508.        if ((*(u_int16 *)r & RTCP_VALID_MASK) != RTCP_VALID_VALUE) {
  3509.            /* something wrong with packet format */
  3510.        }
  3511.        end = (rtcp_t *)((u_int32 *)r + len);
  3512.  
  3513.        do r = (rtcp_t *)((u_int32 *)r + r->common.length + 1);
  3514.        while (r < end && r->common.version == 2);
  3515.  
  3516.        if (r != end) {
  3517.            /* something wrong with packet format */
  3518.        }
  3519.  
  3520. A.3 Determining the Number of RTP Packets Expected and Lost
  3521.  
  3522.    In order to compute packet loss rates, the number of packets expected
  3523.    and actually received from each source needs to be known, using per-
  3524.    source state information defined in struct source referenced via
  3525.    pointer s in the code below. The number of packets received is simply
  3526.    the count of packets as they arrive, including any late or duplicate
  3527.  
  3528.  
  3529.  
  3530. Schulzrinne, et al          Standards Track                    [Page 63]
  3531.  
  3532. RFC 1889                          RTP                       January 1996
  3533.  
  3534.  
  3535.    packets. The number of packets expected can be computed by the
  3536.    receiver as the difference between the highest sequence number
  3537.    received ( s->max_seq ) and the first sequence number received ( s-
  3538.    >base_seq ). Since the sequence number is only 16 bits and will wrap
  3539.    around, it is necessary to extend the highest sequence number with
  3540.    the (shifted) count of sequence number wraparounds ( s->cycles ).
  3541.    Both the received packet count and the count of cycles are maintained
  3542.    the RTP header validity check routine in Appendix A.1.
  3543.  
  3544.        extended_max = s->cycles + s->max_seq;
  3545.        expected = extended_max - s->base_seq + 1;
  3546.  
  3547.    The number of packets lost is defined to be the number of packets
  3548.    expected less the number of packets actually received:
  3549.  
  3550.        lost = expected - s->received;
  3551.  
  3552.    Since this number is carried in 24 bits, it should be clamped at
  3553.    0xffffff rather than wrap around to zero.
  3554.  
  3555.    The fraction of packets lost during the last reporting interval
  3556.    (since the previous SR or RR packet was sent) is calculated from
  3557.    differences in the expected and received packet counts across the
  3558.    interval, where expected_prior and received_prior are the values
  3559.    saved when the previous reception report was generated:
  3560.  
  3561.        expected_interval = expected - s->expected_prior;
  3562.        s->expected_prior = expected;
  3563.        received_interval = s->received - s->received_prior;
  3564.        s->received_prior = s->received;
  3565.        lost_interval = expected_interval - received_interval;
  3566.        if (expected_interval == 0 || lost_interval <= 0) fraction = 0;
  3567.        else fraction = (lost_interval << 8) / expected_interval;
  3568.  
  3569.    The resulting fraction is an 8-bit fixed point number with the binary
  3570.    point at the left edge.
  3571.  
  3572. A.4 Generating SDES RTCP Packets
  3573.  
  3574.    This function builds one SDES chunk into buffer b composed of argc
  3575.    items supplied in arrays type , value and length b
  3576.  
  3577.    char *rtp_write_sdes(char *b, u_int32 src, int argc,
  3578.                         rtcp_sdes_type_t type[], char *value[],
  3579.                         int length[])
  3580.    {
  3581.        rtcp_sdes_t *s = (rtcp_sdes_t *)b;
  3582.        rtcp_sdes_item_t *rsp;
  3583.  
  3584.  
  3585.  
  3586. Schulzrinne, et al          Standards Track                    [Page 64]
  3587.  
  3588. RFC 1889                          RTP                       January 1996
  3589.  
  3590.  
  3591.        int i;
  3592.        int len;
  3593.        int pad;
  3594.  
  3595.        /* SSRC header */
  3596.        s->src = src;
  3597.        rsp = &s->item[0];
  3598.  
  3599.        /* SDES items */
  3600.        for (i = 0; i < argc; i++) {
  3601.            rsp->type = type[i];
  3602.            len = length[i];
  3603.            if (len > RTP_MAX_SDES) {
  3604.                /* invalid length, may want to take other action */
  3605.                len = RTP_MAX_SDES;
  3606.            }
  3607.            rsp->length = len;
  3608.            memcpy(rsp->data, value[i], len);
  3609.            rsp = (rtcp_sdes_item_t *)&rsp->data[len];
  3610.        }
  3611.  
  3612.        /* terminate with end marker and pad to next 4-octet boundary */
  3613.        len = ((char *) rsp) - b;
  3614.        pad = 4 - (len & 0x3);
  3615.        b = (char *) rsp;
  3616.        while (pad--) *b++ = RTCP_SDES_END;
  3617.  
  3618.        return b;
  3619.    }
  3620.  
  3621. A.5 Parsing RTCP SDES Packets
  3622.  
  3623.    This function parses an SDES packet, calling functions find_member()
  3624.    to find a pointer to the information for a session member given the
  3625.    SSRC identifier and member_sdes() to store the new SDES information
  3626.    for that member. This function expects a pointer to the header of the
  3627.    RTCP packet.
  3628.  
  3629.    void rtp_read_sdes(rtcp_t *r)
  3630.    {
  3631.        int count = r->common.count;
  3632.        rtcp_sdes_t *sd = &r->r.sdes;
  3633.        rtcp_sdes_item_t *rsp, *rspn;
  3634.        rtcp_sdes_item_t *end = (rtcp_sdes_item_t *)
  3635.                                ((u_int32 *)r + r->common.length + 1);
  3636.        source *s;
  3637.  
  3638.        while (--count >= 0) {
  3639.  
  3640.  
  3641.  
  3642. Schulzrinne, et al          Standards Track                    [Page 65]
  3643.  
  3644. RFC 1889                          RTP                       January 1996
  3645.  
  3646.  
  3647.            rsp = &sd->item[0];
  3648.            if (rsp >= end) break;
  3649.            s = find_member(sd->src);
  3650.  
  3651.            for (; rsp->type; rsp = rspn ) {
  3652.                rspn = (rtcp_sdes_item_t *)((char*)rsp+rsp->length+2);
  3653.                if (rspn >= end) {
  3654.                    rsp = rspn;
  3655.                    break;
  3656.                }
  3657.                member_sdes(s, rsp->type, rsp->data, rsp->length);
  3658.            }
  3659.            sd = (rtcp_sdes_t *)
  3660.                 ((u_int32 *)sd + (((char *)rsp - (char *)sd) >> 2)+1);
  3661.        }
  3662.        if (count >= 0) {
  3663.            /* invalid packet format */
  3664.        }
  3665.    }
  3666.  
  3667. A.6 Generating a Random 32-bit Identifier
  3668.  
  3669.    The following subroutine generates a random 32-bit identifier using
  3670.    the MD5 routines published in RFC 1321 [23]. The system routines may
  3671.    not be present on all operating systems, but they should serve as
  3672.    hints as to what kinds of information may be used. Other system calls
  3673.    that may be appropriate include
  3674.  
  3675.         o getdomainname() ,
  3676.  
  3677.         o getwd() , or
  3678.  
  3679.         o getrusage()
  3680.  
  3681.    "Live" video or audio samples are also a good source of random
  3682.    numbers, but care must be taken to avoid using a turned-off
  3683.    microphone or blinded camera as a source [7].
  3684.  
  3685.    Use of this or similar routine is suggested to generate the initial
  3686.    seed for the random number generator producing the RTCP period (as
  3687.    shown in Appendix A.7), to generate the initial values for the
  3688.    sequence number and timestamp, and to generate SSRC values.  Since
  3689.    this routine is likely to be CPU-intensive, its direct use to
  3690.    generate RTCP periods is inappropriate because predictability is not
  3691.    an issue. Note that this routine produces the same result on repeated
  3692.    calls until the value of the system clock changes unless different
  3693.    values are supplied for the type argument.
  3694.  
  3695.  
  3696.  
  3697.  
  3698. Schulzrinne, et al          Standards Track                    [Page 66]
  3699.  
  3700. RFC 1889                          RTP                       January 1996
  3701.  
  3702.  
  3703.    /*
  3704.     * Generate a random 32-bit quantity.
  3705.     */
  3706.    #include <sys/types.h>   /* u_long */
  3707.    #include <sys/time.h>    /* gettimeofday() */
  3708.    #include <unistd.h>      /* get..() */
  3709.    #include <stdio.h>       /* printf() */
  3710.    #include <time.h>        /* clock() */
  3711.    #include <sys/utsname.h> /* uname() */
  3712.    #include "global.h"      /* from RFC 1321 */
  3713.    #include "md5.h"         /* from RFC 1321 */
  3714.  
  3715.    #define MD_CTX MD5_CTX
  3716.    #define MDInit MD5Init
  3717.    #define MDUpdate MD5Update
  3718.    #define MDFinal MD5Final
  3719.  
  3720.    static u_long md_32(char *string, int length)
  3721.    {
  3722.        MD_CTX context;
  3723.        union {
  3724.            char   c[16];
  3725.            u_long x[4];
  3726.        } digest;
  3727.        u_long r;
  3728.        int i;
  3729.  
  3730.        MDInit (&context);
  3731.        MDUpdate (&context, string, length);
  3732.        MDFinal ((unsigned char *)&digest, &context);
  3733.        r = 0;
  3734.        for (i = 0; i < 3; i++) {
  3735.            r ^= digest.x[i];
  3736.        }
  3737.        return r;
  3738.    }                               /* md_32 */
  3739.  
  3740.  
  3741.    /*
  3742.     * Return random unsigned 32-bit quantity. Use 'type' argument if you
  3743.     * need to generate several different values in close succession.
  3744.     */
  3745.    u_int32 random32(int type)
  3746.    {
  3747.        struct {
  3748.            int     type;
  3749.            struct  timeval tv;
  3750.            clock_t cpu;
  3751.  
  3752.  
  3753.  
  3754. Schulzrinne, et al          Standards Track                    [Page 67]
  3755.  
  3756. RFC 1889                          RTP                       January 1996
  3757.  
  3758.  
  3759.            pid_t   pid;
  3760.            u_long  hid;
  3761.            uid_t   uid;
  3762.            gid_t   gid;
  3763.            struct  utsname name;
  3764.        } s;
  3765.  
  3766.        gettimeofday(&s.tv, 0);
  3767.        uname(&s.name);
  3768.        s.type = type;
  3769.        s.cpu  = clock();
  3770.        s.pid  = getpid();
  3771.        s.hid  = gethostid();
  3772.        s.uid  = getuid();
  3773.        s.gid  = getgid();
  3774.  
  3775.        return md_32((char *)&s, sizeof(s));
  3776.    }                               /* random32 */
  3777.  
  3778. A.7 Computing the RTCP Transmission Interval
  3779.  
  3780.    The following function returns the time between transmissions of RTCP
  3781.    packets, measured in seconds. It should be called after sending one
  3782.    compound RTCP packet to calculate the delay until the next should be
  3783.    sent. This function should also be called to calculate the delay
  3784.    before sending the first RTCP packet upon startup rather than send
  3785.    the packet immediately. This avoids any burst of RTCP packets if an
  3786.    application is started at many sites simultaneously, for example as a
  3787.    result of a session announcement.
  3788.  
  3789.    The parameters have the following meaning:
  3790.  
  3791.    rtcp_bw: The target RTCP bandwidth, i.e., the total bandwidth that
  3792.         will be used for RTCP packets by all members of this session, in
  3793.         octets per second. This should be 5% of the "session bandwidth"
  3794.         parameter supplied to the application at startup.
  3795.  
  3796.    senders: Number of active senders since sending last report, known
  3797.         from construction of receiver reports for this RTCP packet.
  3798.         Includes ourselves, if we also sent during this interval.
  3799.  
  3800.    members: The estimated number of session members, including
  3801.         ourselves. Incremented as we discover new session members from
  3802.         the receipt of RTP or RTCP packets, and decremented as session
  3803.         members leave (via RTCP BYE) or their state is timed out (30
  3804.         minutes is recommended). On the first call, this parameter
  3805.         should have the value 1.
  3806.  
  3807.  
  3808.  
  3809.  
  3810. Schulzrinne, et al          Standards Track                    [Page 68]
  3811.  
  3812. RFC 1889                          RTP                       January 1996
  3813.  
  3814.  
  3815.    we_sent: Flag that is true if we have sent data during the last two
  3816.         RTCP intervals. If the flag is true, the compound RTCP packet
  3817.         just sent contained an SR packet.
  3818.  
  3819.    packet_size: The size of the compound RTCP packet just sent, in
  3820.         octets, including the network encapsulation (e.g., 28 octets for
  3821.         UDP over IP).
  3822.  
  3823.    avg_rtcp_size: Pointer to estimator for compound RTCP packet size;
  3824.         initialized and updated by this function for the packet just
  3825.         sent, and also updated by an identical line of code in the RTCP
  3826.         receive routine for every RTCP packet received from other
  3827.         participants in the session.
  3828.  
  3829.    initial: Flag that is true for the first call upon startup to
  3830.         calculate the time until the first report should be sent.
  3831.  
  3832.    #include <math.h>
  3833.  
  3834.    double rtcp_interval(int members,
  3835.                         int senders,
  3836.                         double rtcp_bw,
  3837.                         int we_sent,
  3838.                         int packet_size,
  3839.                         int *avg_rtcp_size,
  3840.                         int initial)
  3841.    {
  3842.        /*
  3843.         * Minimum time between RTCP packets from this site (in seconds).
  3844.         * This time prevents the reports from `clumping' when sessions
  3845.         * are small and the law of large numbers isn't helping to smooth
  3846.         * out the traffic.  It also keeps the report interval from
  3847.         * becoming ridiculously small during transient outages like a
  3848.         * network partition.
  3849.         */
  3850.        double const RTCP_MIN_TIME = 5.;
  3851.        /*
  3852.         * Fraction of the RTCP bandwidth to be shared among active
  3853.         * senders.  (This fraction was chosen so that in a typical
  3854.         * session with one or two active senders, the computed report
  3855.         * time would be roughly equal to the minimum report time so that
  3856.         * we don't unnecessarily slow down receiver reports.) The
  3857.         * receiver fraction must be 1 - the sender fraction.
  3858.         */
  3859.        double const RTCP_SENDER_BW_FRACTION = 0.25;
  3860.        double const RTCP_RCVR_BW_FRACTION = (1-RTCP_SENDER_BW_FRACTION);
  3861.        /*
  3862.         * Gain (smoothing constant) for the low-pass filter that
  3863.  
  3864.  
  3865.  
  3866. Schulzrinne, et al          Standards Track                    [Page 69]
  3867.  
  3868. RFC 1889                          RTP                       January 1996
  3869.  
  3870.  
  3871.         * estimates the average RTCP packet size (see Cadzow reference).
  3872.         */
  3873.        double const RTCP_SIZE_GAIN = (1./16.);
  3874.  
  3875.        double t;                   /* interval */
  3876.        double rtcp_min_time = RTCP_MIN_TIME;
  3877.        int n;                      /* no. of members for computation */
  3878.  
  3879.        /*
  3880.         * Very first call at application start-up uses half the min
  3881.         * delay for quicker notification while still allowing some time
  3882.         * before reporting for randomization and to learn about other
  3883.         * sources so the report interval will converge to the correct
  3884.         * interval more quickly.  The average RTCP size is initialized
  3885.         * to 128 octets which is conservative (it assumes everyone else
  3886.         * is generating SRs instead of RRs: 20 IP + 8 UDP + 52 SR + 48
  3887.         * SDES CNAME).
  3888.         */
  3889.        if (initial) {
  3890.            rtcp_min_time /= 2;
  3891.            *avg_rtcp_size = 128;
  3892.        }
  3893.  
  3894.        /*
  3895.         * If there were active senders, give them at least a minimum
  3896.         * share of the RTCP bandwidth.  Otherwise all participants share
  3897.         * the RTCP bandwidth equally.
  3898.         */
  3899.        n = members;
  3900.        if (senders > 0 && senders < members * RTCP_SENDER_BW_FRACTION) {
  3901.            if (we_sent) {
  3902.                rtcp_bw *= RTCP_SENDER_BW_FRACTION;
  3903.                n = senders;
  3904.            } else {
  3905.                rtcp_bw *= RTCP_RCVR_BW_FRACTION;
  3906.                n -= senders;
  3907.            }
  3908.        }
  3909.  
  3910.        /*
  3911.         * Update the average size estimate by the size of the report
  3912.         * packet we just sent.
  3913.         */
  3914.        *avg_rtcp_size += (packet_size - *avg_rtcp_size)*RTCP_SIZE_GAIN;
  3915.  
  3916.        /*
  3917.         * The effective number of sites times the average packet size is
  3918.         * the total number of octets sent when each site sends a report.
  3919.  
  3920.  
  3921.  
  3922. Schulzrinne, et al          Standards Track                    [Page 70]
  3923.  
  3924. RFC 1889                          RTP                       January 1996
  3925.  
  3926.  
  3927.         * Dividing this by the effective bandwidth gives the time
  3928.         * interval over which those packets must be sent in order to
  3929.         * meet the bandwidth target, with a minimum enforced.  In that
  3930.         * time interval we send one report so this time is also our
  3931.         * average time between reports.
  3932.         */
  3933.        t = (*avg_rtcp_size) * n / rtcp_bw;
  3934.        if (t < rtcp_min_time) t = rtcp_min_time;
  3935.  
  3936.        /*
  3937.         * To avoid traffic bursts from unintended synchronization with
  3938.         * other sites, we then pick our actual next report interval as a
  3939.         * random number uniformly distributed between 0.5*t and 1.5*t.
  3940.         */
  3941.        return t * (drand48() + 0.5);
  3942.    }
  3943.  
  3944. A.8 Estimating the Interarrival Jitter
  3945.  
  3946.    The code fragments below implement the algorithm given in Section
  3947.    6.3.1 for calculating an estimate of the statistical variance of the
  3948.    RTP data interarrival time to be inserted in the interarrival jitter
  3949.    field of reception reports. The inputs are r->ts , the timestamp from
  3950.    the incoming packet, and arrival , the current time in the same
  3951.    units. Here s points to state for the source; s->transit holds the
  3952.    relative transit time for the previous packet, and s->jitter holds
  3953.    the estimated jitter. The jitter field of the reception report is
  3954.    measured in timestamp units and expressed as an unsigned integer, but
  3955.    the jitter estimate is kept in a floating point. As each data packet
  3956.    arrives, the jitter estimate is updated:
  3957.  
  3958.        int transit = arrival - r->ts;
  3959.        int d = transit - s->transit;
  3960.        s->transit = transit;
  3961.        if (d < 0) d = -d;
  3962.        s->jitter += (1./16.) * ((double)d - s->jitter);
  3963.  
  3964.    When a reception report block (to which rr points) is generated for
  3965.    this member, the current jitter estimate is returned:
  3966.  
  3967.        rr->jitter = (u_int32) s->jitter;
  3968.  
  3969.    Alternatively, the jitter estimate can be kept as an integer, but
  3970.    scaled to reduce round-off error. The calculation is the same except
  3971.    for the last line:
  3972.  
  3973.        s->jitter += d - ((s->jitter + 8) >> 4);
  3974.  
  3975.  
  3976.  
  3977.  
  3978. Schulzrinne, et al          Standards Track                    [Page 71]
  3979.  
  3980. RFC 1889                          RTP                       January 1996
  3981.  
  3982.  
  3983.    In this case, the estimate is sampled for the reception report as:
  3984.  
  3985.        rr->jitter = s->jitter >> 4;
  3986.  
  3987.  
  3988. B.  Security Considerations
  3989.  
  3990.    RTP suffers from the same security liabilities as the underlying
  3991.    protocols. For example, an impostor can fake source or destination
  3992.    network addresses, or change the header or payload. Within RTCP, the
  3993.    CNAME and NAME information may be used to impersonate another
  3994.    participant. In addition, RTP may be sent via IP multicast, which
  3995.    provides no direct means for a sender to know all the receivers of
  3996.    the data sent and therefore no measure of privacy. Rightly or not,
  3997.    users may be more sensitive to privacy concerns with audio and video
  3998.    communication than they have been with more traditional forms of
  3999.    network communication [24]. Therefore, the use of security mechanisms
  4000.    with RTP is important. These mechanisms are discussed in Section 9.
  4001.  
  4002.    RTP-level translators or mixers may be used to allow RTP traffic to
  4003.    reach hosts behind firewalls. Appropriate firewall security
  4004.    principles and practices, which are beyond the scope of this
  4005.    document, should be followed in the design and installation of these
  4006.    devices and in the admission of RTP applications for use behind the
  4007.    firewall.
  4008.  
  4009. C. Authors' Addresses
  4010.  
  4011.    Henning Schulzrinne
  4012.    GMD Fokus
  4013.    Hardenbergplatz 2
  4014.    D-10623 Berlin
  4015.    Germany
  4016.  
  4017.    EMail: schulzrinne@fokus.gmd.de
  4018.  
  4019.  
  4020.    Stephen L. Casner
  4021.    Precept Software, Inc.
  4022.    21580 Stevens Creek Boulevard, Suite 207
  4023.    Cupertino, CA 95014
  4024.    United States
  4025.  
  4026.    EMail: casner@precept.com
  4027.  
  4028.  
  4029.  
  4030.  
  4031.  
  4032.  
  4033.  
  4034. Schulzrinne, et al          Standards Track                    [Page 72]
  4035.  
  4036. RFC 1889                          RTP                       January 1996
  4037.  
  4038.  
  4039.    Ron Frederick
  4040.    Xerox Palo Alto Research Center
  4041.    3333 Coyote Hill Road
  4042.    Palo Alto, CA 94304
  4043.    United States
  4044.  
  4045.    EMail: frederic@parc.xerox.com
  4046.  
  4047.  
  4048.    Van Jacobson
  4049.    MS 46a-1121
  4050.    Lawrence Berkeley National Laboratory
  4051.    Berkeley, CA 94720
  4052.    United States
  4053.  
  4054.    EMail: van@ee.lbl.gov
  4055.  
  4056. Acknowledgments
  4057.  
  4058.    This memorandum is based on discussions within the IETF Audio/Video
  4059.    Transport working group chaired by Stephen Casner. The current
  4060.    protocol has its origins in the Network Voice Protocol and the Packet
  4061.    Video Protocol (Danny Cohen and Randy Cole) and the protocol
  4062.    implemented by the vat application (Van Jacobson and Steve McCanne).
  4063.    Christian Huitema provided ideas for the random identifier generator.
  4064.  
  4065. D.  Bibliography
  4066.  
  4067.    [1] D. D. Clark and D. L. Tennenhouse, "Architectural considerations
  4068.        for a new generation of protocols," in SIGCOMM Symposium on
  4069.        Communications Architectures and Protocols , (Philadelphia,
  4070.        Pennsylvania), pp. 200--208, IEEE, Sept. 1990.  Computer
  4071.        Communications Review, Vol. 20(4), Sept. 1990.
  4072.  
  4073.    [2] H. Schulzrinne, "Issues in designing a transport protocol for
  4074.        audio and video conferences and other multiparticipant real-time
  4075.        applications", Work in Progress.
  4076.  
  4077.    [3] D. E. Comer, Internetworking with TCP/IP , vol. 1.  Englewood
  4078.        Cliffs, New Jersey: Prentice Hall, 1991.
  4079.  
  4080.    [4] Postel, J., "Internet Protocol", STD 5, RFC 791, USC/Information
  4081.        Sciences Institute, September 1981.
  4082.  
  4083.    [5] Mills, D., "Network Time Protocol Version 3", RFC 1305, UDEL,
  4084.        March 1992.
  4085.  
  4086.  
  4087.  
  4088.  
  4089.  
  4090. Schulzrinne, et al          Standards Track                    [Page 73]
  4091.  
  4092. RFC 1889                          RTP                       January 1996
  4093.  
  4094.  
  4095.    [6] Reynolds, J., and J. Postel, "Assigned Numbers", STD 2, RFC 1700,
  4096.        USC/Information Sciences Institute, October 1994.
  4097.  
  4098.    [7] Eastlake, D., Crocker, S., and J. Schiller, "Randomness
  4099.        Recommendations for Security", RFC 1750, DEC, Cybercash, MIT,
  4100.        December 1994.
  4101.  
  4102.    [8] J.-C. Bolot, T. Turletti, and I. Wakeman, "Scalable feedback
  4103.        control for multicast video distribution in the internet," in
  4104.        SIGCOMM Symposium on Communications Architectures and Protocols ,
  4105.        (London, England), pp. 58--67, ACM, Aug. 1994.
  4106.  
  4107.    [9] I. Busse, B. Deffner, and H. Schulzrinne, "Dynamic QoS control of
  4108.        multimedia applications based on RTP," Computer Communications ,
  4109.        Jan.  1996.
  4110.  
  4111.   [10] S. Floyd and V. Jacobson, "The synchronization of periodic
  4112.        routing messages," in SIGCOMM Symposium on Communications
  4113.        Architectures and Protocols (D. P. Sidhu, ed.), (San Francisco,
  4114.        California), pp. 33--44, ACM, Sept. 1993.  also in [25].
  4115.  
  4116.   [11] J. A. Cadzow, Foundations of digital signal processing and data
  4117.        analysis New York, New York: Macmillan, 1987.
  4118.  
  4119.   [12] International Standards Organization, "ISO/IEC DIS 10646-1:1993
  4120.        information technology -- universal multiple-octet coded
  4121.        character set (UCS) -- part I: Architecture and basic
  4122.        multilingual plane," 1993.
  4123.  
  4124.   [13] The Unicode Consortium, The Unicode Standard New York, New York:
  4125.        Addison-Wesley, 1991.
  4126.  
  4127.   [14] Mockapetris, P., "Domain Names - Concepts and Facilities", STD
  4128.        13, RFC 1034, USC/Information Sciences Institute, November 1987.
  4129.  
  4130.   [15] Mockapetris, P., "Domain Names - Implementation and
  4131.        Specification", STD 13, RFC 1035, USC/Information Sciences
  4132.        Institute, November 1987.
  4133.  
  4134.   [16] Braden, R., "Requirements for Internet Hosts - Application and
  4135.        Support", STD 3, RFC 1123, Internet Engineering Task Force,
  4136.        October 1989.
  4137.  
  4138.   [17] Rekhter, Y., Moskowitz, R., Karrenberg, D., and G. de Groot,
  4139.        "Address Allocation for Private Internets", RFC 1597, T.J. Watson
  4140.        Research Center, IBM Corp., Chrysler Corp., RIPE NCC, March 1994.
  4141.  
  4142.  
  4143.  
  4144.  
  4145.  
  4146. Schulzrinne, et al          Standards Track                    [Page 74]
  4147.  
  4148. RFC 1889                          RTP                       January 1996
  4149.  
  4150.  
  4151.   [18] Lear, E., Fair, E., Crocker, D., and T. Kessler, "Network 10
  4152.        Considered Harmful (Some Practices Shouldn't be Codified)", RFC
  4153.        1627, Silicon Graphics, Inc., Apple Computer, Inc., Silicon
  4154.        Graphics, Inc., July 1994.
  4155.  
  4156.   [19] Crocker, D., "Standard for the Format of ARPA Internet Text
  4157.        Messages", STD 11, RFC 822, UDEL, August 1982.
  4158.  
  4159.   [20] W. Feller, An Introduction to Probability Theory and its
  4160.        Applications, Volume 1 , vol. 1.  New York, New York: John Wiley
  4161.        and Sons, third ed., 1968.
  4162.  
  4163.   [21] Balenson, D., "Privacy Enhancement for Internet Electronic Mail:
  4164.        Part III: Algorithms, Modes, and Identifiers", RFC 1423, TIS, IAB
  4165.        IRTF PSRG, IETF PEM WG, February 1993.
  4166.  
  4167.   [22] V. L. Voydock and S. T. Kent, "Security mechanisms in high-level
  4168.        network protocols," ACM Computing Surveys , vol. 15, pp. 135--
  4169.        171, June 1983.
  4170.  
  4171.   [23] Rivest, R., "The MD5 Message-Digest Algorithm", RFC 1321, MIT
  4172.        Laboratory for Computer Science and RSA Data Security, Inc.,
  4173.        April 1992.
  4174.  
  4175.   [24] S. Stubblebine, "Security services for multimedia conferencing,"
  4176.        in 16th National Computer Security Conference , (Baltimore,
  4177.        Maryland), pp. 391--395, Sept. 1993.
  4178.  
  4179.   [25] S. Floyd and V. Jacobson, "The synchronization of periodic
  4180.        routing messages," IEEE/ACM Transactions on Networking , vol. 2,
  4181.        pp.  122-136, April 1994.
  4182.  
  4183.  
  4184.  
  4185.  
  4186.  
  4187.  
  4188.  
  4189.  
  4190.  
  4191.  
  4192.  
  4193.  
  4194.  
  4195.  
  4196.  
  4197.  
  4198.  
  4199.  
  4200.  
  4201.  
  4202. Schulzrinne, et al          Standards Track                    [Page 75]
  4203.  
  4204.