## rtpulpfecenc

rtpulpfecenc — Generic RTP Forward Error Correction (FEC) encoder

## Properties

gboolean | multipacket | Read / Write / Construct
gboolean | mux-seq | Read / Write / Construct
guint | percentage | Read / Write / Construct
guint | percentage-important | Read / Write / Construct
guint | protected | Read
guint | pt | Read / Write / Construct
guint | ssrc | Read / Write / Construct

## Types and Values

struct | GstRtpUlpFecEnc

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GstObject
                ╰── GstElement
                    ╰── GstRtpUlpFecEnc

## Description

Generic Forward Error Correction (FEC) encoder using Uneven Level Protection (ULP) as described in RFC 5109.

It differs from the RFC in one important way, it multiplexes the FEC packets in the same sequence number as media packets. This is to be compatible with libwebrtc as using in Google Chrome and with Microsoft Lync / Skype for Business.

Be warned that after using this element, it is no longer possible to know if there is a gap in the media stream based on the sequence numbers as the FEC packets become interleaved with the media packets.

This element will insert protection packets in any RTP stream, which can then be used on the receiving side to recover lost packets.

This element rewrites packets' seqnums, which means that when combined with retransmission elements such as GstRtpRtxSend, it *must* be placed upstream of those, otherwise retransmission requests will request incorrect seqnums.

A payload type for the protection packets *must* be specified, different from the payload type of the protected packets, with the GstRtpUlpFecEnc:pt property.

The marker bit of RTP packets is used to determine sets of packets to protect as a unit, in order to modulate the level of protection, this behaviour can be disabled with GstRtpUlpFecEnc:multipacket, but should be left enabled for video streams.

The level of protection can be configured with two properties, “percentage” and “percentage-important”, the element will determine which percentage to use for a given set of packets based on the presence of the GST_BUFFER_FLAG_NON_DROPPABLE flag, upstream payloaders are expected to set this flag on "important" packets such as those making up a keyframe.

The percentage is expressed not in terms of bytes, but in terms of packets, this for implementation convenience. The drawback with this approach is that when using a percentage different from 100 %, and a low bitrate, entire frames may be contained in a single packet, leading to some packets not being protected, thus lowering the overall recovery rate on the receiving side.

When using GstRtpBin, this element should be inserted through the “request-fec-encoder” signal.

### Example pipeline

    1

    gst-launch-1.0 videotestsrc ! x264enc ! video/x-h264, profile=baseline ! rtph264pay pt=96 ! rtpulpfecenc percentage=100 pt=122 ! udpsink port=8888

This example will receive a stream with FEC and try to reconstruct the packets. Example programs are available at rtpfecserver.rs and rtpfecclient.rs

See also: GstRtpUlpFecDec, GstRtpBin

## Synopsis

### Element Information

plugin | rtp
author | Mikhail Fludkov <misha@pexip.com>
class | Codec/Payloader/Network/RTP

### Element Pads

name | sink
direction | sink
presence | always
details | application/x-rtp

name | src
direction | source
presence | always
details | application/x-rtp

## Functions

## Types and Values

### struct GstRtpUlpFecEnc

    struct GstRtpUlpFecEnc;

## Property Details

### The `“multipacket”` property

      “multipacket”              gboolean

Apply FEC on multiple packets.

Owner: GstRtpUlpFecEnc

Flags: Read / Write / Construct

Default value: TRUE

### The `“mux-seq”` property

      “mux-seq”                  gboolean

Mux seqnum for media and fec packets in same seqnum space.

Owner: GstRtpUlpFecEnc

Flags: Read / Write / Construct

Default value: FALSE

### The `“percentage”` property

      “percentage”               guint

FEC overhead percentage for the whole stream.

Owner: GstRtpUlpFecEnc

Flags: Read / Write / Construct

Allowed values: <= 100

Default value: 0

### The `“percentage-important”` property

      “percentage-important”     guint

FEC overhead percentage for important packets.

Owner: GstRtpUlpFecEnc

Flags: Read / Write / Construct

Allowed values: <= 100

Default value: 0

### The `“protected”` property

      “protected”                guint

Count of protected packets.

Owner: GstRtpUlpFecEnc

Flags: Read

Default value: 0

### The `“pt”` property

      “pt”                       guint

The payload type of FEC packets.

Owner: GstRtpUlpFecEnc

Flags: Read / Write / Construct

Allowed values: <= 255

Default value: 255

### The `“ssrc”` property

      “ssrc”                     guint

The SSRC to use on FEC'd packets.

Owner: GstRtpUlpFecEnc

Flags: Read / Write / Construct

Default value: 0