idnits 2.17.1 draft-ietf-tsvwg-rlc-fec-scheme-05.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == Line 679 has weird spacing: '...air_key key...' == Line 1408 has weird spacing: '...am seed a 32-...' -- The document date (May 23, 2018) is 2163 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) -- Looks like a reference, but probably isn't: '0' on line 794 -- Looks like a reference, but probably isn't: '1' on line 794 Summary: 0 errors (**), 0 flaws (~~), 3 warnings (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 TSVWG V. Roca 3 Internet-Draft B. Teibi 4 Intended status: Standards Track INRIA 5 Expires: November 24, 2018 May 23, 2018 7 Sliding Window Random Linear Code (RLC) Forward Erasure Correction (FEC) 8 Schemes for FECFRAME 9 draft-ietf-tsvwg-rlc-fec-scheme-05 11 Abstract 13 This document describes two fully-specified Forward Erasure 14 Correction (FEC) Schemes for Sliding Window Random Linear Codes 15 (RLC), one for RLC over GF(2) (binary case), a second one for RLC 16 over GF(2^^8), both of them with the possibility of controlling the 17 code density. They can protect arbitrary media streams along the 18 lines defined by FECFRAME extended to sliding window FEC codes. 19 These sliding window FEC codes rely on an encoding window that slides 20 over the source symbols, generating new repair symbols whenever 21 needed. Compared to block FEC codes, these sliding window FEC codes 22 offer key advantages with real-time flows in terms of reduced FEC- 23 related latency while often providing improved packet erasure 24 recovery capabilities. 26 Status of This Memo 28 This Internet-Draft is submitted in full conformance with the 29 provisions of BCP 78 and BCP 79. 31 Internet-Drafts are working documents of the Internet Engineering 32 Task Force (IETF). Note that other groups may also distribute 33 working documents as Internet-Drafts. The list of current Internet- 34 Drafts is at https://datatracker.ietf.org/drafts/current/. 36 Internet-Drafts are draft documents valid for a maximum of six months 37 and may be updated, replaced, or obsoleted by other documents at any 38 time. It is inappropriate to use Internet-Drafts as reference 39 material or to cite them other than as "work in progress." 41 This Internet-Draft will expire on November 24, 2018. 43 Copyright Notice 45 Copyright (c) 2018 IETF Trust and the persons identified as the 46 document authors. All rights reserved. 48 This document is subject to BCP 78 and the IETF Trust's Legal 49 Provisions Relating to IETF Documents 50 (https://trustee.ietf.org/license-info) in effect on the date of 51 publication of this document. Please review these documents 52 carefully, as they describe your rights and restrictions with respect 53 to this document. Code Components extracted from this document must 54 include Simplified BSD License text as described in Section 4.e of 55 the Trust Legal Provisions and are provided without warranty as 56 described in the Simplified BSD License. 58 Table of Contents 60 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 61 1.1. Limits of Block Codes with Real-Time Flows . . . . . . . 3 62 1.2. Lower Latency and Better Protection of Real-Time Flows 63 with the Sliding Window RLC Codes . . . . . . . . . . . . 4 64 1.3. Small Transmission Overheads with the Sliding Window RLC 65 FEC Scheme . . . . . . . . . . . . . . . . . . . . . . . 5 66 1.4. Document Organization . . . . . . . . . . . . . . . . . . 6 67 2. Definitions and Abbreviations . . . . . . . . . . . . . . . . 6 68 3. Procedures . . . . . . . . . . . . . . . . . . . . . . . . . 7 69 3.1. Possible Parameter Derivations . . . . . . . . . . . . . 7 70 3.1.1. Case of a CBR Real-Time Flow . . . . . . . . . . . . 8 71 3.1.2. Other Types of Real-Time Flow . . . . . . . . . . . . 10 72 3.1.3. Case of a Non Real-Time Flow . . . . . . . . . . . . 11 73 3.2. ADU, ADUI and Source Symbols Mappings . . . . . . . . . . 11 74 3.3. Encoding Window Management . . . . . . . . . . . . . . . 13 75 3.4. Pseudo-Random Number Generator (PRNG) . . . . . . . . . . 13 76 3.5. Coding Coefficients Generation Function . . . . . . . . . 14 77 3.6. Finite Fields Operations . . . . . . . . . . . . . . . . 17 78 3.6.1. Finite Field Definitions . . . . . . . . . . . . . . 17 79 3.6.2. Linear Combination of Source Symbols Computation . . 17 80 4. Sliding Window RLC FEC Scheme over GF(2^^8) for Arbitrary ADU 81 Flows . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 82 4.1. Formats and Codes . . . . . . . . . . . . . . . . . . . . 18 83 4.1.1. FEC Framework Configuration Information . . . . . . . 18 84 4.1.2. Explicit Source FEC Payload ID . . . . . . . . . . . 19 85 4.1.3. Repair FEC Payload ID . . . . . . . . . . . . . . . . 20 86 4.1.4. Additional Procedures . . . . . . . . . . . . . . . . 21 87 5. Sliding Window RLC FEC Scheme over GF(2) for Arbitrary ADU 88 Flows . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 89 5.1. Formats and Codes . . . . . . . . . . . . . . . . . . . . 21 90 5.1.1. FEC Framework Configuration Information . . . . . . . 21 91 5.1.2. Explicit Source FEC Payload ID . . . . . . . . . . . 22 92 5.1.3. Repair FEC Payload ID . . . . . . . . . . . . . . . . 22 93 5.1.4. Additional Procedures . . . . . . . . . . . . . . . . 22 94 6. FEC Code Specification . . . . . . . . . . . . . . . . . . . 22 95 6.1. Encoding Side . . . . . . . . . . . . . . . . . . . . . . 22 96 6.2. Decoding Side . . . . . . . . . . . . . . . . . . . . . . 23 97 7. Implementation Status . . . . . . . . . . . . . . . . . . . . 24 98 8. Security Considerations . . . . . . . . . . . . . . . . . . . 24 99 8.1. Attacks Against the Data Flow . . . . . . . . . . . . . . 24 100 8.1.1. Access to Confidential Content . . . . . . . . . . . 24 101 8.1.2. Content Corruption . . . . . . . . . . . . . . . . . 24 102 8.2. Attacks Against the FEC Parameters . . . . . . . . . . . 25 103 8.3. When Several Source Flows are to be Protected Together . 25 104 8.4. Baseline Secure FEC Framework Operation . . . . . . . . . 25 105 9. Operations and Management Considerations . . . . . . . . . . 25 106 9.1. Operational Recommendations: Finite Field GF(2) Versus 107 GF(2^^8) . . . . . . . . . . . . . . . . . . . . . . . . 26 108 9.2. Operational Recommendations: Coding Coefficients Density 109 Threshold . . . . . . . . . . . . . . . . . . . . . . . . 26 110 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 26 111 11. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 27 112 12. References . . . . . . . . . . . . . . . . . . . . . . . . . 27 113 12.1. Normative References . . . . . . . . . . . . . . . . . . 27 114 12.2. Informative References . . . . . . . . . . . . . . . . . 27 115 Appendix A. TinyMT32 Pseudo-Random Number Generator . . . . . . 29 116 Appendix B. Decoding Beyond Maximum Latency Optimization . . . . 32 117 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 33 119 1. Introduction 121 Application-Level Forward Erasure Correction (AL-FEC) codes, or 122 simply FEC codes, are a key element of communication systems. They 123 are used to recover from packet losses (or erasures) during content 124 delivery sessions to a large number of receivers (multicast/broadcast 125 transmissions). This is the case with the FLUTE/ALC protocol 126 [RFC6726] when used for reliable file transfers over lossy networks, 127 and the FECFRAME protocol when used for reliable continuous media 128 transfers over lossy networks. 130 The present document only focusses on the FECFRAME protocol, used in 131 multicast/broadcast delivery mode, with contents that feature 132 stringent real-time constraints: each source packet has a maximum 133 validity period after which it will not be considered by the 134 destination application. 136 1.1. Limits of Block Codes with Real-Time Flows 138 With FECFRAME, there is a single FEC encoding point (either a end- 139 host/server (source) or a middlebox) and a single FEC decoding point 140 (either a end-host (receiver) or middlebox). In this context, 141 currently standardized AL-FEC codes for FECFRAME like Reed-Solomon 142 [RFC6865], LDPC-Staircase [RFC6816], or Raptor/RaptorQ, are all 143 linear block codes: they require the data flow to be segmented into 144 blocks of a predefined maximum size. 146 To define this block size, it is required to find an appropriate 147 balance between robustness and decoding latency: the larger the block 148 size, the higher the robustness (e.g., in front of long packet 149 erasure bursts), but also the higher the maximum decoding latency 150 (i.e., the maximum time required to recover a lost (erased) packet 151 thanks to FEC protection). Therefore, with a multicast/broadcast 152 session where different receivers experience different packet loss 153 rates, the block size should be chosen by considering the worst 154 communication conditions one wants to support, but without exceeding 155 the desired maximum decoding latency. This choice then impacts the 156 FEC-related latency of all receivers, even those experiencing a good 157 communication quality, since no FEC encoding can happen until all the 158 source data of the block is available at the sender, which directly 159 depends on the block size. 161 1.2. Lower Latency and Better Protection of Real-Time Flows with the 162 Sliding Window RLC Codes 164 This document introduces two fully-specified FEC Schemes that follow 165 a totally different approach: the Sliding Window Random Linear Codes 166 (RLC) over either Finite Field GF(2) or GF(2^^8). These FEC Schemes 167 are used to protect arbitrary media streams along the lines defined 168 by FECFRAME extended to sliding window FEC codes [fecframe-ext]. 169 These FEC Schemes, and more generally Sliding Window FEC codes, are 170 recommended for instance with media that feature real-time 171 constraints sent within a multicast/broadcast session [Roca17]. 173 The RLC codes belong to the broad class of sliding window AL-FEC 174 codes (A.K.A. convolutional codes). The encoding process is based on 175 an encoding window that slides over the set of source packets (in 176 fact source symbols as we will see in Section 3.2), and which is 177 either of fixed or variable size (elastic window). Repair packets 178 (symbols) are generated on-the-fly, computing a random linear 179 combination of the source symbols present in the current encoding 180 window, and passed to the transport layer. 182 At the receiver, a linear system is managed from the set of received 183 source and repair packets. New variables (representing source 184 symbols) and equations (representing the linear combination of each 185 repair symbol received) are added upon receiving new packets. 186 Variables are removed when they are too old with respect to their 187 validity period (real-time constraints), as well as the associated 188 equations they are involved in (Appendix B introduces an optimization 189 that extends the time a variable is considered in the system). Lost 190 source symbols are then recovered thanks to this linear system 191 whenever its rank permits it. 193 With RLC codes (more generally with sliding window codes), the 194 protection of a multicast/broadcast session also needs to be 195 dimensioned by considering the worst communication conditions one 196 wants to support. However the receivers experiencing a good to 197 medium communication quality will observe a reduced FEC-related 198 latency compared to block codes [Roca17] since an isolated lost 199 source packet is quickly recovered with the following repair packet. 200 On the opposite, with a block code, recovering an isolated lost 201 source packet always requires waiting for the first repair packet to 202 arrive after the end of the block. Additionally, under certain 203 situations (e.g., with a limited FEC-related latency budget and with 204 constant bitrate transmissions after FECFRAME encoding), sliding 205 window codes can more efficiently achieve a target transmission 206 quality (e.g., measured by the residual loss after FEC decoding) by 207 sending fewer repair packets (i.e., higher code rate) than block 208 codes. 210 1.3. Small Transmission Overheads with the Sliding Window RLC FEC 211 Scheme 213 The Sliding Window RLC FEC Scheme is designed to limit the packet 214 header overhead. The main requirement is that each repair packet 215 header must enable a receiver to reconstruct the set of source 216 symbols plus the associated coefficients used during the encoding 217 process. In order to minimize packet overhead, the set of source 218 symbols in the encoding window as well as the set of coefficients 219 over GF(2^^m) (where m is 1 or 8, depending on the FEC Scheme) used 220 in the linear combination are not individually listed in the repair 221 packet header. Instead, each FEC Repair Packet header contains: 223 o the Encoding Symbol Identifier (ESI) of the first source symbol in 224 the encoding window as well as the number of symbols (since this 225 number may vary with a variable size, elastic window). These two 226 pieces of information enable each receiver to reconstruct the set 227 of source symbols considered during encoding, the only constraint 228 being that there cannot be any gap; 229 o the seed used by a coding coefficients generation function 230 (Section 3.5). This information enables each receiver to generate 231 the same set of coding coefficients over GF(2^^m) as the sender; 233 Therefore, no matter the number of source symbols present in the 234 encoding window, each FEC Repair Packet features a fixed 64-bit long 235 header, called Repair FEC Payload ID (Figure 7). Similarly, each FEC 236 Source Packet features a fixed 32-bit long trailer, called Explicit 237 Source FEC Payload ID (Figure 5), that contains the ESI of the first 238 source symbol (see the ADUI and source symbol mapping, Section 3.2). 240 1.4. Document Organization 242 This fully-specified FEC Scheme follows the structure required by 243 [RFC6363], section 5.6. "FEC Scheme Requirements", namely: 245 3. Procedures: This section describes procedures specific to this 246 FEC Scheme, namely: RLC parameters derivation, ADUI and source 247 symbols mapping, pseudo-random number generator, and coding 248 coefficients generation function; 249 4. Formats and Codes: This section defines the Source FEC Payload 250 ID and Repair FEC Payload ID formats, carrying the signalling 251 information associated to each source or repair symbol. It also 252 defines the FEC Framework Configuration Information (FFCI) 253 carrying signalling information for the session; 254 5. FEC Code Specification: Finally this section provides the code 255 specification. 257 2. Definitions and Abbreviations 259 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 260 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 261 document are to be interpreted as described in [RFC2119]. 263 This document uses the following definitions and abbreviations: 265 GF(q) denotes a finite field (also known as the Galois Field) with q 266 elements. We assume that q = 2^^m in this document 267 m defines the length of the elements in the finite field, in bits. 268 In this document, m is equal to 1 or 8 269 ADU: Application Data Unit 270 ADUI: Application Data Unit Information (includes the F, L and 271 padding fields in addition to the ADU) 272 E: size of an encoding symbol (i.e., source or repair symbol), 273 assumed fixed (in bytes) 274 br_in: transmission bitrate at the input of the FECFRAME sender, 275 assumed fixed (in bits/s) 276 br_out: transmission bitrate at the output of the FECFRAME sender, 277 assumed fixed (in bits/s) 278 max_lat: maximum FEC-related latency within FECFRAME (in seconds) 279 cr: RLC coding rate, ratio between the total number of source 280 symbols and the total number of source plus repair symbols 281 ew_size: encoding window current size at a sender (in symbols) 282 ew_max_size: encoding window maximum size at a sender (in symbols) 283 dw_max_size: decoding window maximum size at a receiver (in symbols) 284 ls_max_size: linear system maximum size (or width) at a receiver (in 285 symbols) 286 PRNG: pseudo-random number generator 287 tinymt32_rand(maxv): PRNG defined in Section 3.4 and used in this 288 specification, that returns a new random integer in [0; maxv-1] 289 DT: coding coefficients density threshold, an integer between 0 and 290 15 (inclusive) the controls the fraction of coefficients that are 291 non zero 293 3. Procedures 295 This section introduces the procedures that are used by these FEC 296 Schemes. 298 3.1. Possible Parameter Derivations 300 The Sliding Window RLC FEC Scheme relies on several parameters: 302 Maximum FEC-related latency budget, max_lat (in seconds) with real- 303 time flows: 304 a source ADU flow can have real-time constraints, and therefore 305 any FECFRAME related operation must take place within the validity 306 period of each ADU. When there are multiple flows with different 307 real-time constraints, we consider the most stringent constraints 308 (see [RFC6363], Section 10.2, item 6, for recommendations when 309 several flows are globally protected). The maximum FEC-related 310 latency budget, max_lat, accounts for all sources of latency added 311 by FEC encoding (at a sender) and FEC decoding (at a receiver). 312 Other sources of latency (e.g., added by network communications) 313 are out of scope and must be considered separately (said 314 differently, they have already been deducted from max_lat). 315 max_lat can be regarded as the latency budget permitted for all 316 FEC-related operations. This is an input parameter that enables a 317 FECFRAME sender to derive other internal parameters as explained 318 below; 319 Encoding window current (resp. maximum) size, ew_size (resp. 320 ew_max_size) (in symbols): 321 at a FECFRAME sender, during FEC encoding, a repair symbol is 322 computed as a linear combination of the ew_size source symbols 323 present in the encoding window. The ew_max_size is the maximum 324 size of this window, while ew_size is the current size. For 325 instance, at session start, upon receiving new source ADUs, the 326 ew_size progressively increases until it reaches its maximum 327 value, ew_max_size. We have: 329 ew_size <= ew_max_size 331 Decoding window maximum size, dw_max_size (in symbols): at a 332 FECFRAME receiver, dw_max_size is the maximum number of received 333 or lost source symbols that are still within their latency budget; 334 Linear system maximum size, ls_max_size (in symbols): at a FECFRAME 335 receiver, the linear system maximum size, ls_max_size, is the 336 maximum number of received or lost source symbols in the linear 337 system (i.e., the variables). It SHOULD NOT be smaller than 338 dw_max_size since it would mean that, even after receiving a 339 sufficient number of FEC Repair Packets, a lost ADU may not be 340 recovered just because the associated source symbols have been 341 prematurely removed from the linear system, which is usually 342 counter-productive. On the opposite, the linear system MAY grow 343 beyond the dw_max_size (Appendix B); 344 Symbol size, E (in bytes): the E parameter determines the source and 345 repair symbol sizes (necessarily equal). This is an input 346 parameter that enables a FECFRAME sender to derive other internal 347 parameters, as explained below. An implementation at a sender 348 SHOULD fix the E parameter and communicate it as part of the FEC 349 Scheme-Specific Information (Section 4.1.1.2). 350 Code rate, cr: The code rate parameter determines the amount of 351 redundancy added to the flow. More precisely the cr is the ratio 352 between the total number of source symbols and the total number of 353 source plus repair symbols and by definition: 0 < cr <= 1. This 354 is an input parameter that enables a FECFRAME sender to derive 355 other internal parameters, as explained below. However there is 356 no need to communicate the cr parameter per see (it's not required 357 to process a repair symbol at a receiver). This code rate 358 parameter can be fixed. However, in specific use-cases (e.g., 359 with unicast transmissions in presence of a feedback mechanism 360 that estimates the communication quality, out of scope of 361 FECFRAME), the code rate may be adjusted dynamically. 363 The FEC Schemes can be used in various manners. They can be used to 364 protect a source ADU flow having real-time constraints, or a non- 365 realtime source ADU flow. The source ADU flow may be a Constant 366 Bitrate (CBR) or Variable BitRate (VBR) flow. The features of the 367 flow (in particular its minimum/maximum bitrate) may be known or not. 368 The FEC Schemes can also be used over the Internet or over a CBR 369 communication path. It follows that the FEC Scheme parameters can be 370 derived in different ways, as described in the following sections. 372 3.1.1. Case of a CBR Real-Time Flow 374 In the following, we consider a real-time flow with max_lat latency 375 budget. The encoding symbol size, E, is constant. The code rate, 376 cr, is also constant, its value depending on the expected 377 communication loss model (this choice is out of scope of this 378 document). 380 In a first configuration, the source ADU flow bitrate at the input of 381 the FECFRAME sender is fixed and equal to br_in (in bits/s), and this 382 value is known by the FECFRAME sender. It follows that the 383 transmission bitrate at the output of the FECFRAME sender will be 384 higher, depending on the added repair flow overhead. In order to 385 comply with the maximum FEC-related latency budget, we have: 387 dw_max_size = (max_lat * br_in) / (8 * E) 389 In a second configuration, the FECFRAME sender generates a fixed 390 bitrate flow, equal to the CBR communication path bitrate equal to 391 br_out (in bits/s), and this value is known by the FECFRAME sender, 392 as in [Roca17]. The maximum source flow bitrate needs to be such 393 that, with the added repair flow overhead, the total transmission 394 bitrate remains inferior or equal to br_out. We have: 396 dw_max_size = (max_lat * br_out * cr) / (8 * E) 398 For decoding to be possible within the latency budget, it is required 399 that the encoding window maximum size be smaller than or at most 400 equal to the decoding window maximum size, the exact value having no 401 impact on the the FEC-related latency budget. For the FEC Schemes 402 specified in this document, in line with [Roca17], the ew_max_size 403 SHOULD be computed with: 405 ew_max_size = dw_max_size * 0.75 407 The ew_max_size is the main parameter at a FECFRAME sender. 409 The dw_max_size is computed by a FECFRAME sender but not explicitly 410 communicated to a FECFRAME receiver. However a FECFRAME receiver can 411 easily evaluate the ew_max_size by observing the maximum Number of 412 Source Symbols (NSS) value contained in the Repair FEC Payload ID of 413 received FEC Repair Packets (Section 4.1.3). A receiver can then 414 easily compute dw_max_size: 416 dw_max_size = max_NSS_observed / 0.75 418 A receiver can then chose an appropriate linear system maximum size: 420 ls_max_size >= dw_max_size 422 It is good practice to use a larger value for ls_max_size as 423 explained in Appendix B, which does not impact maximum latency nor 424 interoperability. However the linear system size should not be too 425 large for practical reasons (e.g., in order to limit computation 426 complexity). 428 The particular case of session start needs to be managed 429 appropriately. Here ew_size increases each time a new source ADU is 430 received by the FECFRAME sender, until it reaches the ew_max_size 431 value. A FECFRAME receiver SHOULD continuously observe the received 432 FEC Repair Packets, since the NSS value carried in the Repair FEC 433 Payload ID will increase too, and adjust its ls_max_size accordingly 434 if need be. 436 3.1.2. Other Types of Real-Time Flow 438 In other configurations, a real-time source ADU flow, with a max_lat 439 latency budget, features a variable bitrate (VBR). A first approach 440 consists in considering the smallest instantaneous bitrate of the 441 source ADU flow, when this parameter is known, and to reuse the 442 derivation of Section 3.1.1. Considering the smallest bitrate means 443 that the encoding window and decoding window maximum sizes estimation 444 are pessimistic: these windows have the smallest size required to 445 enable a decoding on-time at a FECFRAME receiver. If the 446 instantaneous bitrate is higher than this smallest bitrate, this 447 approach leads to an encoding window that is unnecessarily small, 448 which reduces robustness in front of long erasure bursts. 450 Another approach consists in using ADU timing information (e.g., 451 using the timestamp field of an RTP packet header, or registering the 452 time upon receiving a new ADU). From the global FEC-related latency 453 budget the FECFRAME sender can derive a practical maximum latency 454 budget for encoding operations, max_lat_for_encoding. For the FEC 455 Schemes specified in this document, this latency budget SHOULD be 456 computed with: 458 max_lat_for_encoding = max_lat * 0.75 460 It follows that any source symbols associated to an ADU that has 461 timed-out with respect to max_lat_for_encoding SHOULD be removed from 462 the encoding window. With this approach there is no pre-determined 463 ew_size value: this value fluctuates over the time according to the 464 instantaneous source ADU flow bitrate. For practical reasons, a 465 FECFRAME sender may still require that ew_size does not increase 466 beyond a maximum value (Section 3.1.3). 468 With both approaches, and no matter the choice of the FECFRAME 469 sender, a FECFRAME receiver can still easily evaluate the ew_max_size 470 by observing the maximum Number of Source Symbols (NSS) value 471 contained in the Repair FEC Payload ID of received FEC Repair 472 Packets. A receiver can then compute dw_max_size and derive an 473 appropriate ls_max_size as explained in Section 3.1.1. 475 When the observed NSS fluctuates significantly, a FECFRAME receiver 476 may want to adapt its ls_max_size accordingly. In particular when 477 the NSS is significantly reduced, a FECFRAME receiver may want to 478 reduce the ls_max_size too in order to limit computation complexity. 479 However it is usually preferable to use a ls_max_size "too large" 480 (which can increase computation complexity and memory requirements) 481 than the opposite (which can reduce recovery performance). 483 Beyond these general guidelines, the details of how to manage these 484 situations at a FECFRAME sender and receiver can depend on additional 485 considerations that are out of scope of this document. 487 3.1.3. Case of a Non Real-Time Flow 489 Finally there are configurations where a source ADU flow has no real- 490 time constraints. FECFRAME and the FEC Schemes defined in this 491 document can still be used. The choice of appropriate parameter 492 values can be directed by practical considerations. For instance it 493 can derive from an estimation of the maximum memory amount that could 494 be dedicated to the linear system at a FECFRAME receiver, or the 495 maximum computation complexity at a FECFRAME receiver, both of them 496 depending on the ls_max_size parameter. The same considerations also 497 apply to the FECFRAME sender, where the maximum memory amount and 498 computation complexity depend on the ew_max_size parameter. 500 Here also, the NSS value contained in FEC Repair Packets is used by a 501 FECFRAME receiver to determine the current coding window size and 502 ew_max_size by observing its maximum value over the time. 504 Beyond these general guidelines, the details of how to manage these 505 situations at a FECFRAME sender and receiver can depend on additional 506 considerations that are out of scope of this document. 508 3.2. ADU, ADUI and Source Symbols Mappings 510 At a sender, an ADU coming from the application cannot directly be 511 mapped to source symbols. When multiple source flows (e.g., media 512 streams) are mapped onto the same FECFRAME instance, each flow is 513 assigned its own Flow ID value (see below). At a sender, this 514 identifier is prepended to each ADU before FEC encoding. This way, 515 FEC decoding at a receiver also recovers this Flow ID and a recovered 516 ADU can be assigned to the right source flow (note that transport 517 port numbers and IP addresses cannot be used to that purpose as they 518 are not recovered during FEC decoding). 520 Additionally, since ADUs are of variable size, padding is needed so 521 that each ADU (with its flow identifier) contribute to an integral 522 number of source symbols. This requires adding the original ADU 523 length to each ADU before doing FEC encoding. Because of these 524 requirements, an intermediate format, the ADUI, or ADU Information, 525 is considered [RFC6363]. 527 For each incoming ADU, an ADUI MUST created as follows. First of 528 all, 3 bytes are prepended (Figure 1): 530 Flow ID (F) (8-bit field): this unsigned byte contains the integer 531 identifier associated to the source ADU flow to which this ADU 532 belongs. It is assumed that a single byte is sufficient, which 533 implies that no more than 256 flows will be protected by a single 534 FECFRAME session instance. 535 Length (L) (16-bit field): this unsigned integer contains the length 536 of this ADU, in network byte order (i.e., big endian). This 537 length is for the ADU itself and does not include the F, L, or Pad 538 fields. 540 Then, zero padding is added to the ADU if needed: 542 Padding (Pad) (variable size field): this field contains zero 543 padding to align the F, L, ADU and padding up to a size that is 544 multiple of E bytes (i.e., the source and repair symbol length). 546 The data unit resulting from the ADU and the F, L, and Pad fields is 547 called ADUI. Since ADUs can have different sizes, this is also the 548 case for ADUIs. However an ADUI always contributes to an integral 549 number of source symbols. 551 symbol length, E E E 552 < ------------------ >< ------------------ >< ------------------ > 553 +-+--+---------------------------------------------+-------------+ 554 |F| L| ADU | Pad | 555 +-+--+---------------------------------------------+-------------+ 557 Figure 1: ADUI Creation example (here 3 source symbols are created 558 for this ADUI). 560 Note that neither the initial 3 bytes nor the optional padding are 561 sent over the network. However, they are considered during FEC 562 encoding, and a receiver who lost a certain FEC Source Packet (e.g., 563 the UDP datagram containing this FEC Source Packet when UDP is used 564 as the transport protocol) will be able to recover the ADUI if FEC 565 decoding succeeds. Thanks to the initial 3 bytes, this receiver will 566 get rid of the padding (if any) and identify the corresponding ADU 567 flow. 569 3.3. Encoding Window Management 571 Source symbols and the corresponding ADUs are removed from the 572 encoding window: 574 o when the sliding encoding window has reached its maximum size, 575 ew_max_size. In that case the oldest symbol MUST be removed 576 before adding a new symbol, so that the current encoding window 577 size always remains inferior or equal to the maximum size: ew_size 578 <= ew_max_size; 579 o when an ADU has reached its maximum validity duration in case of a 580 real-time flow. When this happens, all source symbols 581 corresponding to the ADUI that expired SHOULD be removed from the 582 encoding window; 584 Source symbols are added to the sliding encoding window each time a 585 new ADU arrives, once the ADU to source symbols mapping has been 586 performed (Section 3.2). The current size of the encoding window, 587 ew_size, is updated after adding new source symbols. This process 588 may require to remove old source symbols so that: ew_size <= 589 ew_max_size. 591 Note that a FEC codec may feature practical limits in the number of 592 source symbols in the encoding window (e.g., for computational 593 complexity reasons). This factor may further limit the ew_max_size 594 value, in addition to the maximum FEC-related latency budget 595 (Section 3.1). 597 3.4. Pseudo-Random Number Generator (PRNG) 599 The RLC FEC Schemes defined in this document rely on the TinyMT32 600 PRNG, a small-sized variant of the Mersenne Twister PRNG, as defined 601 in the reference implementation version 1.1 (2015/04/24) by Mutsuo 602 Saito (Hiroshima University) and Makoto Matsumoto (The University of 603 Tokyo). 605 o Official web site: 607 o Official github site and reference implementation: 608 610 For the RLC FEC Schemes defined in this document, the tinymt32 32-bit 611 version (rather than the 64-bit version) MUST be used. This PRNG 612 requires a parameter set that needs to be pre-calculated. For the 613 RLC FEC Schemes defined in this document, the following parameter set 614 MUST be used: 616 o mat1 = 0x8f7011ee = 2406486510; 617 o mat2 = 0xfc78ff1f = 4235788063; 618 o tmat = 0x3793fdff = 932445695. 620 This parameter set is the first entry of the precalculated parameter 621 sets in file tinymt32dc.0.1048576.txt, by Kenji Rikitake, and 622 available at: 624 o . 627 This is also the parameter set used in [KR12]. 629 The PRNG reference implementation is distributed under a BSD license 630 and excerpts of it are reproduced in Appendix A. In order to 631 validate an implementation of this PRNG, using seed 1, the 10,000th 632 value returned by: tinymt32_rand(s, 0xffff) MUST be equal to 0x7c37. 634 This PRNG MUST first be initialized with a 32-bit unsigned integer, 635 used as a seed. The following function is used to this purpose: 637 void tinymt32_init (tinymt32_t * s, uint32_t seed); 639 With the FEC Schemes defined in this document, the seed is in 640 practice restricted to a value between 0 and 0xFFFF inclusive (note 641 that this PRNG accepts a seed equal to 0), since this is the 642 Repair_Key 16-bit field value of the Repair FEC Payload ID 643 (Section 4.1.3). In addition to the seed, this function takes as 644 parameter a pointer to an instance of a tinymt32_t structure that is 645 used to keep the internal state of the PRNG. 647 Then, each time a new pseudo-random integer between 0 and maxv-1 648 inclusive is needed, the following function is used: 650 uint32_t tinymt32_rand (tinymt32_t * s, uint32_t maxv); 652 This function takes as parameter both a pointer to the same 653 tinymt32_t structure (that needs to be left unchanged between 654 successive calls to the function) and the maxv value. 656 3.5. Coding Coefficients Generation Function 658 The coding coefficients, used during the encoding process, are 659 generated at the RLC encoder by the generate_coding_coefficients() 660 function each time a new repair symbol needs to be produced. The 661 fraction of coefficients that are non zero (i.e., the density) is 662 controlled by the DT (Density Threshold) parameter. When DT equals 663 15, the maximum value, the function guaranties that all coefficients 664 are non zero (i.e., maximum density). When DT is between 0 (minimum 665 value) and strictly inferior to 15, the average probability of having 666 a non zero coefficient equals (DT +1) / 16. 668 These considerations apply both the RLC over GF(2) and RLC over 669 GF(2^^8), the only difference being the value of the m parameter. 670 With the RLC over GF(2) FEC Scheme (Section 5), m MUST be equal to 1. 671 With RLC over GF(2^^8) FEC Scheme (Section 4), m MUST be equal to 8. 673 674 /* 675 * Fills in the table of coding coefficients (of the right size) 676 * provided with the appropriate number of coding coefficients to 677 * use for the repair symbol key provided. 678 * 679 * (in) repair_key key associated to this repair symbol. This 680 * parameter is ignored (useless) if m=2 and dt=15 681 * (in) cc_tab[] pointer to a table of the right size to store 682 * coding coefficients. All coefficients are 683 * stored as bytes, regardless of the m parameter, 684 * upon return of this function. 685 * (in) cc_nb number of entries in the table. This value is 686 * equal to the current encoding window size. 687 * (in) dt integer between 0 and 15 (inclusive) that 688 * controls the density. With value 15, all 689 * coefficients are guaranteed to be non zero 690 * (i.e. equal to 1 with GF(2) and equal to a 691 * value in {1,... 255} with GF(2^^8)), otherwise 692 * a fraction of them will be 0. 693 * (in) m Finite Field GF(2^^m) parameter. In this 694 * document only values 1 and 8 are considered. 695 * (out) returns an error code 696 */ 697 int generate_coding_coefficients (uint16_t repair_key, 698 uint8_t cc_tab[], 699 uint16_t cc_nb, 700 uint8_t dt, 701 uint8_t m) 702 { 703 uint32_t i; 704 tinymt32_t s; /* PRNG internal state */ 706 if (dt > 15) { 707 return SOMETHING_WENT_WRONG; /* bad dt parameter */ 708 } 709 switch (m) { 710 case 1: 711 if (dt == 15) { 712 /* all coefficients are 1 */ 713 memset(cc_tab, 1, cc_nb); 714 } else { 715 /* here coefficients are either 0 or 1 */ 716 tinymt32_init(&s, repair_key); 717 for (i = 0 ; i < cc_nb ; i++) { 718 if (tinymt32_rand(&s, 16) <= dt) { 719 cc_tab[i] = (uint8_t) 1; 720 } else { 721 cc_tab[i] = (uint8_t) 0; 722 } 723 } 724 } 725 break; 727 case 8: 728 tinymt32_init(&s, repair_key); 729 if (dt == 15) { 730 /* coefficient 0 is avoided here in order to include 731 * all the source symbols */ 732 for (i = 0 ; i < cc_nb ; i++) { 733 do { 734 cc_tab[i] = (uint8_t) tinymt32_rand(&s, 256); 735 } while (cc_tab[i] == 0); 736 } 737 } else { 738 /* here a certain fraction of coefficients should be 0 */ 739 for (i = 0 ; i < cc_nb ; i++) { 740 if (tinymt32_rand(&s, 16) <= dt) { 741 do { 742 cc_tab[i] = (uint8_t) tinymt32_rand(&s, 256); 743 } while (cc_tab[i] == 0); 744 } else { 745 cc_tab[i] = 0; 746 } 747 } 748 } 749 break; 751 default: 752 /* bad parameter m */ 753 return SOMETHING_WENT_WRONG; 754 } 755 return EVERYTHING_IS_OKAY; 756 } 757 759 Figure 2: Coding Coefficients Generation Function pseudo-code 761 3.6. Finite Fields Operations 763 3.6.1. Finite Field Definitions 765 The two RLC FEC Schemes specified in this document reuse the Finite 766 Fields defined in [RFC5510], section 8.1. More specifically, the 767 elements of the field GF(2^^m) are represented by polynomials with 768 binary coefficients (i.e., over GF(2)) and degree lower or equal to 769 m-1. The addition between two elements is defined as the addition of 770 binary polynomials in GF(2), which is equivalent to a bitwise XOR 771 operation on the binary representation of these elements. 773 With GF(2^^8), multiplication between two elements is the 774 multiplication modulo a given irreducible polynomial of degree 8. 775 The following irreducible polynomial MUST be used for GF(2^^8): 777 x^^8 + x^^4 + x^^3 + x^^2 + 1 779 With GF(2), multiplication corresponds to a logical AND operation. 781 3.6.2. Linear Combination of Source Symbols Computation 783 The two RLC FEC Schemes require the computation of a linear 784 combination of source symbols, using the coding coefficients produced 785 by the generate_coding_coefficients() function and stored in the 786 cc_tab[] array. 788 With the RLC over GF(2^^8) FEC Scheme, a linear combination of the 789 ew_size source symbol present in the encoding window, say src_0 to 790 src_ew_size_1, in order to generate a repair symbol, is computed as 791 follows. For each byte of position i in each source and the repair 792 symbol, where i belongs to {0; E-1}, compute: 794 repair[i] = cc_tab[0] * src_0[i] + cc_tab[1] * src_1[i] + ... + 795 cc_tab[ew_size - 1] * src_ew_size_1[i] 797 where * is the multiplication over GF(2^^8) and + is an XOR 798 operation. In practice various optimizations need to be used in 799 order to make this computation efficient (see in particular [PGM13]). 801 With the RLC over GF(2) FEC Scheme (binary case), a linear 802 combination is computed as follows. The repair symbol is the XOR sum 803 of all the source symbols corresponding to a coding coefficient 804 cc_tab[j] equal to 1 (i.e., the source symbols corresponding to zero 805 coding coefficients are ignored). The XOR sum of the byte of 806 position i in each source is computed and stored in the corresponding 807 byte of the repair symbol, where i belongs to {0; E-1}. In practice, 808 the XOR sums will be computed several bytes at a time (e.g., on 64 809 bit words, or on arrays of 16 or more bytes when using SIMD CPU 810 extensions). 812 With both FEC Schemes, the details of how to optimize the computation 813 of these linear combinations are of high practical importance but out 814 of scope of this document. 816 4. Sliding Window RLC FEC Scheme over GF(2^^8) for Arbitrary ADU Flows 818 This fully-specified FEC Scheme defines the Sliding Window Random 819 Linear Codes (RLC) over GF(2^^8). 821 4.1. Formats and Codes 823 4.1.1. FEC Framework Configuration Information 825 Following the guidelines of [RFC6363], section 5.6, this section 826 provides the FEC Framework Configuration Information (or FFCI). This 827 FCCI needs to be shared (e.g., using SDP) between the FECFRAME sender 828 and receiver instances in order to synchronize them. It includes a 829 FEC Encoding ID, mandatory for any FEC Scheme specification, plus 830 scheme-specific elements. 832 4.1.1.1. FEC Encoding ID 834 o FEC Encoding ID: the value assigned to this fully specified FEC 835 Scheme MUST be XXXX, as assigned by IANA (Section 10). 837 When SDP is used to communicate the FFCI, this FEC Encoding ID is 838 carried in the 'encoding-id' parameter. 840 4.1.1.2. FEC Scheme-Specific Information 842 The FEC Scheme-Specific Information (FSSI) includes elements that are 843 specific to the present FEC Scheme. More precisely: 845 Encoding symbol size (E): a non-negative integer that indicates the 846 size of each encoding symbol in bytes; 848 This element is required both by the sender (RLC encoder) and the 849 receiver(s) (RLC decoder). 851 When SDP is used to communicate the FFCI, this FEC Scheme-specific 852 information is carried in the 'fssi' parameter in textual 853 representation as specified in [RFC6364]. For instance: 855 fssi=E:1400 856 If another mechanism requires the FSSI to be carried as an opaque 857 octet string (for instance, after a Base64 encoding), the encoding 858 format consists of the following 2 octets: 860 Encoding symbol length (E): 16-bit field. 862 0 1 863 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 864 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 865 | Encoding Symbol Length (E) | 866 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 868 Figure 3: FSSI Encoding Format 870 4.1.2. Explicit Source FEC Payload ID 872 A FEC Source Packet MUST contain an Explicit Source FEC Payload ID 873 that is appended to the end of the packet as illustrated in Figure 4. 875 +--------------------------------+ 876 | IP Header | 877 +--------------------------------+ 878 | Transport Header | 879 +--------------------------------+ 880 | ADU | 881 +--------------------------------+ 882 | Explicit Source FEC Payload ID | 883 +--------------------------------+ 885 Figure 4: Structure of an FEC Source Packet with the Explicit Source 886 FEC Payload ID 888 More precisely, the Explicit Source FEC Payload ID is composed of the 889 following field (Figure 5): 891 Encoding Symbol ID (ESI) (32-bit field): this unsigned integer 892 identifies the first source symbol of the ADUI corresponding to 893 this FEC Source Packet. The ESI is incremented for each new 894 source symbol, and after reaching the maximum value (2^32-1), 895 wrapping to zero occurs. 897 0 1 2 3 898 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 899 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 900 | Encoding Symbol ID (ESI) | 901 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 903 Figure 5: Source FEC Payload ID Encoding Format 905 4.1.3. Repair FEC Payload ID 907 A FEC Repair Packet MAY contain one or more repair symbols. When 908 there are several repair symbols, all of them MUST have been 909 generated from the same encoding window, using Repair_Key values that 910 are managed as explained below. A receiver can easily deduce the 911 number of repair symbols within a FEC Repair Packet by comparing the 912 received FEC Repair Packet size (equal to the UDP payload size when 913 UDP is the underlying transport protocol) and the symbol size, E, 914 communicated in the FFCI. 916 A FEC Repair Packet MUST contain a Repair FEC Payload ID that is 917 prepended to the repair symbol as illustrated in Figure 6. 919 +--------------------------------+ 920 | IP Header | 921 +--------------------------------+ 922 | Transport Header | 923 +--------------------------------+ 924 | Repair FEC Payload ID | 925 +--------------------------------+ 926 | Repair Symbol | 927 +--------------------------------+ 929 Figure 6: Structure of an FEC Repair Packet with the Repair FEC 930 Payload ID 932 More precisely, the Repair FEC Payload ID is composed of the 933 following fields (Figure 7): 935 Repair_Key (16-bit field): this unsigned integer is used as a seed 936 by the coefficient generation function (Section 3.5) in order to 937 generate the desired number of coding coefficients. When a FEC 938 Repair Packet contains several repair symbols, this repair key 939 value is that of the first repair symbol. The remaining repair 940 keys can be deduced by incrementing by 1 this value, up to a 941 maximum value of 65535 after which it loops back to 0. 942 Density Threshold for the coding coefficients, DT (4-bit field): 943 this unsigned integer carries the Density Threshold (DT) used by 944 the coding coefficient generation function Section 3.5. More 945 precisely, it controls the probability of having a non zero coding 946 coefficient, which equals (DT+1) / 16. When a FEC Repair Packet 947 contains several repair symbols, the DT value applies to all of 948 them; 949 Number of Source Symbols in the encoding window, NSS (12-bit field): 951 this unsigned integer indicates the number of source symbols in 952 the encoding window when this repair symbol was generated. When a 953 FEC Repair Packet contains several repair symbols, this NSS value 954 applies to all of them; 955 ESI of First Source Symbol in the encoding window, FSS_ESI (32-bit 956 field): 957 this unsigned integer indicates the ESI of the first source symbol 958 in the encoding window when this repair symbol was generated. 959 When a FEC Repair Packet contains several repair symbols, this 960 FSS_ESI value applies to all of them; 962 0 1 2 3 963 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 964 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 965 | Repair_Key | DT |NSS (# src symb in ew) | 966 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 967 | FSS_ESI | 968 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 970 Figure 7: Repair FEC Payload ID Encoding Format 972 4.1.4. Additional Procedures 974 The following procedure applies: 976 o The ESI of source symbols MUST start with value 0 for the first 977 source symbol and MUST be managed sequentially. Wrapping to zero 978 happens after reaching the maximum 32-bit value. 980 5. Sliding Window RLC FEC Scheme over GF(2) for Arbitrary ADU Flows 982 This fully-specified FEC Scheme defines the Sliding Window Random 983 Linear Codes (RLC) over GF(2) (binary case). 985 5.1. Formats and Codes 987 5.1.1. FEC Framework Configuration Information 989 5.1.1.1. FEC Encoding ID 991 o FEC Encoding ID: the value assigned to this fully specified FEC 992 Scheme MUST be YYYY, as assigned by IANA (Section 10). 994 When SDP is used to communicate the FFCI, this FEC Encoding ID is 995 carried in the 'encoding-id' parameter. 997 5.1.1.2. FEC Scheme-Specific Information 999 All the considerations of Section 4.1.1.2 apply here. 1001 5.1.2. Explicit Source FEC Payload ID 1003 All the considerations of Section 4.1.1.2 apply here. 1005 5.1.3. Repair FEC Payload ID 1007 All the considerations of Section 4.1.1.2 apply here, with the only 1008 exception that the Repair_Key field is useless if DT = 15 (indeed, in 1009 that case all the coefficients are necessarily equal to 1 and the 1010 coefficient generation function does not use any PRNG). When DT = 15 1011 it is RECOMMENDED that the sender use value 0 for the Repair_Key 1012 field, but a receiver SHALL ignore this field. 1014 5.1.4. Additional Procedures 1016 All the considerations of Section 4.1.1.2 apply here. 1018 6. FEC Code Specification 1020 6.1. Encoding Side 1022 This section provides a high level description of a Sliding Window 1023 RLC encoder. 1025 Whenever a new FEC Repair Packet is needed, the RLC encoder instance 1026 first gathers the ew_size source symbols currently in the sliding 1027 encoding window. Then it chooses a repair key, which can be a 1028 monotonically increasing integer value, incremented for each repair 1029 symbol up to a maximum value of 65535 (as it is carried within a 1030 16-bit field) after which it loops back to 0. This repair key is 1031 communicated to the coefficient generation function (Section 3.5) in 1032 order to generate ew_size coding coefficients. Finally, the FECFRAME 1033 sender computes the repair symbol as a linear combination of the 1034 ew_size source symbols using the ew_size coding coefficients 1035 (Section 3.6). When E is small and when there is an incentive to 1036 pack several repair symbols within the same FEC Repair Packet, the 1037 appropriate number of repair symbols are computed. In that case the 1038 repair key for each of them MUST be incremented by 1, keeping the 1039 same ew_size source symbols, since only the first repair key will be 1040 carried in the Repair FEC Payload ID. The FEC Repair Packet can then 1041 be passed to the transport layer for transmission. The source versus 1042 repair FEC packet transmission order is out of scope of this document 1043 and several approaches exist that are implementation specific. 1045 Other solutions are possible to select a repair key value when a new 1046 FEC Repair Packet is needed, for instance by choosing a random 1047 integer between 0 and 65535. However, selecting the same repair key 1048 as before (which may happen in case of a random process) is only 1049 meaningful if the encoding window has changed, otherwise the same FEC 1050 Repair Packet will be generated. 1052 6.2. Decoding Side 1054 This section provides a high level description of a Sliding Window 1055 RLC decoder. 1057 A FECFRAME receiver needs to maintain a linear system whose variables 1058 are the received and lost source symbols. Upon receiving a FEC 1059 Repair Packet, a receiver first extracts all the repair symbols it 1060 contains (in case several repair symbols are packed together). For 1061 each repair symbol, when at least one of the corresponding source 1062 symbols it protects has been lost, the receiver adds an equation to 1063 the linear system (or no equation if this repair packet does not 1064 change the linear system rank). This equation of course re-uses the 1065 ew_size coding coefficients that are computed by the same coefficient 1066 generation function (Section Section 3.5), using the repair key and 1067 encoding window descriptions carried in the Repair FEC Payload ID. 1068 Whenever possible (i.e., when a sub-system covering one or more lost 1069 source symbols is of full rank), decoding is performed in order to 1070 recover lost source symbols. Each time an ADUI can be totally 1071 recovered, padding is removed (thanks to the Length field, L, of the 1072 ADUI) and the ADU is assigned to the corresponding application flow 1073 (thanks to the Flow ID field, F, of the ADUI). This ADU is finally 1074 passed to the corresponding upper application. Received FEC Source 1075 Packets, containing an ADU, MAY be passed to the application either 1076 immediately or after some time to guaranty an ordered delivery to the 1077 application. This document does not mandate any approach as this is 1078 an operational and management decision. 1080 With real-time flows, a lost ADU that is decoded after the maximum 1081 latency or an ADU received after this delay has no value to the 1082 application. This raises the question of deciding whether or not an 1083 ADU is late. This decision MAY be taken within the FECFRAME receiver 1084 (e.g., using the decoding window, see Section 3.1) or within the 1085 application (e.g., using RTP timestamps within the ADU). Deciding 1086 which option to follow and whether or not to pass all ADUs, including 1087 those assumed late, to the application are operational decisions that 1088 depend on the application and are therefore out of scope of this 1089 document. Additionally, Appendix B discusses a backward compatible 1090 optimization whereby late source symbols MAY still be used within the 1091 FECFRAME receiver in order to improve transmission robustness. 1093 7. Implementation Status 1095 Editor's notes: RFC Editor, please remove this section motivated by 1096 RFC 6982 before publishing the RFC. Thanks. 1098 An implementation of the Sliding Window RLC FEC Scheme for FECFRAME 1099 exists: 1101 o Organisation: Inria 1102 o Description: This is an implementation of the Sliding Window RLC 1103 FEC Scheme limited to GF(2^^8). It relies on a modified version 1104 of our OpenFEC (http://openfec.org) FEC code library. It is 1105 integrated in our FECFRAME software (see [fecframe-ext]). 1106 o Maturity: prototype. 1107 o Coverage: this software complies with the Sliding Window RLC FEC 1108 Scheme. 1109 o Licensing: proprietary. 1110 o Contact: vincent.roca@inria.fr 1112 8. Security Considerations 1114 The FEC Framework document [RFC6363] provides a comprehensive 1115 analysis of security considerations applicable to FEC Schemes. 1116 Therefore, the present section follows the security considerations 1117 section of [RFC6363] and only discusses specific topics. 1119 8.1. Attacks Against the Data Flow 1121 8.1.1. Access to Confidential Content 1123 The Sliding Window RLC FEC Scheme specified in this document does not 1124 change the recommendations of [RFC6363]. To summarize, if 1125 confidentiality is a concern, it is RECOMMENDED that one of the 1126 solutions mentioned in [RFC6363] is used with special considerations 1127 to the way this solution is applied (e.g., is encryption applied 1128 before or after FEC protection, within the end-system or in a 1129 middlebox) to the operational constraints (e.g., performing FEC 1130 decoding in a protected environment may be complicated or even 1131 impossible) and to the threat model. 1133 8.1.2. Content Corruption 1135 The Sliding Window RLC FEC Scheme specified in this document does not 1136 change the recommendations of [RFC6363]. To summarize, it is 1137 RECOMMENDED that one of the solutions mentioned in [RFC6363] is used 1138 on both the FEC Source and Repair Packets. 1140 8.2. Attacks Against the FEC Parameters 1142 The FEC Scheme specified in this document defines parameters that can 1143 be the basis of attacks. More specifically, the following parameters 1144 of the FFCI may be modified by an attacker who targets receivers 1145 (Section 4.1.1.2): 1147 o FEC Encoding ID: changing this parameter leads the receivers to 1148 consider a different FEC Scheme, which enables an attacker to 1149 create a Denial of Service (DoS); 1150 o Encoding symbol length (E): setting this E parameter to a 1151 different value will confuse the receivers and create a DoS. More 1152 precisely, the FEC Repair Packets received will probably no longer 1153 be multiple of E, leading receivers to reject them; 1155 It is therefore RECOMMENDED that security measures are taken to 1156 guarantee the FFCI integrity, as specified in [RFC6363]. How to 1157 achieve this depends on the way the FFCI is communicated from the 1158 sender to the receiver, which is not specified in this document. 1160 Similarly, attacks are possible against the Explicit Source FEC 1161 Payload ID and Repair FEC Payload ID: by modifying the Encoding 1162 Symbol ID (ESI), or the repair key, NSS or FSS_ESI. It is therefore 1163 RECOMMENDED that security measures are taken to guarantee the FEC 1164 Source and Repair Packets as stated in [RFC6363]. 1166 8.3. When Several Source Flows are to be Protected Together 1168 The Sliding Window RLC FEC Scheme specified in this document does not 1169 change the recommendations of [RFC6363]. 1171 8.4. Baseline Secure FEC Framework Operation 1173 The Sliding Window RLC FEC Scheme specified in this document does not 1174 change the recommendations of [RFC6363] concerning the use of the 1175 IPsec/ESP security protocol as a mandatory to implement (but not 1176 mandatory to use) security scheme. This is well suited to situations 1177 where the only insecure domain is the one over which the FEC 1178 Framework operates. 1180 9. Operations and Management Considerations 1182 The FEC Framework document [RFC6363] provides a comprehensive 1183 analysis of operations and management considerations applicable to 1184 FEC Schemes. Therefore, the present section only discusses specific 1185 topics. 1187 9.1. Operational Recommendations: Finite Field GF(2) Versus GF(2^^8) 1189 The present document specifies two FEC Schemes that differ on the 1190 Finite Field used for the coding coefficients. It is expected that 1191 the RLC over GF(2^^8) FEC Scheme will be mostly used since it 1192 warrants a higher packet loss protection. In case of small encoding 1193 windows, the associated processing overhead is not an issue (e.g., we 1194 measured decoding speeds between 745 Mbps and 2.8 Gbps on an ARM 1195 Cortex-A15 embedded board in [Roca17]). Of course the CPU overhead 1196 will increase with the encoding window size, because more operations 1197 in the GF(2^^8) finite field will be needed. 1199 The RLC over GF(2) FEC Scheme offers an alternative. In that case 1200 operations symbols can be directly XOR-ed together which warrants 1201 high bitrate encoding and decoding operations, and can be an 1202 advantage with large encoding windows. However packet loss 1203 protection is significantly reduced by using this FEC Scheme. 1205 9.2. Operational Recommendations: Coding Coefficients Density Threshold 1207 In addition to the choice of the Finite Field, the two FEC Schemes 1208 define a coding coefficient density threshold (DT) parameter. This 1209 parameter enables a sender to control the code density, i.e., the 1210 proportion of coefficients that are non zero on average. With RLC 1211 over GF(2^^8), it is usually appropriate that small encoding windows 1212 be associated to a density threshold equal to 15, the maximum value, 1213 in order to warrant a high loss protection. 1215 On the opposite, with larger encoding windows, it is usually 1216 appropriate that the density threshold be reduced. With large 1217 encoding windows, an alternative can be to use RLC over GF(2) and a 1218 density threshold equal to 7 (i.e., an average density equal to 1/2) 1219 or smaller. 1221 Note that using a density threshold equal to 15 with RLC over GF(2) 1222 is equivalent to using an XOR code that compute the XOR sum of all 1223 the source symbols in the encoding window. In that case: (1) a 1224 single repair symbol can be produced for any encoding window, and (2) 1225 the repair_key parameter becomes useless (the coding coefficients 1226 generation function does not rely on the PRNG). 1228 10. IANA Considerations 1230 This document registers two values in the "FEC Framework (FECFRAME) 1231 FEC Encoding IDs" registry [RFC6363] as follows: 1233 o YYYY refers to the Sliding Window Random Linear Codes (RLC) over 1234 GF(2) FEC Scheme for Arbitrary Packet Flows, as defined in 1235 Section 5 of this document. 1236 o XXXX refers to the Sliding Window Random Linear Codes (RLC) over 1237 GF(2^^8) FEC Scheme for Arbitrary Packet Flows, as defined in 1238 Section 4 of this document. 1240 11. Acknowledgments 1242 The authors would like to thank Jonathan Detchart, Gorry Fairhurst, 1243 and Marie-Jose Montpetit for their valuable feedbacks on this 1244 document. 1246 12. References 1248 12.1. Normative References 1250 [fecframe-ext] 1251 Roca, V. and A. Begen, "Forward Error Correction (FEC) 1252 Framework Extension to Sliding Window Codes", Transport 1253 Area Working Group (TSVWG) draft-ietf-tsvwg-fecframe-ext 1254 (Work in Progress), March 2018, 1255 . 1258 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1259 Requirement Levels", BCP 14, RFC 2119, 1260 DOI 10.17487/RFC2119, March 1997, 1261 . 1263 [RFC6363] Watson, M., Begen, A., and V. Roca, "Forward Error 1264 Correction (FEC) Framework", RFC 6363, 1265 DOI 10.17487/RFC6363, October 2011, 1266 . 1268 [RFC6364] Begen, A., "Session Description Protocol Elements for the 1269 Forward Error Correction (FEC) Framework", RFC 6364, 1270 DOI 10.17487/RFC6364, October 2011, 1271 . 1273 12.2. Informative References 1275 [KR12] Rikitake, K., "TinyMT Pseudo Random Number Generator for 1276 Erlang", ACM 11th SIGPLAN Erlang Workshop (Erlang'12), 1277 September 14, 2012, Copenhagen, Denmark, DOI: 1278 http://dx.doi.org/10.1145/2364489.2364504, September 2012. 1280 [PGM13] Plank, J., Greenan, K., and E. Miller, "A Complete 1281 Treatment of Software Implementations of Finite Field 1282 Arithmetic for Erasure Coding Applications", University of 1283 Tennessee Technical Report UT-CS-13-717, 1284 http://web.eecs.utk.edu/~plank/plank/papers/ 1285 UT-CS-13-717.html, October 2013, 1286 . 1289 [RFC5510] Lacan, J., Roca, V., Peltotalo, J., and S. Peltotalo, 1290 "Reed-Solomon Forward Error Correction (FEC) Schemes", 1291 RFC 5510, DOI 10.17487/RFC5510, April 2009, 1292 . 1294 [RFC6726] Paila, T., Walsh, R., Luby, M., Roca, V., and R. Lehtonen, 1295 "FLUTE - File Delivery over Unidirectional Transport", 1296 RFC 6726, DOI 10.17487/RFC6726, November 2012, 1297 . 1299 [RFC6816] Roca, V., Cunche, M., and J. Lacan, "Simple Low-Density 1300 Parity Check (LDPC) Staircase Forward Error Correction 1301 (FEC) Scheme for FECFRAME", RFC 6816, 1302 DOI 10.17487/RFC6816, December 2012, 1303 . 1305 [RFC6865] Roca, V., Cunche, M., Lacan, J., Bouabdallah, A., and K. 1306 Matsuzono, "Simple Reed-Solomon Forward Error Correction 1307 (FEC) Scheme for FECFRAME", RFC 6865, 1308 DOI 10.17487/RFC6865, February 2013, 1309 . 1311 [Roca16] Roca, V., Teibi, B., Burdinat, C., Tran, T., and C. 1312 Thienot, "Block or Convolutional AL-FEC Codes? A 1313 Performance Comparison for Robust Low-Latency 1314 Communications", HAL open-archive document,hal-01395937 1315 https://hal.inria.fr/hal-01395937/en/, November 2016, 1316 . 1318 [Roca17] Roca, V., Teibi, B., Burdinat, C., Tran, T., and C. 1319 Thienot, "Less Latency and Better Protection with AL-FEC 1320 Sliding Window Codes: a Robust Multimedia CBR Broadcast 1321 Case Study", 13th IEEE International Conference on 1322 Wireless and Mobile Computing, Networking and 1323 Communications (WiMob17), October 1324 2017 https://hal.inria.fr/hal-01571609v1/en/, October 1325 2017, . 1327 Appendix A. TinyMT32 Pseudo-Random Number Generator 1329 The TinyMT32 PRNG reference implementation is distributed under a BSD 1330 license by the authors and excerpts of it are reproduced in Figure 8. 1331 Differences with respect to the original source code are the 1332 following: 1334 o unused parts of the original source code have been removed; 1335 o the appropriate parameter set has been added to the initialisation 1336 function; 1337 o function tinymt32_rand() has been added; 1338 o function order has been changed; 1339 o certain internal variables have been renamed for compactness 1340 purposes. 1342 1343 /** 1344 * Tiny Mersenne Twister only 127 bit internal state 1345 * 1346 * Authors : Mutsuo Saito (Hiroshima University) 1347 * Makoto Matsumoto (University of Tokyo) 1348 * 1349 * Copyright (c) 2011, 2013 Mutsuo Saito, Makoto Matsumoto, 1350 * Hiroshima University and The University of Tokyo. 1351 * All rights reserved. 1352 * 1353 * Redistribution and use in source and binary forms, with or without 1354 * modification, are permitted provided that the following conditions 1355 * are met: 1356 * 1357 * - Redistributions of source code must retain the above copyright 1358 * notice, this list of conditions and the following disclaimer. 1359 * - Redistributions in binary form must reproduce the above 1360 * copyright notice, this list of conditions and the following 1361 * disclaimer in the documentation and/or other materials 1362 * provided with the distribution. 1363 * - Neither the name of the Hiroshima University nor the names of 1364 * its contributors may be used to endorse or promote products 1365 * derived from this software without specific prior written 1366 * permission. 1367 * 1368 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 1369 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 1370 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1371 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 1372 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 1373 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 1374 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 1375 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 1376 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 1377 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 1378 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 1379 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1380 * SUCH DAMAGE. 1381 */ 1383 /** 1384 * tinymt32 internal state vector and parameters 1385 */ 1386 typedef struct { 1387 uint32_t status[4]; 1388 uint32_t mat1; 1389 uint32_t mat2; 1390 uint32_t tmat; 1391 } tinymt32_t; 1393 static void tinymt32_next_state (tinymt32_t * s); 1394 static uint32_t tinymt32_temper (tinymt32_t * s); 1395 static double tinymt32_generate_32double (tinymt32_t * s); 1397 /** 1398 * Parameter set to use for RLC FEC Schemes. Do not change. 1399 */ 1400 #define TINYMT32_MAT1_PARAM 0x8f7011ee 1401 #define TINYMT32_MAT2_PARAM 0xfc78ff1f 1402 #define TINYMT32_TMAT_PARAM 0x3793fdff 1404 /** 1405 * This function initializes the internal state array with a 32-bit 1406 * unsigned integer seed. 1407 * @param s tinymt state vector. 1408 * @param seed a 32-bit unsigned integer used as a seed. 1409 */ 1410 void tinymt32_init (tinymt32_t * s, uint32_t seed) 1411 { 1412 #define MIN_LOOP 8 1413 #define PRE_LOOP 8 1414 s->status[0] = seed; 1415 s->status[1] = s->mat1 = TINYMT32_MAT1_PARAM; 1416 s->status[2] = s->mat2 = TINYMT32_MAT2_PARAM; 1417 s->status[3] = s->tmat = TINYMT32_TMAT_PARAM; 1418 for (int i = 1; i < MIN_LOOP; i++) { 1419 s->status[i & 3] ^= i + UINT32_C(1812433253) 1420 * (s->status[(i - 1) & 3] 1421 ^ (s->status[(i - 1) & 3] >> 30)); 1423 } 1424 for (int i = 0; i < PRE_LOOP; i++) { 1425 tinymt32_next_state(s); 1426 } 1427 } 1429 /** 1430 * This function outputs an integer in the [0 .. maxv-1] range. 1431 * @param s tinymt internal status 1432 * @return floating point number r (0.0 <= r < 1.0) 1433 */ 1434 uint32_t tinymt32_rand (tinymt32_t * s, uint32_t maxv) 1435 { 1436 return (uint32_t)(tinymt32_generate_32double(s) * (double)maxv); 1437 } 1439 /** 1440 * Internal tinymt32 constants and functions. 1441 * Users should not call these functions directly. 1442 */ 1443 #define TINYMT32_MEXP 127 1444 #define TINYMT32_SH0 1 1445 #define TINYMT32_SH1 10 1446 #define TINYMT32_SH8 8 1447 #define TINYMT32_MASK UINT32_C(0x7fffffff) 1448 #define TINYMT32_MUL (1.0f / 16777216.0f) 1450 /** 1451 * This function changes internal state of tinymt32. 1452 * @param s tinymt internal status 1453 */ 1454 static void tinymt32_next_state (tinymt32_t * s) 1455 { 1456 uint32_t x; 1457 uint32_t y; 1459 y = s->status[3]; 1460 x = (s->status[0] & TINYMT32_MASK) 1461 ^ s->status[1] 1462 ^ s->status[2]; 1463 x ^= (x << TINYMT32_SH0); 1464 y ^= (y >> TINYMT32_SH0) ^ x; 1465 s->status[0] = s->status[1]; 1466 s->status[1] = s->status[2]; 1467 s->status[2] = x ^ (y << TINYMT32_SH1); 1468 s->status[3] = y; 1469 s->status[1] ^= -((int32_t)(y & 1)) & s->mat1; 1470 s->status[2] ^= -((int32_t)(y & 1)) & s->mat2; 1471 } 1473 /** 1474 * This function outputs 32-bit unsigned integer from internal state. 1475 * @param s tinymt internal status 1476 * @return 32-bit unsigned pseudos number 1477 */ 1478 static uint32_t tinymt32_temper (tinymt32_t * s) 1479 { 1480 uint32_t t0, t1; 1481 t0 = s->status[3]; 1482 t1 = s->status[0] + (s->status[2] >> TINYMT32_SH8); 1483 t0 ^= t1; 1484 t0 ^= -((int32_t)(t1 & 1)) & s->tmat; 1485 return t0; 1486 } 1488 /** 1489 * This function outputs double precision floating point number from 1490 * internal state. The returned value has 32-bit precision. 1491 * In other words, this function makes one double precision floating 1492 * point number from one 32-bit unsigned integer. 1493 * @param s tinymt internal status 1494 * @return floating point number r (0.0 <= r < 1.0) 1495 */ 1496 static double tinymt32_generate_32double (tinymt32_t * s) 1497 { 1498 tinymt32_next_state(s); 1499 return (double)tinymt32_temper(s) * (1.0 / 4294967296.0); 1500 } 1501 1503 Figure 8: TinyMT32 pseudo-code 1505 Appendix B. Decoding Beyond Maximum Latency Optimization 1507 This annex introduces non normative considerations. They are 1508 provided as suggestions, without any impact on interoperability. For 1509 more information see [Roca16]. 1511 With a real-time source ADU flow, it is possible to improve the 1512 decoding performance of sliding window codes without impacting 1513 maximum latency, at the cost of extra CPU overhead. The optimization 1514 consists, for a FECFRAME receiver, to extend the linear system beyond 1515 the decoding window maximum size, by keeping a certain number of old 1516 source symbols whereas their associated ADUs timed-out: 1518 ls_max_size > dw_max_size 1520 Usually the following choice is a good trade-off between decoding 1521 performance and extra CPU overhead: 1523 ls_max_size = 2 * dw_max_size 1525 When the dw_max_size is very small, it may be preferable to keep a 1526 minimum ls_max_size value (e.g., LS_MIN_SIZE_DEFAULT = 40 symbols). 1527 Going below this threshold will not save a significant amount of 1528 memory nor CPU cycles. Therefore: 1530 ls_max_size = max(2 * dw_max_size, LS_MIN_SIZE_DEFAULT) 1532 Finally, it is worth noting that a good receiver, i.e., a receiver 1533 that benefits from a protection that is significantly sufficient to 1534 recover from the packet losses, can choose to reduce its ls_max_size 1535 significantly. In that case lost ADUs will be recovered rapidly, 1536 without relying on this optimization. 1538 ls_max_size 1539 /---------------------------------^-------------------------------\ 1541 late source symbols 1542 (pot. decoded but not delivered) dw_max_size 1543 /--------------^-----------------\ /--------------^---------------\ 1544 src0 src1 src2 src3 src4 src5 src6 src7 src8 src9 src10 src11 src12 1546 Figure 9: Relationship between parameters to decode beyond maximum 1547 latency. 1549 It means that source symbols, and therefore ADUs, may be decoded even 1550 if the added latency exceeds the maximum value permitted by the 1551 application. It follows that the corresponding ADUs will not be 1552 useful to the application. However, decoding these "late symbols" 1553 significantly improves the global robustness in bad reception 1554 conditions and is therefore recommended for receivers experiencing 1555 bad communication conditions [Roca16]. In any case whether or not to 1556 use this optimization and what exact value to use for the ls_max_size 1557 parameter are decisions made by each receiver independently, without 1558 any impact on the other receivers nor on the source. 1560 Authors' Addresses 1561 Vincent Roca 1562 INRIA 1563 Univ. Grenoble Alpes 1564 France 1566 EMail: vincent.roca@inria.fr 1568 Belkacem Teibi 1569 INRIA 1570 Univ. Grenoble Alpes 1571 France 1573 EMail: belkacem.teibi@inria.fr