TSVWG | V. Roca |
Internet-Draft | B. Teibi |
Intended status: Standards Track | INRIA |
Expires: March 23, 2019 | September 19, 2018 |
Sliding Window Random Linear Code (RLC) Forward Erasure Correction (FEC) Schemes for FECFRAME
draft-ietf-tsvwg-rlc-fec-scheme-09
This document describes two fully-specified Forward Erasure Correction (FEC) Schemes for Sliding Window Random Linear Codes (RLC), one for RLC over the Galois Field (A.K.A. Finite Field) GF(2), a second one for RLC over the Galois Field GF(2^^8), each time with the possibility of controlling the code density. They can protect arbitrary media streams along the lines defined by FECFRAME extended to sliding window FEC codes, as defined in [fecframe-ext]. These sliding window FEC codes rely on an encoding window that slides over the source symbols, generating new repair symbols whenever needed. Compared to block FEC codes, these sliding window FEC codes offer key advantages with real-time flows in terms of reduced FEC-related latency while often providing improved packet erasure recovery capabilities.
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."
This Internet-Draft will expire on March 23, 2019.
Copyright (c) 2018 IETF Trust and the persons identified as the document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
Application-Level Forward Erasure Correction (AL-FEC) codes, or simply FEC codes, are a key element of communication systems. They are used to recover from packet losses (or erasures) during content delivery sessions to a potentially large number of receivers (multicast/broadcast transmissions). This is the case with the FLUTE/ALC protocol [RFC6726] when used for reliable file transfers over lossy networks, and the FECFRAME protocol when used for reliable continuous media transfers over lossy networks.
The present document only focuses on the FECFRAME protocol, used in multicast/broadcast delivery mode, in particular for contents that feature stringent real-time constraints: each source packet has a maximum validity period after which it will not be considered by the destination application.
With FECFRAME, there is a single FEC encoding point (either a end-host/server (source) or a middlebox) and a single FEC decoding point (either a end-host (receiver) or middlebox). In this context, currently standardized AL-FEC codes for FECFRAME like Reed-Solomon [RFC6865], LDPC-Staircase [RFC6816], or Raptor/RaptorQ, are all linear block codes: they require the data flow to be segmented into blocks of a predefined maximum size.
To define this block size, it is required to find an appropriate balance between robustness and decoding latency: the larger the block size, the higher the robustness (e.g., in front of long packet erasure bursts), but also the higher the maximum decoding latency (i.e., the maximum time required to recover a lost (erased) packet thanks to FEC protection). Therefore, with a multicast/broadcast session where different receivers experience different packet loss rates, the block size should be chosen by considering the worst communication conditions one wants to support, but without exceeding the desired maximum decoding latency. This choice then impacts the FEC-related latency of all receivers, even those experiencing a good communication quality, since no FEC encoding can happen until all the source data of the block is available at the sender, which directly depends on the block size.
This document introduces two fully-specified FEC Schemes that follow a totally different approach: the Sliding Window Random Linear Codes (RLC) over either Galois Fields (A.K.A. Finite Fields) GF(2) (the "binary case") or GF(2^^8), each time with the possibility of controlling the code density. These FEC Schemes are used to protect arbitrary media streams along the lines defined by FECFRAME extended to sliding window FEC codes [fecframe-ext]. These FEC Schemes, and more generally Sliding Window FEC codes, are recommended for instance with media that feature real-time constraints sent within a multicast/broadcast session [Roca17].
The RLC codes belong to the broad class of sliding window AL-FEC codes (A.K.A. convolutional codes) [RFC8406]. The encoding process is based on an encoding window that slides over the set of source packets (in fact source symbols as we will see in Section 3.2), this window being either of fixed size or variable size (A.K.A. an elastic window). Repair symbols are generated on-the-fly, by computing a random linear combination of the source symbols present in the current encoding window, and passed to the transport layer.
At the receiver, a linear system is managed from the set of received source and repair packets. New variables (representing source symbols) and equations (representing the linear combination carried by each repair symbol received) are added upon receiving new packets. Variables and the equations they are involved in are removed when they are too old with respect to their validity period (real-time constraints) . Lost source symbols are then recovered thanks to this linear system whenever its rank permits to solve it (at least partially).
The protection of any multicast/broadcast session needs to be dimensioned by considering the worst communication conditions one wants to support. This is also true with RLC (more generally any sliding window) code. However the receivers experiencing a good to medium communication quality will observe a reduced FEC-related latency compared to block codes [Roca17] since an isolated lost source packet is quickly recovered with the following repair packet. On the opposite, with a block code, recovering an isolated lost source packet always requires waiting for the first repair packet to arrive after the end of the block. Additionally, under certain situations (e.g., with a limited FEC-related latency budget and with constant bitrate transmissions after FECFRAME encoding), sliding window codes can more efficiently achieve a target transmission quality (e.g., measured by the residual loss after FEC decoding) by sending fewer repair packets (i.e., higher code rate) than block codes.
The Sliding Window RLC FEC Scheme is designed to limit the packet header overhead. The main requirement is that each repair packet header must enable a receiver to reconstruct the set of source symbols plus the associated coefficients used during the encoding process. In order to minimize packet overhead, the set of source symbols in the encoding window as well as the set of coefficients over GF(2^^m) (where m is 1 or 8, depending on the FEC Scheme) used in the linear combination are not individually listed in the repair packet header. Instead, each FEC Repair Packet header contains:
Therefore, no matter the number of source symbols present in the encoding window, each FEC Repair Packet features a fixed 64-bit long header, called Repair FEC Payload ID (Figure 7). Similarly, each FEC Source Packet features a fixed 32-bit long trailer, called Explicit Source FEC Payload ID (Figure 5), that contains the ESI of the first source symbol (Section 3.2).
This fully-specified FEC Scheme follows the structure required by [RFC6363], section 5.6. "FEC Scheme Requirements", namely:
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.
This document uses the following definitions and abbreviations:
This section introduces the procedures that are used by these FEC Schemes.
The Sliding Window RLC FEC Scheme relies on several parameters:
The FEC Schemes can be used in various manners. They can be used to protect a source ADU flow having real-time constraints, or a non-realtime source ADU flow. The source ADU flow may be a Constant Bitrate (CBR) or Variable BitRate (VBR) flow. The flow's minimum/maximum bitrate might or might not be known. The FEC Schemes can also be used over the Internet or over a CBR communication path. It follows that the FEC Scheme parameters can be derived in different ways, as described in the following sections.
In the following, we consider a real-time flow with max_lat latency budget. The encoding symbol size, E, is constant. The code rate, cr, is also constant, its value depending on the expected communication loss model (this choice is out of scope of this document).
In a first configuration, the source ADU flow bitrate at the input of the FECFRAME sender is fixed and equal to br_in (in bits/s), and this value is known by the FECFRAME sender. It follows that the transmission bitrate at the output of the FECFRAME sender will be higher, depending on the added repair flow overhead. In order to comply with the maximum FEC-related latency budget, we have:
In a second configuration, the FECFRAME sender generates a fixed bitrate flow, equal to the CBR communication path bitrate equal to br_out (in bits/s), and this value is known by the FECFRAME sender, as in [Roca17]. The maximum source flow bitrate needs to be such that, with the added repair flow overhead, the total transmission bitrate remains inferior or equal to br_out. We have:
For decoding to be possible within the latency budget, it is required that the encoding window maximum size be smaller than or at most equal to the decoding window maximum size, the exact value having no impact on the the FEC-related latency budget. For the FEC Schemes specified in this document, in line with [Roca17], the ew_max_size SHOULD be computed with:
The ew_max_size is the main parameter at a FECFRAME sender. It is RECOMMENDED to check that the ew_max_size value stays within reasonnable bounds in order to avoid hazardous behaviours.
The dw_max_size is computed by a FECFRAME sender but not explicitly communicated to a FECFRAME receiver. However a FECFRAME receiver can easily evaluate the ew_max_size by observing the maximum Number of Source Symbols (NSS) value contained in the Repair FEC Payload ID of received FEC Repair Packets (Section 4.1.3). A receiver can then easily compute dw_max_size: Appendix B, which does not impact maximum latency nor interoperability. However the linear system size should not be too large for practical reasons (e.g., in order to limit computation complexity). It is RECOMMENDED to check that the ls_max_size value stays within reasonnable bounds in order to avoid hazardous behaviours.
A receiver can then chose an appropriate linear system maximum size:
It is good practice to use a larger value for ls_max_size as explained in
The particular case of session start needs to be managed appropriately. Here ew_size increases each time a new source ADU is received by the FECFRAME sender, until it reaches the ew_max_size value. A FECFRAME receiver SHOULD continuously observe the received FEC Repair Packets, since the NSS value carried in the Repair FEC Payload ID will increase too, and adjust its ls_max_size accordingly if need be.
In other configurations, a real-time source ADU flow, with a max_lat latency budget, features a variable bitrate (VBR). A first approach consists in considering the smallest instantaneous bitrate of the source ADU flow, when this parameter is known, and to reuse the derivation of Section 3.1.1. Considering the smallest bitrate means that the encoding window and decoding window maximum sizes estimation are pessimistic: these windows have the smallest size required to enable a decoding on-time at a FECFRAME receiver. If the instantaneous bitrate is higher than this smallest bitrate, this approach leads to an encoding window that is unnecessarily small, which reduces robustness in front of long erasure bursts.
Another approach consists in using ADU timing information (e.g., using the timestamp field of an RTP packet header, or registering the time upon receiving a new ADU). From the global FEC-related latency budget the FECFRAME sender can derive a practical maximum latency budget for encoding operations, max_lat_for_encoding. For the FEC Schemes specified in this document, this latency budget SHOULD be computed with: Section 3.1.3).
It follows that any source symbols associated to an ADU that has timed-out with respect to max_lat_for_encoding SHOULD be removed from the encoding window. With this approach there is no pre-determined ew_size value: this value fluctuates over the time according to the instantaneous source ADU flow bitrate. For practical reasons, a FECFRAME sender may still require that ew_size does not increase beyond a maximum value (
With both approaches, and no matter the choice of the FECFRAME sender, a FECFRAME receiver can still easily evaluate the ew_max_size by observing the maximum Number of Source Symbols (NSS) value contained in the Repair FEC Payload ID of received FEC Repair Packets. A receiver can then compute dw_max_size and derive an appropriate ls_max_size as explained in Section 3.1.1.
When the observed NSS fluctuates significantly, a FECFRAME receiver may want to adapt its ls_max_size accordingly. In particular when the NSS is significantly reduced, a FECFRAME receiver may want to reduce the ls_max_size too in order to limit computation complexity. However it is usually preferable to use a ls_max_size "too large" (which can increase computation complexity and memory requirements) than the opposite (which can reduce recovery performance).
Beyond these general guidelines, the details of how to manage these situations at a FECFRAME sender and receiver can depend on additional considerations that are out of scope of this document.
Finally there are configurations where a source ADU flow has no real-time constraints. FECFRAME and the FEC Schemes defined in this document can still be used. The choice of appropriate parameter values can be directed by practical considerations. For instance it can derive from an estimation of the maximum memory amount that could be dedicated to the linear system at a FECFRAME receiver, or the maximum computation complexity at a FECFRAME receiver, both of them depending on the ls_max_size parameter. The same considerations also apply to the FECFRAME sender, where the maximum memory amount and computation complexity depend on the ew_max_size parameter.
Here also, the NSS value contained in FEC Repair Packets is used by a FECFRAME receiver to determine the current coding window size and ew_max_size by observing its maximum value over the time.
Beyond these general guidelines, the details of how to manage these situations at a FECFRAME sender and receiver can depend on additional considerations that are out of scope of this document.
At a sender, an ADU coming from the application cannot directly be mapped to source symbols. When multiple source flows (e.g., media streams) are mapped onto the same FECFRAME instance, each flow is assigned its own Flow ID value (see below). At a sender, this identifier is prepended to each ADU before FEC encoding. This way, FEC decoding at a receiver also recovers this Flow ID and a recovered ADU can be assigned to the right source flow (note that transport port numbers and IP addresses cannot be used to that purpose as they are not recovered during FEC decoding).
Additionally, since ADUs are of variable size, padding is needed so that each ADU (with its flow identifier) contribute to an integral number of source symbols. This requires adding the original ADU length to each ADU before doing FEC encoding. Because of these requirements, an intermediate format, the ADUI, or ADU Information, is considered [RFC6363].
For each incoming ADU, an ADUI MUST created as follows. First of all, 3 bytes are prepended (Figure 1):
Then, zero padding is added to the ADU if needed:
The data unit resulting from the ADU and the F, L, and Pad fields is called ADUI. Since ADUs can have different sizes, this is also the case for ADUIs. However an ADUI always contributes to an integral number of source symbols.
symbol length, E E E < ------------------ >< ------------------ >< ------------------ > +-+--+---------------------------------------------+-------------+ |F| L| ADU | Pad | +-+--+---------------------------------------------+-------------+
Figure 1: ADUI Creation example (here 3 source symbols are created for this ADUI).
Note that neither the initial 3 bytes nor the optional padding are sent over the network. However, they are considered during FEC encoding, and a receiver who lost a certain FEC Source Packet (e.g., the UDP datagram containing this FEC Source Packet when UDP is used as the transport protocol) will be able to recover the ADUI if FEC decoding succeeds. Thanks to the initial 3 bytes, this receiver will get rid of the padding (if any) and identify the corresponding ADU flow.
Source symbols and the corresponding ADUs are removed from the encoding window:
Source symbols are added to the sliding encoding window each time a new ADU arrives, once the ADU to source symbols mapping has been performed (Section 3.2). The current size of the encoding window, ew_size, is updated after adding new source symbols. This process may require to remove old source symbols so that: ew_size ≤ ew_max_size.
Note that a FEC codec may feature practical limits in the number of source symbols in the encoding window (e.g., for computational complexity reasons). This factor may further limit the ew_max_size value, in addition to the maximum FEC-related latency budget (Section 3.1).
The RLC FEC Schemes defined in this document rely on the TinyMT32 PRNG, a small-sized variant of the Mersenne Twister PRNG, as defined in the reference implementation version 1.1 (2015/04/24) by Mutsuo Saito (Hiroshima University) and Makoto Matsumoto (The University of Tokyo).
For the RLC FEC Schemes defined in this document, the tinymt32 32-bit version (rather than the 64-bit version) MUST be used. This PRNG requires a parameter set that needs to be pre-calculated. For the RLC FEC Schemes defined in this document, the following parameter set MUST be used: [KR12].
This parameter set is the first entry of the precalculated parameter sets in file tinymt32dc.0.1048576.txt, by Kenji Rikitake, and available at:
This is also the parameter set used in
The PRNG reference implementation is distributed under a BSD license and excerpts of it are reproduced in Appendix A. In order to validate an implementation of this PRNG, using seed 1, the 10,000th value returned by: tinymt32_rand(s, 0xffff) MUST be equal to 0x7c37.
This PRNG MUST first be initialized with a 32-bit unsigned integer, used as a seed. The following function is used to this purpose: Section 4.1.3). In addition to the seed, this function takes as parameter a pointer to an instance of a tinymt32_t structure that is used to keep the internal state of the PRNG.
With the FEC Schemes defined in this document, the seed is in practice restricted to a value between 0 and 0xFFFF inclusive (note that this PRNG accepts a seed equal to 0), since this is the Repair_Key 16-bit field value of the Repair FEC Payload ID (
Then, each time a new pseudo-random integer between 0 and maxv-1 inclusive is needed, the following function is used:
This function takes as parameter both a pointer to the same tinymt32_t structure (that needs to be left unchanged between successive calls to the function) and the maxv value.
The coding coefficients, used during the encoding process, are generated at the RLC encoder by the generate_coding_coefficients() function each time a new repair symbol needs to be produced. The fraction of coefficients that are non zero (i.e., the density) is controlled by the DT (Density Threshold) parameter. When DT equals 15, the maximum value, the function guaranties that all coefficients are non zero (i.e., maximum density). When DT is between 0 (minimum value) and strictly inferior to 15, the average probability of having a non zero coefficient equals (DT +1) / 16.
These considerations apply both the RLC over GF(2) and RLC over GF(2^^8), the only difference being the value of the m parameter. With the RLC over GF(2) FEC Scheme (Section 5), m MUST be equal to 1. With RLC over GF(2^^8) FEC Scheme (Section 4), m MUST be equal to 8.
<CODE BEGINS> /* * Fills in the table of coding coefficients (of the right size) * provided with the appropriate number of coding coefficients to * use for the repair symbol key provided. * * (in) repair_key key associated to this repair symbol. This * parameter is ignored (useless) if m=2 and dt=15 * (in) cc_tab[] pointer to a table of the right size to store * coding coefficients. All coefficients are * stored as bytes, regardless of the m parameter, * upon return of this function. * (in) cc_nb number of entries in the table. This value is * equal to the current encoding window size. * (in) dt integer between 0 and 15 (inclusive) that * controls the density. With value 15, all * coefficients are guaranteed to be non zero * (i.e. equal to 1 with GF(2) and equal to a * value in {1,... 255} with GF(2^^8)), otherwise * a fraction of them will be 0. * (in) m Finite Field GF(2^^m) parameter. In this * document only values 1 and 8 are considered. * (out) returns an error code */ int generate_coding_coefficients (uint16_t repair_key, uint8_t cc_tab[], uint16_t cc_nb, uint8_t dt, uint8_t m) { uint32_t i; tinymt32_t s; /* PRNG internal state */ if (dt > 15) { return SOMETHING_WENT_WRONG; /* bad dt parameter */ } switch (m) { case 1: if (dt == 15) { /* all coefficients are 1 */ memset(cc_tab, 1, cc_nb); } else { /* here coefficients are either 0 or 1 */ tinymt32_init(&s, repair_key); for (i = 0 ; i < cc_nb ; i++) { if (tinymt32_rand(&s, 16) <= dt) { cc_tab[i] = (uint8_t) 1; } else { cc_tab[i] = (uint8_t) 0; } } } break; case 8: tinymt32_init(&s, repair_key); if (dt == 15) { /* coefficient 0 is avoided here in order to include * all the source symbols */ for (i = 0 ; i < cc_nb ; i++) { do { cc_tab[i] = (uint8_t) tinymt32_rand(&s, 256); } while (cc_tab[i] == 0); } } else { /* here a certain fraction of coefficients should be 0 */ for (i = 0 ; i < cc_nb ; i++) { if (tinymt32_rand(&s, 16) <= dt) { do { cc_tab[i] = (uint8_t) tinymt32_rand(&s, 256); } while (cc_tab[i] == 0); } else { cc_tab[i] = 0; } } } break; default: /* bad parameter m */ return SOMETHING_WENT_WRONG; } return EVERYTHING_IS_OKAY; } <CODE ENDS>
Figure 2: Coding Coefficients Generation Function pseudo-code
The two RLC FEC Schemes specified in this document reuse the Finite Fields defined in [RFC5510], section 8.1. More specifically, the elements of the field GF(2^^m) are represented by polynomials with binary coefficients (i.e., over GF(2)) and degree lower or equal to m-1. The addition between two elements is defined as the addition of binary polynomials in GF(2), which is equivalent to a bitwise XOR operation on the binary representation of these elements.
With GF(2^^8), multiplication between two elements is the multiplication modulo a given irreducible polynomial of degree 8. The following irreducible polynomial MUST be used for GF(2^^8):
With GF(2), multiplication corresponds to a logical AND operation.
The two RLC FEC Schemes require the computation of a linear combination of source symbols, using the coding coefficients produced by the generate_coding_coefficients() function and stored in the cc_tab[] array.
With the RLC over GF(2^^8) FEC Scheme, a linear combination of the ew_size source symbol present in the encoding window, say src_0 to src_ew_size_1, in order to generate a repair symbol, is computed as follows. For each byte of position i in each source and the repair symbol, where i belongs to {0; E-1}, compute: [PGM13]).
where * is the multiplication over GF(2^^8) and + is an XOR operation. In practice various optimizations need to be used in order to make this computation efficient (see in particular
With the RLC over GF(2) FEC Scheme (binary case), a linear combination is computed as follows. The repair symbol is the XOR sum of all the source symbols corresponding to a coding coefficient cc_tab[j] equal to 1 (i.e., the source symbols corresponding to zero coding coefficients are ignored). The XOR sum of the byte of position i in each source is computed and stored in the corresponding byte of the repair symbol, where i belongs to {0; E-1}. In practice, the XOR sums will be computed several bytes at a time (e.g., on 64 bit words, or on arrays of 16 or more bytes when using SIMD CPU extensions).
With both FEC Schemes, the details of how to optimize the computation of these linear combinations are of high practical importance but out of scope of this document.
This fully-specified FEC Scheme defines the Sliding Window Random Linear Codes (RLC) over GF(2^^8).
Following the guidelines of [RFC6363], section 5.6, this section provides the FEC Framework Configuration Information (or FFCI). This FCCI needs to be shared (e.g., using SDP) between the FECFRAME sender and receiver instances in order to synchronize them. It includes a FEC Encoding ID, mandatory for any FEC Scheme specification, plus scheme-specific elements.
When SDP is used to communicate the FFCI, this FEC Encoding ID is carried in the 'encoding-id' parameter.
The FEC Scheme-Specific Information (FSSI) includes elements that are specific to the present FEC Scheme. More precisely:
This element is required both by the sender (RLC encoder) and the receiver(s) (RLC decoder).
When SDP is used to communicate the FFCI, this FEC Scheme-specific information is carried in the 'fssi' parameter in textual representation as specified in [RFC6364]. For instance:
fssi=E:1400
If another mechanism requires the FSSI to be carried as an opaque octet string (for instance, after a Base64 encoding), the encoding format consists of the following 2 octets:
0 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Encoding Symbol Length (E) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 3: FSSI Encoding Format
A FEC Source Packet MUST contain an Explicit Source FEC Payload ID that is appended to the end of the packet as illustrated in Figure 4.
+--------------------------------+ | IP Header | +--------------------------------+ | Transport Header | +--------------------------------+ | ADU | +--------------------------------+ | Explicit Source FEC Payload ID | +--------------------------------+
Figure 4: Structure of an FEC Source Packet with the Explicit Source FEC Payload ID
More precisely, the Explicit Source FEC Payload ID is composed of the following field (Figure 5):
0 1 2 3 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Encoding Symbol ID (ESI) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 5: Source FEC Payload ID Encoding Format
A FEC Repair Packet MAY contain one or more repair symbols. When there are several repair symbols, all of them MUST have been generated from the same encoding window, using Repair_Key values that are managed as explained below. A receiver can easily deduce the number of repair symbols within a FEC Repair Packet by comparing the received FEC Repair Packet size (equal to the UDP payload size when UDP is the underlying transport protocol) and the symbol size, E, communicated in the FFCI.
A FEC Repair Packet MUST contain a Repair FEC Payload ID that is prepended to the repair symbol as illustrated in Figure 6.
+--------------------------------+ | IP Header | +--------------------------------+ | Transport Header | +--------------------------------+ | Repair FEC Payload ID | +--------------------------------+ | Repair Symbol | +--------------------------------+
Figure 6: Structure of an FEC Repair Packet with the Repair FEC Payload ID
More precisely, the Repair FEC Payload ID is composed of the following fields (Figure 7):
0 1 2 3 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Repair_Key | DT |NSS (# src symb in ew) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | FSS_ESI | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 7: Repair FEC Payload ID Encoding Format
The following procedure applies:
This fully-specified FEC Scheme defines the Sliding Window Random Linear Codes (RLC) over GF(2) (binary case).
When SDP is used to communicate the FFCI, this FEC Encoding ID is carried in the 'encoding-id' parameter.
All the considerations of Section 4.1.1.2 apply here.
All the considerations of Section 4.1.1.2 apply here.
All the considerations of Section 4.1.1.2 apply here, with the only exception that the Repair_Key field is useless if DT = 15 (indeed, in that case all the coefficients are necessarily equal to 1 and the coefficient generation function does not use any PRNG). When DT = 15 it is RECOMMENDED that the sender use value 0 for the Repair_Key field, but a receiver SHALL ignore this field.
All the considerations of Section 4.1.1.2 apply here.
This section provides a high level description of a Sliding Window RLC encoder.
Whenever a new FEC Repair Packet is needed, the RLC encoder instance first gathers the ew_size source symbols currently in the sliding encoding window. Then it chooses a repair key, which can be a monotonically increasing integer value, incremented for each repair symbol up to a maximum value of 65535 (as it is carried within a 16-bit field) after which it loops back to 0. This repair key is communicated to the coefficient generation function (Section 3.5) in order to generate ew_size coding coefficients. Finally, the FECFRAME sender computes the repair symbol as a linear combination of the ew_size source symbols using the ew_size coding coefficients (Section 3.6). When E is small and when there is an incentive to pack several repair symbols within the same FEC Repair Packet, the appropriate number of repair symbols are computed. In that case the repair key for each of them MUST be incremented by 1, keeping the same ew_size source symbols, since only the first repair key will be carried in the Repair FEC Payload ID. The FEC Repair Packet can then be passed to the transport layer for transmission. The source versus repair FEC packet transmission order is out of scope of this document and several approaches exist that are implementation specific.
Other solutions are possible to select a repair key value when a new FEC Repair Packet is needed, for instance by choosing a random integer between 0 and 65535. However, selecting the same repair key as before (which may happen in case of a random process) is only meaningful if the encoding window has changed, otherwise the same FEC Repair Packet will be generated.
This section provides a high level description of a Sliding Window RLC decoder.
A FECFRAME receiver needs to maintain a linear system whose variables are the received and lost source symbols. Upon receiving a FEC Repair Packet, a receiver first extracts all the repair symbols it contains (in case several repair symbols are packed together). For each repair symbol, when at least one of the corresponding source symbols it protects has been lost, the receiver adds an equation to the linear system (or no equation if this repair packet does not change the linear system rank). This equation of course re-uses the ew_size coding coefficients that are computed by the same coefficient generation function (Section Section 3.5), using the repair key and encoding window descriptions carried in the Repair FEC Payload ID. Whenever possible (i.e., when a sub-system covering one or more lost source symbols is of full rank), decoding is performed in order to recover lost source symbols. Each time an ADUI can be totally recovered, padding is removed (thanks to the Length field, L, of the ADUI) and the ADU is assigned to the corresponding application flow (thanks to the Flow ID field, F, of the ADUI). This ADU is finally passed to the corresponding upper application. Received FEC Source Packets, containing an ADU, MAY be passed to the application either immediately or after some time to guaranty an ordered delivery to the application. This document does not mandate any approach as this is an operational and management decision.
With real-time flows, a lost ADU that is decoded after the maximum latency or an ADU received after this delay has no value to the application. This raises the question of deciding whether or not an ADU is late. This decision MAY be taken within the FECFRAME receiver (e.g., using the decoding window, see Section 3.1) or within the application (e.g., using RTP timestamps within the ADU). Deciding which option to follow and whether or not to pass all ADUs, including those assumed late, to the application are operational decisions that depend on the application and are therefore out of scope of this document. Additionally, Appendix B discusses a backward compatible optimization whereby late source symbols MAY still be used within the FECFRAME receiver in order to improve transmission robustness.
Editor's notes: RFC Editor, please remove this section motivated by RFC 6982 before publishing the RFC. Thanks.
An implementation of the Sliding Window RLC FEC Scheme for FECFRAME exists:
The FEC Framework document [RFC6363] provides a comprehensive analysis of security considerations applicable to FEC Schemes. Therefore, the present section follows the security considerations section of [RFC6363] and only discusses specific topics.
The Sliding Window RLC FEC Scheme specified in this document does not change the recommendations of [RFC6363]. To summarize, if confidentiality is a concern, it is RECOMMENDED that one of the solutions mentioned in [RFC6363] is used with special considerations to the way this solution is applied (e.g., is encryption applied before or after FEC protection, within the end-system or in a middlebox), to the operational constraints (e.g., performing FEC decoding in a protected environment may be complicated or even impossible) and to the threat model.
The Sliding Window RLC FEC Scheme specified in this document does not change the recommendations of [RFC6363]. To summarize, it is RECOMMENDED that one of the solutions mentioned in [RFC6363] is used on both the FEC Source and Repair Packets.
The FEC Scheme specified in this document defines parameters that can be the basis of attacks. More specifically, the following parameters of the FFCI may be modified by an attacker who targets receivers (Section 4.1.1.2):
It is therefore RECOMMENDED that security measures be taken to guarantee the FFCI integrity, as specified in [RFC6363]. How to achieve this depends on the way the FFCI is communicated from the sender to the receiver, which is not specified in this document.
Similarly, attacks are possible against the Explicit Source FEC Payload ID and Repair FEC Payload ID. More specifically, in case of a FEC Source Packet, the following value can be modified by an attacker who targets receivers: [RFC6363].
And in case of a FEC Repair Packet:
It is therefore RECOMMENDED that security measures are taken to guarantee the FEC Source and Repair Packets as stated in
The Sliding Window RLC FEC Scheme specified in this document does not change the recommendations of [RFC6363].
The Sliding Window RLC FEC Scheme specified in this document does not change the recommendations of [RFC6363] concerning the use of the IPsec/ESP security protocol as a mandatory to implement (but not mandatory to use) security scheme. This is well suited to situations where the only insecure domain is the one over which the FEC Framework operates.
In addition to the above security considerations, inherited from [RFC6363], the present document introduces several formulae, in particular in Section 3.1.1. It is RECOMMENDED to check that the computed values stay within reasonnable bounds since numerical overflows, caused by an erroneous implementation or an erroneous input value, may lead to hazardous behaviours. However what "reasonnable bounds" means is use-case and implementation dependent and is not detailed in this document.
Section 3.1.2 also mentions the possibility of "using the timestamp field of an RTP packet header" when applicable. A malicious attacker may deliberately corrupt this header field in order to trigger hazardous behaviours at a FECFRAME receiver. Protection against this type of content corruption can be addressed with the above recommendations on a baseline secure operation. In addition, it is also RECOMMENDED to check that the timestamp value be within reasonnable bounds.
The FEC Framework document [RFC6363] provides a comprehensive analysis of operations and management considerations applicable to FEC Schemes. Therefore, the present section only discusses specific topics.
The present document specifies two FEC Schemes that differ on the Finite Field used for the coding coefficients. It is expected that the RLC over GF(2^^8) FEC Scheme will be mostly used since it warrants a higher packet loss protection. In case of small encoding windows, the associated processing overhead is not an issue (e.g., we measured decoding speeds between 745 Mbps and 2.8 Gbps on an ARM Cortex-A15 embedded board in [Roca17]). Of course the CPU overhead will increase with the encoding window size, because more operations in the GF(2^^8) finite field will be needed.
The RLC over GF(2) FEC Scheme offers an alternative. In that case operations symbols can be directly XOR-ed together which warrants high bitrate encoding and decoding operations, and can be an advantage with large encoding windows. However packet loss protection is significantly reduced by using this FEC Scheme.
In addition to the choice of the Finite Field, the two FEC Schemes define a coding coefficient density threshold (DT) parameter. This parameter enables a sender to control the code density, i.e., the proportion of coefficients that are non zero on average. With RLC over GF(2^^8), it is usually appropriate that small encoding windows be associated to a density threshold equal to 15, the maximum value, in order to warrant a high loss protection.
On the opposite, with larger encoding windows, it is usually appropriate that the density threshold be reduced. With large encoding windows, an alternative can be to use RLC over GF(2) and a density threshold equal to 7 (i.e., an average density equal to 1/2) or smaller.
Note that using a density threshold equal to 15 with RLC over GF(2) is equivalent to using an XOR code that compute the XOR sum of all the source symbols in the encoding window. In that case: (1) a single repair symbol can be produced for any encoding window, and (2) the repair_key parameter becomes useless (the coding coefficients generation function does not rely on the PRNG).
This document registers two values in the "FEC Framework (FECFRAME) FEC Encoding IDs" registry [RFC6363] as follows:
The authors would like to thank Russ Housley, Alan DeKok, Spencer Dawkins, Gorry Fairhurst, Jonathan Detchart, Emmanuel Lochin, and Marie-Jose Montpetit for their valuable feedbacks on this document.
[fecframe-ext] | Roca, V. and A. Begen, "Forward Error Correction (FEC) Framework Extension to Sliding Window Codes", Transport Area Working Group (TSVWG) draft-ietf-tsvwg-fecframe-ext (Work in Progress), September 2018. |
[RFC2119] | Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997. |
[RFC6363] | Watson, M., Begen, A. and V. Roca, "Forward Error Correction (FEC) Framework", RFC 6363, DOI 10.17487/RFC6363, October 2011. |
[RFC6364] | Begen, A., "Session Description Protocol Elements for the Forward Error Correction (FEC) Framework", RFC 6364, DOI 10.17487/RFC6364, October 2011. |
[RFC8174] | Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, May 2017. |
The TinyMT32 PRNG reference implementation is distributed under a BSD license by the authors and excerpts of it are reproduced in Figure 8. The differences with respect to the original source code are:
<CODE BEGINS> /** * Tiny Mersenne Twister only 127 bit internal state * * Authors : Mutsuo Saito (Hiroshima University) * Makoto Matsumoto (University of Tokyo) * * Copyright (c) 2011, 2013 Mutsuo Saito, Makoto Matsumoto, * Hiroshima University and The University of Tokyo. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * - Neither the name of the Hiroshima University nor the names of * its contributors may be used to endorse or promote products * derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include <stdint.h> /** * tinymt32 internal state vector and parameters */ typedef struct { uint32_t status[4]; uint32_t mat1; uint32_t mat2; uint32_t tmat; } tinymt32_t; static void tinymt32_next_state (tinymt32_t * s); static uint32_t tinymt32_temper (tinymt32_t * s); static double tinymt32_generate_32double (tinymt32_t * s); /** * Parameter set to use for the IETF RLC FEC Schemes specification. * Do not change. * This parameter set is the first entry of the precalculated parameter * sets in file tinymt32dc.0.1048576.txt, by Kenji Rikitake, available * at: https://github.com/jj1bdx/tinymtdc-longbatch/blob/master/ * tinymt32dc/tinymt32dc.0.1048576.txt * It is also the parameter set used: * Rikitake, K., "TinyMT Pseudo Random Number Generator for * Erlang", ACM 11th SIGPLAN Erlang Workshop (Erlang'12), * September, 2012. */ #define TINYMT32_MAT1_PARAM 0x8f7011ee #define TINYMT32_MAT2_PARAM 0xfc78ff1f #define TINYMT32_TMAT_PARAM 0x3793fdff /** * This function initializes the internal state array with a 32-bit * unsigned integer seed. * @param s pointer to tinymt internal state. * @param seed a 32-bit unsigned integer used as a seed. */ void tinymt32_init (tinymt32_t * s, uint32_t seed) { #define MIN_LOOP 8 #define PRE_LOOP 8 s->status[0] = seed; s->status[1] = s->mat1 = TINYMT32_MAT1_PARAM; s->status[2] = s->mat2 = TINYMT32_MAT2_PARAM; s->status[3] = s->tmat = TINYMT32_TMAT_PARAM; for (int i = 1; i < MIN_LOOP; i++) { s->status[i & 3] ^= i + UINT32_C(1812433253) * (s->status[(i - 1) & 3] ^ (s->status[(i - 1) & 3] >> 30)); } for (int i = 0; i < PRE_LOOP; i++) { tinymt32_next_state(s); } } /** * This function outputs an integer in the [0 .. maxv-1] range. * @param s pointer to tinymt internal state. * @return 32-bit unsigned integer between 0 and maxv-1 inclusive. */ uint32_t tinymt32_rand (tinymt32_t * s, uint32_t maxv) { return (uint32_t)(tinymt32_generate_32double(s) * (double)maxv); } /** * Internal tinymt32 constants and functions. * Users should not call these functions directly. */ #define TINYMT32_MEXP 127 #define TINYMT32_SH0 1 #define TINYMT32_SH1 10 #define TINYMT32_SH8 8 #define TINYMT32_MASK UINT32_C(0x7fffffff) #define TINYMT32_MUL (1.0f / 16777216.0f) /** * This function changes internal state of tinymt32. * @param s pointer to tinymt internal state. */ static void tinymt32_next_state (tinymt32_t * s) { uint32_t x; uint32_t y; y = s->status[3]; x = (s->status[0] & TINYMT32_MASK) ^ s->status[1] ^ s->status[2]; x ^= (x << TINYMT32_SH0); y ^= (y >> TINYMT32_SH0) ^ x; s->status[0] = s->status[1]; s->status[1] = s->status[2]; s->status[2] = x ^ (y << TINYMT32_SH1); s->status[3] = y; s->status[1] ^= -((int32_t)(y & 1)) & s->mat1; s->status[2] ^= -((int32_t)(y & 1)) & s->mat2; } /** * This function outputs 32-bit unsigned integer from internal state. * @param s pointer to tinymt internal state. * @return 32-bit unsigned pseudos number */ static uint32_t tinymt32_temper (tinymt32_t * s) { uint32_t t0, t1; t0 = s->status[3]; t1 = s->status[0] + (s->status[2] >> TINYMT32_SH8); t0 ^= t1; t0 ^= -((int32_t)(t1 & 1)) & s->tmat; return t0; } /** * This function outputs double precision floating point number from * internal state. The returned value has 32-bit precision. * In other words, this function makes one double precision floating * point number from one 32-bit unsigned integer. * @param s pointer to tinymt internal state. * @return floating point number r (0.0 <= r < 1.0) */ static double tinymt32_generate_32double (tinymt32_t * s) { tinymt32_next_state(s); return (double)tinymt32_temper(s) * (1.0 / 4294967296.0); } <CODE ENDS>
Figure 8: TinyMT32 pseudo-code
This annex introduces non normative considerations. It is provided as suggestions, without any impact on interoperability. For more information see [Roca16].
With a real-time source ADU flow, it is possible to improve the decoding performance of sliding window codes without impacting maximum latency, at the cost of extra memory and CPU overhead. The optimization consists, for a FECFRAME receiver, to extend the linear system beyond the decoding window maximum size, by keeping a certain number of old source symbols whereas their associated ADUs timed-out:
Usually the following choice is a good trade-off between decoding performance and extra CPU overhead:
When the dw_max_size is very small, it may be preferable to keep a minimum ls_max_size value (e.g., LS_MIN_SIZE_DEFAULT = 40 symbols). Going below this threshold will not save a significant amount of memory nor CPU cycles. Therefore:
Finally, it is worth noting that a good receiver, i.e., a receiver that benefits from an FEC protection significantly higher than what is required to recover from packet losses, can choose to reduce the ls_max_size. In that case lost ADUs will be recovered without relying on this optimization.
ls_max_size /---------------------------------^-------------------------------\ late source symbols (pot. decoded but not delivered) dw_max_size /--------------^-----------------\ /--------------^---------------\ src0 src1 src2 src3 src4 src5 src6 src7 src8 src9 src10 src11 src12
Figure 9: Relationship between parameters to decode beyond maximum latency.
It means that source symbols, and therefore ADUs, may be decoded even if the added latency exceeds the maximum value permitted by the application (the "late source symbols" of Figure 9). It follows that the corresponding ADUs will not be useful to the application. However, decoding these "late symbols" significantly improves the global robustness in bad reception conditions and is therefore recommended for receivers experiencing bad communication conditions [Roca16]. In any case whether or not to use this optimization and what exact value to use for the ls_max_size parameter are local decisions made by each receiver independently, without any impact on the other receivers nor on the source.