idnits 2.17.1 draft-ietf-avt-rtp-format-guidelines-04.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** Looks like you're using RFC 2026 boilerplate. This must be updated to follow RFC 3978/3979, as updated by RFC 4748. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- ** Missing expiration date. The document expiration date should appear on the first and last page. ** The document seems to lack a 1id_guidelines paragraph about Internet-Drafts being working documents. ** The document seems to lack a 1id_guidelines paragraph about 6 months document validity -- however, there's a paragraph with a matching beginning. Boilerplate error? == No 'Intended status' indicated for this document; assuming Proposed Standard == It seems as if not all pages are separated by form feeds - found 0 form feeds but 9 pages Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The document seems to lack an IANA Considerations section. (See Section 2.2 of https://www.ietf.org/id-info/checklist for how to handle the case when there are no actions for IANA.) ** The document seems to lack separate sections for Informative/Normative References. All references will be assumed normative when checking for downward references. ** There are 5 instances of too long lines in the document, the longest one being 3 characters in excess of 72. Miscellaneous warnings: ---------------------------------------------------------------------------- == The "Author's Address" (or "Authors' Addresses") section title is misspelled. -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (Oct 1999) is 8959 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Possible downref: Non-RFC (?) normative reference: ref. '2' -- Possible downref: Non-RFC (?) normative reference: ref. '3' -- Possible downref: Non-RFC (?) normative reference: ref. '4' -- Possible downref: Non-RFC (?) normative reference: ref. '5' -- Possible downref: Non-RFC (?) normative reference: ref. '6' ** Obsolete normative reference: RFC 2481 (ref. '8') (Obsoleted by RFC 3168) ** Obsolete normative reference: RFC 1889 (ref. '9') (Obsoleted by RFC 3550) Summary: 9 errors (**), 0 flaws (~~), 3 warnings (==), 7 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 1 Internet Engineering Task Force AVT WG 2 INTERNET-DRAFT M. Handley, C. Perkins 3 draft-ietf-avt-rtp-format-guidelines-04.txt ACIRI, UCL 4 15th Oct 1999 5 Expires: Apr 1999 7 Guidelines for Writers of RTP Payload Format Specifications 9 Abstract 11 This document provides general guidelines aimed at assisting the authors 12 of RTP Payload Format specifications in deciding on good formats. These 13 guidelines attempt to capture some of the experience gained with RTP as 14 it evolved during its development. 16 Status of this Memo 18 This document is an Internet-Draft and is in full conformance with all 19 provisions of Section 10 of RFC2026. Internet-Drafts are working docu- 20 ments of the Internet Engineering Task Force (IETF), its areas, and its 21 working groups. Note that other groups may also distribute working doc- 22 uments as Internet-Drafts. 24 Internet-Drafts are draft documents valid for a maximum of six months 25 and may be updated, replaced, or obsoleted by other documents at any 26 time. It is inappropriate to use Internet- Drafts as reference material 27 or to cite them other than as ``work in progress.'' 29 The list of current Internet-Drafts can be accessed at 30 http://www.ietf.org/ietf/1id-abstracts.txt 32 The list of Internet-Draft Shadow Directories can be accessed at 33 http://www.ietf.org/shadow.html. 35 1. Introduction 37 This document provides general guidelines aimed at assisting the authors 38 of RTP [9] Payload Format specifications in deciding on good formats. 39 These guidelines attempt to capture some of the experience gained with 40 RTP as it evolved during its development. 42 The principles outlined in this document are applicable to almost all 43 data types, but are framed in examples of audio and video codecs for 44 clarity. 46 2. Background 48 RTP was designed around the concept of Application Level Framing (ALF), 49 first described by Clark and Tennenhouse[2]. The key argument underlying 50 ALF is that there are many different ways an application might be able 51 to cope with misordered or lost packets. These range from ignoring the 52 loss, to re-sending the missing data (either from a buffer or by regen- 53 erating it), and to sending new data which supersedes the missing data. 54 The application only has this choice if the transport protocol is deal- 55 ing with data in ``Application Data Units'' (ADUs). An ADU contains data 56 that can be processed out-of-order with respect to other ADUs. Thus the 57 ADU is the minimum unit of error recovery. 59 The key property of a transport protocol for ADUs is that each ADU con- 60 tains sufficient information to be processed by the receiver immedi- 61 ately. An example is a video stream, wherein the compressed video data 62 in an ADU must be capable of being decompressed regardless of whether 63 previous ADUs have been received. Additionally the ADU must contain 64 ``header'' information detailing its position in the video image and the 65 frame from which it came. 67 Although an ADU need not be a packet, there are many applications for 68 which a packet is a natural ADU. Such ALF applications have the great 69 advantage that all packets that are received can be processed by the 70 application immediately. 72 RTP was designed around an ALF philosophy. In the context of a stream 73 of RTP data, an RTP packet header provides sufficient information to be 74 able to identify and decode the packet irrespective of whether it was 75 received in order, or whether preceding packets have been lost. How- 76 ever, these arguments only hold good if the RTP payload formats are also 77 designed using an ALF philosophy. 79 Note that this also implies smart, network aware, end-points. An appli- 80 cation using RTP should be aware of the limitations of the underlying 81 network, and should adapt its transmission to match those limitations. 82 Our experience is that a smart end-point implementation can achieve sig- 83 nificantly better performance on real IP-based networks than a naive 84 implementation. 86 3. Channel Characteristics 88 We identify the following channel characteristics that influence the 89 best-effort transport of RTP over UDP/IP in the Internet: 91 o Packets may be lost 92 o Packets may be duplicated 94 o Packets may be reordered in transit 96 o Packets will be fragmented if they exceed the MTU of the underlying 97 network 99 The loss characteristics of a link may vary widely over short time 100 intervals. 102 Although fragmentation is not a disastrous phenomenon if it is a rare 103 occurrence, relying on IP fragmentation is a bad design strategy as it 104 significantly increases the effective loss rate of a network and 105 decreases goodput. This is because if one fragment is lost, the remain- 106 ing fragments (which have used up bottleneck bandwidth) will then need 107 to be discarded by the receiver. It also puts additional load on the 108 routers performing fragmentation and on the end-systems re-assembling 109 the fragments. 111 In addition, it is noted that the transit time between two hosts on the 112 Internet will not be constant. This is due to two effects - jitter 113 caused by being queued behind cross-traffic, and routing changes. The 114 former is possible to characterise and compensate for by using a playout 115 buffer, but the latter is impossible to predict and difficult to accom- 116 modate gracefully. 118 4. Guidelines 120 We identify the following requirements of RTP payload format specifica- 121 tions: 123 + A payload format should be devised so that the stream being trans- 124 ported is still useful even in the presence of a moderate amount of 125 packet loss. 127 + Ideally all the contents of every packet should be possible to be 128 decoded and played out irrespective of whether preceding packets 129 have been lost or arrive late. 131 The first of these requirements is based on the nature of the Internet. 132 Although it may be possible to engineer parts of the Internet to produce 133 low loss rates through careful provisioning or the use of non-best- 134 effort services, as a rule payload formats should not be designed for 135 these special purpose environments. Payload formats should be designed 136 to be used in the public Internet with best effort service, and thus 137 should expect to see moderate loss rates. For example, a 5% loss rate 138 is not uncommon. We note that TCP steady state models[3][4][6] indicate 139 that a 5% loss rate with a 1KByte packet size and 200ms round-trip time 140 will result in TCP achieving a throughput of around 180Kbit/s. Higher 141 loss rates, smaller packet sizes, or a larger RTT are required to con- 142 strain TCP to lower data rates. For the most part, it is such TCP traf- 143 fic that is producing the background loss that many RTP flows must co- 144 exist with. Without explicit congestion notification (ECN)[8], loss 145 must be considered an intrinsic property of best-effort parts of the 146 Internet. 148 When payload formats do not assume packet loss will occur, they should 149 state this explicitly up front, and they will be considered special pur- 150 pose payload formats, unsuitable for use on the public Internet without 151 special support from the network infrastructure. 153 The second of these requirements is more explicit about how RTP should 154 cope with loss. If an RTP payload format is properly designed, every 155 packet that is actually received should be useful. Typically this 156 implies the following guidelines are adhered to: 158 + Packet boundaries should coincide with codec frame boundaries. Thus 159 a packet should normally consist of one or more complete codec 160 frames. 162 + A codec's minimum unit of data should never be packetised so that it 163 crossed a packet boundary unless it is larger than the MTU. 165 + If a codec's frame size is larger than the MTU, the payload format 166 must not rely on IP fragmentation. Instead it must define its own 167 fragmentation mechanism. Such mechanisms may involve codec-specific 168 information that allows decoding of fragments. Alternatively they 169 might allow codec-independent packet-level forward error correc- 170 tion[5] to be applied that cannot be used with IP-level fragmenta- 171 tion. 173 In the abstract, a codec frame (i.e., the ADU or the minimum size unit 174 that has semantic meaning when handed to the codec) can be of arbitrary 175 size. For PCM audio, it is one byte. For GSM audio, a frame corre- 176 sponds to 20ms of audio. For H.261 video, it is a Group of Blocks 177 (GOB), or one twelfth of a CIF video frame. 179 For PCM, it does not matter how audio is packetised, as the ADU size is 180 one byte. For GSM audio, arbitrary packetisation would split a 20ms 181 frame over two packets, which would mean that if one packet were lost, 182 partial frames in packets before and after the loss are meaningless. 183 This means that not only were the bits in the missing packet lost, but 184 also that additional bits in neighboring packets that used bottleneck 185 bandwidth were effectively also lost because the receiver must throw 186 them away. Instead, we would packetise GSM by including several 187 complete GSM frames in a packet; typically four GSM frames are included 188 in current implementations. Thus every packet received can be decoded 189 because even in the presence of loss, no incomplete frames are received. 191 The H.261 specification allows GOBs to be up to 3KBytes long, although 192 most of the time they are smaller than this. It might be thought that 193 we should insert a group of blocks into a packet when it fits, and arbi- 194 trarily split the GOB over two or more packets when a GOB is large. In 195 the first version of the H.261 payload format, this is what was done. 196 However, this still means that there are circumstances where H.261 pack- 197 ets arrive at the receiver and must be discarded because other packets 198 were lost - a loss multiplier effect that we wish to avoid. In fact 199 there are smaller units than GOBs in the H.261 bit-stream called mac- 200 roblocks, but they are not identifiable without parsing from the start 201 of the GOB. However, if we provide a little additional information at 202 the start of each packet, we can reinstate information that would nor- 203 mally be found by parsing from the start of the GOB, and we can packe- 204 tise H.261 by splitting the data stream on macroblock boundaries. This 205 is a less obvious packetisation for H.261 than the GOB packetisation, 206 but it does mean that a slightly smarter depacketiser at the receiver 207 can reconstruct a valid H.261 bitstream from a stream of RTP packets 208 that has experienced loss, and not have to discard any of the data that 209 arrived. 211 An additional guideline concerns codecs that require the decoder state 212 machine to keep step with the encoder state machine. Many audio codecs 213 such as LPC or GSM are of this form. Typically they are loss tolerant, 214 in that after a loss, the predictor coefficients decay, so that after a 215 certain amount of time, the predictor error induced by the loss will 216 disappear. Most codecs designed for telephony services are of this form 217 because they were designed to cope with bit errors without the decoder 218 predictor state permanently remaining incorrect. Just packetising these 219 formats so that packets consist of integer multiples of codec frames may 220 not be optimal, as although the packet received immediately after a 221 packet loss can be decoded, the start of the audio stream produced will 222 be incorrect (and hence distort the signal) because the decoder predic- 223 tor is now out of step with the encoder. In principle, all of the 224 decoder's internal state could be added using a header attached to the 225 start of every packet, but for lower bit-rate encodings, this state is 226 so substantial that the bit rate is no longer low. However, a compro- 227 mise can usually be found, where a greatly reduced form of decoder state 228 is sent in every packet, which does not recreate the encoders predictor 229 precisely, but does reduce the magnitude and duration of the distortion 230 produced when the previous packet is lost. Such compressed state is, by 231 definition, very dependent on the codec in question. Thus we recommend: 233 + Payload formats for encodings where the decoder contains internal 234 data-driven state that attempts to track encoder state should 235 normally consider including a small additional header that conveys 236 the most critical elements of this state to reduce distortion after 237 packet loss. 239 A similar issue arises with codec parameters, and whether or not they 240 should be included in the payload format. An example is with a codec 241 that has a choice of huffman tables for compression. The codec may use 242 either huffman table 1 or table 2 for encoding and the receiver needs to 243 know this information for correct decoding. There are a number of ways 244 in which this kind of information can be conveyed: 246 o Out of band signalling, prior to media transmission. 248 o Out of band signalling, but the parameter can be changed mid-ses- 249 sion. This requires synchronization of the change in the media 250 stream. 252 o The change is signaled through a change in the RTP payload type 253 field. This requires mapping the parameter space into particular 254 payload type values and signalling this mapping out-of-band prior to 255 media transmission. 257 o Including the parameter in the payload format. This allows for 258 adapting the parameter in a robust manner, but makes the payload 259 format less efficient. 261 Which mechanism to use depends on the utility of changing the parameter 262 in mid-session to support application layer adaptation. However, using 263 out-of-band signalling to change a parameter in mid-session is generally 264 to be discouraged due to this problems of synchronizing the parameter 265 change with the media stream. 267 4.1. RTP Header Extensions 269 Many RTP payload formats require some additional header information to 270 be carried in addition to that included in the fixed RTP packet header. 271 The recommended way of conveying this information is in the payload sec- 272 tion of the packet. The RTP header extension should not be used to con- 273 vey payload specific information ([9],section 5.3) since this is ineffi- 274 cient in its use of bandwidth; requires the definition of a new RTP pro- 275 file or profile extension; and makes it difficult to employ FEC schemes 276 such as, for example, [7]. Use of an RTP header extension is only 277 appropriate for cases where the extension in question applies across a 278 wide range of payload types. 280 4.2. Header Compression 282 Designers of payload formats should also be aware of the needs of RTP 283 header compression [1]. In particular, the compression algorithm func- 284 tions best when the RTP timestamp increments by a constant value between 285 consecutive packets. Payload formats which rely on sending packets out 286 of order, such that the timestamp increment is not constant, are likely 287 to compress less well than those which send packets in order. This has 288 most often been an issue when designing payload formats for FEC informa- 289 tion, although some video codecs also rely on out-of-order transmission 290 of packets at the expense of reduced compression. Although in some 291 cases such out-of-order transmission may be the best solution, payload 292 format designers are encourage to look for alternative solutions where 293 possible. 295 5. Summary 297 Designing packet formats for RTP is not a trivial task. Typically a 298 detailed knowledge of the codec involved is required to be able to 299 design a format that is resilient to loss, does not introduce loss mag- 300 nification effects due to inappropriate packetisation, and does not 301 introduce unnecessary distortion after a packet loss. We believe that 302 considerable effort should be put into designing packet formats that are 303 well tailored to the codec in question. Typically this requires a very 304 small amount of processing at the sender and receiver, but the result 305 can be greatly improved quality when operating in typical Internet envi- 306 ronments. 308 Designers of new codecs for use with RTP should consider making the out- 309 put of the codec ``naturally packetizable''. This implies that the codec 310 should be designed to produce a packet stream, rather than a bit-stream; 311 and that that packet stream contains the minimal amount of redundancy 312 necessary to ensure that each packet is independently decodable with 313 minimal loss of decoder predictor tracking. It is recognised that sacri- 314 ficing some small amount of bandwidth to ensure greater robustness to 315 packet loss is often a worthwhile tradeoff. 317 It is hoped that, in the long run, new codecs should be produced which 318 can be directly packetised, without the trouble of designing a codec- 319 specific payload format. 321 It is possible to design generic packetisation formats that do not pay 322 attention to the issues described in this document, but such formats are 323 only suitable for special purpose networks where packet loss can be 324 avoided by careful engineering at the network layer, and are not suited 325 to current best-effort networks. 327 6. Security Considerations 329 The guidelines in this document result in RTP payload formats that are 330 robust in the presence of real world network conditions. Designing pay- 331 load formats for special purpose networks that assume negligable loss 332 rates will normally result in slightly better compression, but produce 333 formats that are more fragile, thus rendering them easier targets for 334 denial-of-service attacks. 336 Designers of payload formats should pay close attention to possible 337 security issues that might arise from poor implementations of their for- 338 mats, and should be careful to specify the correct behaviour when anoma- 339 lous conditions arise. Examples include how to process illegal field 340 values, and conditions when there are mismatches between length fields 341 and actual data. Whilst the correct action will normally be to discard 342 the packet, possible such conditions should be brought to the attention 343 of the implementor to ensure that they are trapped properly. 345 The RTP specification covers encryption of the payload. This issue 346 should not normally be dealt with by payload formats themselves. How- 347 ever, certain payload formats spread information about a particular 348 application data unit over a number of packets, or rely on packets which 349 relate to a number of application data units. Care must be taken when 350 changing the encryption of such streams, since such payload formats may 351 constrain the places in a stream where it is possible to change the 352 encryption key without exposing sensitive data. 354 Designers of payload formats which include FEC should be aware that the 355 automatic addition of FEC in response to packet loss may increase net- 356 work congestion, leading to a worsening of the problem which the use of 357 FEC was intended to solve. Since this may, at its worst, constitute a 358 denial of service attack, designers of such payload formats should take 359 care that appropriate safeguards are in place to prevent abuse. 361 Authors Addresses 363 Mark Handley 364 AT&T Center for Internet Research at ICSI, 365 International Computer Science Institute, 366 1947 Center Street, Suite 600, 367 Berkeley, CA 94704, USA 368 mjh@aciri.org 370 Colin Perkins 371 Dept of Computer Science, 372 University College London, 373 Gower Street, 374 London WC1E 6BT, UK. 376 C.Perkins@cs.ucl.ac.uk 378 Acknowledgments 380 This document is based on experience gained over several years by many 381 people, including Van Jacobson, Steve McCanne, Steve Casner, Henning 382 Schulzrinne, Thierry Turletti, Jonathan Rosenberg and Christian Huitema 383 amongst others. 385 References 387 [1] S. Casner, V. Jacobson, ``Compressing IP/UDP/RTP Headers for Low- 388 Speed Serial Links'', RFC 2508. 390 [2] D. Clark, D. Tennenhouse, "Architectural Considerations for a New 391 Generation of Network Protocols" Proc ACM Sigcomm 90. 393 [3] J. Mahdavi and S. Floyd. ``TCP-friendly unicast rate-based flow 394 control''. Note sent to end2end-interest mailing list, Jan 1997. 396 [4] M. Mathis, J. Semske, J. Mahdavi, and T. Ott. ``The macro-scopic 397 behavior of the TCP congestion avoidance algorithm''. Computer Com- 398 munication Review, 27(3), July 1997. 400 [5] J. Nonnenmacher, E. Biersack, Don Towsley, ``Parity-Based Loss 401 Recovery for Reliable Multicast Transmission'', Proc ACM Sigcomm 402 '97, Cannes, France, 1997. 404 [6] J. Padhye, V. Firoiu, D. Towsley, J. Kurose, ``Modeling TCP 405 Throughput: A Simple Model and its Empirical Validation'', Proc. 406 ACM Sigcomm 1998. 408 [7] C. Perkins, I. Kouvelas, O. Hodson, V. Hardman, M. Handley, J.C. 409 Bolot, A. Vega-Garcia, S. Fosse-Parisis, ``RTP Payload for Redun- 410 dant Audio Data'', RFC 2198. 412 [8] K. K. Ramakrishnan, Sally Floyd, ``A Proposal to add Explicit Con- 413 gestion Notification (ECN) to IP'' RFC 2481, Jan 1999. 415 [9] H.Schulzrinne, S.Casner, R.Frederick, V. Jacobson, "Real-Time 416 Transport Protocol", RFC1889, Jan 1996.