A method of generating a plurality of correction data units (104, 110, 120) relating to a plurality of data packets (102, 106, 112, 114, 116) of a data stream, each correction data unit being based on a set of the data packets of the data stream, said data stream being for transmission from a transmitter to a receiver over a lossy communication channel, the method characterised in that the generation of a first correction data unit of the plurality of correction data units comprises,: based on the data stream, selecting a respective performance measure to be optimized, said respective performance measure relating to a recovery of lost data packets of the data stream; determining a respective coding requirement for said first correction data unit; determining, within the constraints of said determined respective coding requirement and based on at least one previously generated correction data unit, which of the data packets of the data stream to include in the respective set on which the generation of said first correction data unit is to be based; generating said first correction data unit based on the respective set of the data packets of the data stream; and including the generated first correction data unit in the data stream, and wherein the method then comprises, for each next correction data unit of the plurality of correction data units, performing the steps of: (i) based on the data stream, selecting a respective performance measure to be optimized, said respective performance measure relating to a recovery of lost data packets of the data stream; (ii) determining a respective coding requirement for said next correction data unit; (iii) determining, within the constraints of said determined respective coding requirement and based on at least one previously generated correction data unit, which of the data packets of the data stream to include in the respective set on which the generation of said next correction data unit is to be based; (iv) generating said next correction data unit based on the respective set of the data packets of the data stream; and (v) including the generated next correction data unit in the data stream, wherein the steps of (i) to (v) are repeated for each next correction data unit. based on the data stream, selecting a respective performance measure to be optimized, said respective performance measure relating to a recovery of lost data packets of the data stream; determining a respective coding requirement for said first correction data unit; determining, within the constraints of said determined respective coding requirement and based on at least one previously generated correction data unit, which of the data packets of the data stream to include in the respective set on which the generation of said first correction data unit is to be based; generating said first correction data unit based on the respective set of the data packets of the data stream; and including the generated first correction data unit in the data stream, and wherein the method then comprises, for each next correction data unit of the plurality of correction data units, performing the steps of: (i) based on the data stream, selecting a respective performance measure to be optimized, said respective performance measure relating to a recovery of lost data packets of the data stream; (ii) determining a respective coding requirement for said next correction data unit; (iii) determining, within the constraints of said determined respective coding requirement and based on at least one previously generated correction data unit, which of the data packets of the data stream to include in the respective set on which the generation of said next correction data unit is to be based; (iv) generating said next correction data unit based on the respective set of the data packets of the data stream; and (v) including the generated next correction data unit in the data stream, (i) based on the data stream, selecting a respective performance measure to be optimized, said respective performance measure relating to a recovery of lost data packets of the data stream; (ii) determining a respective coding requirement for said next correction data unit; (iii) determining, within the constraints of said determined respective coding requirement and based on at least one previously generated correction data unit, which of the data packets of the data stream to include in the respective set on which the generation of said next correction data unit is to be based; (iv) generating said next correction data unit based on the respective set of the data packets of the data stream; and (v) including the generated next correction data unit in the data stream, wherein the steps of (i) to (v) are repeated for each next correction data unit.