GstWebRTC - Data Channel

From RidgeRun Developer Wiki

Ridgerun's GstRrWebRTC provides data channel support. Data channel can be used for data transfer between endpoints by using the SCTP protocol, which allows flow and congestion control. The reliability and delivery order of data are configurable on the SCTP ptotocol.

  • Reliability means that an endpoint is able to know if the data was received or not by the other endpoint.
  • Order means that data is received in the same order it was sent.

Data channel in GstRrWebRTC works with a combination of elements that provide support for data transfer between multiple endpoints on a single session. Such elements are presented in the following image:

Elements involved in data transfer

GstWebRTCBin Data Properties

The GstWebRTCBin element exposes some properties that can be used to configure the endpoints functionality on data transfer:

  • data-port:

Specify the desired SCTP port to use for data transfer. Its value must be defined in the range: [0 - 65535]. If not used, the port 5000 is assigned by default.

  • data-channel-id:

Specify an identifier for each data channel stream. Default: Its value must be defined in the range: [0 - 65535]. If not used, a random port in that range is assigned by default.

  • enable-data:

Used to enable the negotiation of the WebRTC data channel for an endpoint. It is required to use the new_data and on_new_data callbacks without data-pads. If not used, the data channel support wont be enabled (false by default).

  • data-channel-status:

This property represents the connection status, which indicate if data channel is currently connected. If not used, such information wont be displayed (false by default).

Data Channel Usage

gst-launch-1.0 rrwebrtcbin start-call=true data-port=5001 signaler=GstOwrSignaler signaler::server_url=https://webrtc.ridgerun.com:8443 signaler::session_id=root0 name= web0 turn-server=turn stun-server=stun web0.data_src ! fakesink dump=true rrwebrtcbin start-call=true data-port=5002 signaler=GstOwrSignaler signaler::server_url=https://webrtc.ridgerun.com:8443 signaler::session_id=root1 name=web1 turn-server=turn stun-server=stun web1.data_src ! fakesink dump=true