## gstrtpbin gstrtpbin — Real-Time Transport Protocol bin |

## Properties

gboolean | do-lost | Read / Write
guint | latency | Read / Write
GstStructure * | sdes | Read / Write
gboolean | ignore-pt | Read / Write
gboolean | autoremove | Read / Write
RTPJitterBufferMode | buffer-mode | Read / Write
gboolean | ntp-sync | Read / Write
gboolean | use-pipeline-clock | Read / Write
GstRTCPSync | rtcp-sync | Read / Write
guint | rtcp-sync-interval | Read / Write

## Signals

void | clear-pt-map | Action
RTPSession* | get-internal-session | Action
void | on-bye-ssrc | Run Last
void | on-bye-timeout | Run Last
void | on-new-ssrc | Run Last
void | on-npt-stop | Run Last
void | on-sender-timeout | Run Last
void | on-ssrc-active | Run Last
void | on-ssrc-collision | Run Last
void | on-ssrc-sdes | Run Last
void | on-ssrc-validated | Run Last
void | on-timeout | Run Last
GstCaps* | request-pt-map | Run Last
void | reset-sync | Action
void | payload-type-change | Run Last

## Types and Values

struct | GstRtpBin

## Object Hierarchy

        GObject
        ╰── GstObject
            ╰── GstElement
                ╰── GstBin
                    ╰── GstRtpBin

## Implemented Interfaces

GstRtpBin implements GstChildProxy.

## Description

RTP bin combines the functions of GstRtpSession, GstRtpSsrcDemux, GstRtpJitterBuffer and GstRtpPtDemux in one element. It allows for multiple RTP sessions that will be synchronized together using RTCP SR packets.

GstRtpBin is configured with a number of request pads that define the functionality that is activated, similar to the GstRtpSession element.

To use GstRtpBin as an RTP receiver, request a recv_rtp_sink_%d pad. The session number must be specified in the pad name. Data received on the recv_rtp_sink_%d pad will be processed in the GstRtpSession manager and after being validated forwarded on GstRtpSsrcDemux element. Each RTP stream is demuxed based on the SSRC and send to a GstRtpJitterBuffer. After the packets are released from the jitterbuffer, they will be forwarded to a GstRtpPtDemux element. The GstRtpPtDemux element will demux the packets based on the payload type and will create a unique pad recv_rtp_src_%d_%d_%d on gstrtpbin with the session number, SSRC and payload type respectively as the pad name.

To also use GstRtpBin as an RTCP receiver, request a recv_rtcp_sink_%d pad. The session number must be specified in the pad name.

If you want the session manager to generate and send RTCP packets, request the send_rtcp_src_%d pad with the session number in the pad name. Packet pushed on this pad contain SR/RR RTCP reports that should be sent to all participants in the session.

To use GstRtpBin as a sender, request a send_rtp_sink_%d pad, which will automatically create a send_rtp_src_%d pad. If the session number is not provided, the pad from the lowest available session will be returned. The session manager will modify the SSRC in the RTP packets to its own SSRC and wil forward the packets on the send_rtp_src_%d pad after updating its internal state.

The session manager needs the clock-rate of the payload types it is handling and will signal the “request-pt-map” signal when it needs such a mapping. One can clear the cached values with the “clear-pt-map” signal.

Access to the internal statistics of gstrtpbin is provided with the get-internal-session property. This action signal gives access to the RTPSession object which further provides action signals to retrieve the internal source and other sources.

### Example pipelines

    1
    2
    gst-launch udpsrc port=5000 caps="application/x-rtp, ..." ! .recv_rtp_sink_0 \
        gstrtpbin ! rtptheoradepay ! theoradec ! xvimagesink

Receive RTP data from port 5000 and send to the session 0 in gstrtpbin.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    gst-launch gstrtpbin name=rtpbin \
            v4l2src ! ffmpegcolorspace ! ffenc_h263 ! rtph263ppay ! rtpbin.send_rtp_sink_0 \
                      rtpbin.send_rtp_src_0 ! udpsink port=5000                            \
                      rtpbin.send_rtcp_src_0 ! udpsink port=5001 sync=false async=false    \
                      udpsrc port=5005 ! rtpbin.recv_rtcp_sink_0                           \
            audiotestsrc ! amrnbenc ! rtpamrpay ! rtpbin.send_rtp_sink_1                   \
                      rtpbin.send_rtp_src_1 ! udpsink port=5002                            \
                      rtpbin.send_rtcp_src_1 ! udpsink port=5003 sync=false async=false    \
                      udpsrc port=5007 ! rtpbin.recv_rtcp_sink_1

Encode and payload H263 video captured from a v4l2src. Encode and payload AMR audio generated from audiotestsrc. The video is sent to session 0 in rtpbin and the audio is sent to session 1. Video packets are sent on UDP port 5000 and audio packets on port 5002. The video RTCP packets for session 0 are sent on port 5001 and the audio RTCP packets for session 0 are sent on port 5003. RTCP packets for session 0 are received on port 5005 and RTCP for session 1 is received on port 5007. Since RTCP packets from the sender should be sent as soon as possible and do not participate in preroll, sync=false and async=false is configured on udpsink

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    gst-launch -v gstrtpbin name=rtpbin                                          \
        udpsrc caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H263-1998" \
                port=5000 ! rtpbin.recv_rtp_sink_0                                \
            rtpbin. ! rtph263pdepay ! ffdec_h263 ! xvimagesink                    \
         udpsrc port=5001 ! rtpbin.recv_rtcp_sink_0                               \
         rtpbin.send_rtcp_src_0 ! udpsink port=5005 sync=false async=false        \
        udpsrc caps="application/x-rtp,media=(string)audio,clock-rate=(int)8000,encoding-name=(string)AMR,encoding-params=(string)1,octet-align=(string)1" \
                port=5002 ! rtpbin.recv_rtp_sink_1                                \
            rtpbin. ! rtpamrdepay ! amrnbdec ! alsasink                           \
         udpsrc port=5003 ! rtpbin.recv_rtcp_sink_1                               \
         rtpbin.send_rtcp_src_1 ! udpsink port=5007 sync=false async=false

Receive H263 on port 5000, send it through rtpbin in session 0, depayload, decode and display the video. Receive AMR on port 5002, send it through rtpbin in session 1, depayload, decode and play the audio. Receive server RTCP packets for session 0 on port 5001 and RTCP packets for session 1 on port 5003. These packets will be used for session management and synchronisation. Send RTCP reports for session 0 on port 5005 and RTCP reports for session 1 on port 5007.

Last reviewed on 2007-08-30 (0.10.6)

## Synopsis

### Element Information

plugin | gstrtpmanager
author | Wim Taymans <wim.taymans@gmail.com>
class | Filter/Network/RTP

### Element Pads

name | recv_rtcp_sink_%d
direction | sink
presence | request
details | application/x-rtcp

name | recv_rtp_sink_%d
direction | sink
presence | request
details | application/x-rtp

name | send_rtp_sink_%d
direction | sink
presence | request
details | application/x-rtp

name | recv_rtp_src_%d_%d_%d
direction | source
presence | sometimes
details | application/x-rtp

name | send_rtp_src_%d
direction | source
presence | sometimes
details | application/x-rtp

name | send_rtcp_src_%d
direction | source
presence | request
details | application/x-rtcp

## Functions

## Types and Values

### struct GstRtpBin

    struct GstRtpBin;

## Property Details

### The `“do-lost”` property

      “do-lost”                  gboolean

Send an event downstream when a packet is lost.

Flags: Read / Write

Default value: FALSE

### The `“latency”` property

      “latency”                  guint

Default amount of ms to buffer in the jitterbuffers.

Flags: Read / Write

Default value: 200

### The `“sdes”` property

      “sdes”                     GstStructure *

The SDES items of this session.

Flags: Read / Write

### The `“ignore-pt”` property

      “ignore-pt”                gboolean

Do not demultiplex based on PT values.

Flags: Read / Write

Default value: FALSE

### The `“autoremove”` property

      “autoremove”               gboolean

Automatically remove timed out sources.

Flags: Read / Write

Default value: FALSE

### The `“buffer-mode”` property

      “buffer-mode”              RTPJitterBufferMode

Control the buffering algorithm in use.

Flags: Read / Write

Default value: Slave receiver to sender clock

### The `“ntp-sync”` property

      “ntp-sync”                 gboolean

Synchronize received streams to the NTP clock.

Flags: Read / Write

Default value: FALSE

### The `“use-pipeline-clock”` property

      “use-pipeline-clock”       gboolean

Use the pipeline clock to set the NTP time in the RTCP SR messages.

Flags: Read / Write

Default value: FALSE

### The `“rtcp-sync”` property

      “rtcp-sync”                GstRTCPSync

Use of RTCP SR in synchronization.

Flags: Read / Write

Default value: always

### The `“rtcp-sync-interval”` property

      “rtcp-sync-interval”       guint

RTCP SR interval synchronization (ms) (0 = always).

Flags: Read / Write

Default value: 0

## Signal Details

### The `“clear-pt-map”` signal

    void
    user_function (GstRtpBin *rtpbin,
                   gpointer   user_data)

Clear all previously cached pt-mapping obtained with “request-pt-map”.

#### Parameters

rtpbin | the object which received the signal |
user_data | user data set when the signal handler was connected. |

Flags: Action

### The `“get-internal-session”` signal

    RTPSession*
    user_function (GstRtpBin *rtpbin,
                   guint      id,
                   gpointer   user_data)

Request the internal RTPSession object as GObject in session `id` .

#### Parameters

rtpbin | the object which received the signal |
id | the session id |
user_data | user data set when the signal handler was connected. |

Flags: Action

### The `“on-bye-ssrc”` signal

    void
    user_function (GstRtpBin *rtpbin,
                   guint      session,
                   guint      ssrc,
                   gpointer   user_data)

Notify of an SSRC that became inactive because of a BYE packet.

#### Parameters

rtpbin | the object which received the signal |
session | the session |
ssrc | the SSRC |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“on-bye-timeout”` signal

    void
    user_function (GstRtpBin *rtpbin,
                   guint      session,
                   guint      ssrc,
                   gpointer   user_data)

Notify of an SSRC that has timed out because of BYE

#### Parameters

rtpbin | the object which received the signal |
session | the session |
ssrc | the SSRC |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“on-new-ssrc”` signal

    void
    user_function (GstRtpBin *rtpbin,
                   guint      session,
                   guint      ssrc,
                   gpointer   user_data)

Notify of a new SSRC that entered `session` .

#### Parameters

rtpbin | the object which received the signal |
session | the session |
ssrc | the SSRC |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“on-npt-stop”` signal

    void
    user_function (GstRtpBin *rtpbin,
                   guint      session,
                   guint      ssrc,
                   gpointer   user_data)

Notify that SSRC sender has sent data up to the configured NPT stop time.

#### Parameters

rtpbin | the object which received the signal |
session | the session |
ssrc | the SSRC |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“on-sender-timeout”` signal

    void
    user_function (GstRtpBin *rtpbin,
                   guint      session,
                   guint      ssrc,
                   gpointer   user_data)

Notify of a sender SSRC that has timed out and became a receiver

#### Parameters

rtpbin | the object which received the signal |
session | the session |
ssrc | the SSRC |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“on-ssrc-active”` signal

    void
    user_function (GstRtpBin *rtpbin,
                   guint      session,
                   guint      ssrc,
                   gpointer   user_data)

Notify of a SSRC that is active, i.e., sending RTCP.

#### Parameters

rtpbin | the object which received the signal |
session | the session |
ssrc | the SSRC |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“on-ssrc-collision”` signal

    void
    user_function (GstRtpBin *rtpbin,
                   guint      session,
                   guint      ssrc,
                   gpointer   user_data)

Notify when we have an SSRC collision

#### Parameters

rtpbin | the object which received the signal |
session | the session |
ssrc | the SSRC |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“on-ssrc-sdes”` signal

    void
    user_function (GstRtpBin *rtpbin,
                   guint      session,
                   guint      ssrc,
                   gpointer   user_data)

Notify of a SSRC that is active, i.e., sending RTCP.

#### Parameters

rtpbin | the object which received the signal |
session | the session |
ssrc | the SSRC |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“on-ssrc-validated”` signal

    void
    user_function (GstRtpBin *rtpbin,
                   guint      session,
                   guint      ssrc,
                   gpointer   user_data)

Notify of a new SSRC that became validated.

#### Parameters

rtpbin | the object which received the signal |
session | the session |
ssrc | the SSRC |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“on-timeout”` signal

    void
    user_function (GstRtpBin *rtpbin,
                   guint      session,
                   guint      ssrc,
                   gpointer   user_data)

Notify of an SSRC that has timed out

#### Parameters

rtpbin | the object which received the signal |
session | the session |
ssrc | the SSRC |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“request-pt-map”` signal

    GstCaps*
    user_function (GstRtpBin *rtpbin,
                   guint      session,
                   guint      pt,
                   gpointer   user_data)

Request the payload type as GstCaps for `pt` in `session` .

#### Parameters

rtpbin | the object which received the signal |
session | the session |
pt | the pt |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“reset-sync”` signal

    void
    user_function (GstRtpBin *rtpbin,
                   gpointer   user_data)

Reset all currently configured lip-sync parameters and require new SR packets for all streams before lip-sync is attempted again.

#### Parameters

rtpbin | the object which received the signal |
user_data | user data set when the signal handler was connected. |

Flags: Action

### The `“payload-type-change”` signal

    void
    user_function (GstRtpBin *rtpbin,
                   guint      session,
                   guint      pt,
                   gpointer   user_data)

Signal that the current payload type changed to `pt` in `session` .

#### Parameters

rtpbin | the object which received the signal |
session | the session |
pt | the pt |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since 0.10.17

## See Also

gstrtpjitterbuffer, gstrtpsession, gstrtpptdemux, gstrtpssrcdemux