GstWebRTC - Data Channel

From RidgeRun Developer Connection
Revision as of 17:58, 27 February 2019 by Jcruz (talk | contribs) (Data Channel Usage)
Jump to: navigation, search

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

There is an application called datachannel inside the gst-webrtc/tests/examples/data_channel' folder. This application allows to establish communication between two endpoints in order to transfer audio, video and data.

Options

  • -c, --channel=C: Channel to register (The session ID)
  • -p, --peer-channel=P: Peer channel
  • -a, --no-audio: Don't use audio in the WebRTC session
  • -v, --no-video: Don't use video in the WebRTC session
  • -d, --no-data: Don't use data in the WebRTC session
  • -o, --owr-signaler: Use OWR signaler (by default Pubnub signaler is used)
  • -s, --start-call: Start the call from this endpoint (Disabled by default)

Example

You can run the application as follows:

./datachannel -c room0 -a -o -s

Go to

GST_DEBUG=*web:7*,*connection*:7,*signaler*:7,*data*:7 gst-launch-1.0 rrwebrtcbin start-call=true data-channel-id=70 signaler=GstOwrSignaler signaler::server_url=https://webrtc.ridgerun.com:8443 signaler::session_id=root1 name=web0 turn-server=turn stun-server=stun web0.data_src ! fakesink dump=true async=false metasrc is-live=true period=30 metadata="testing...ABC" ! web0.data_sink -v rrwebrtcbin start-call=true data-channel-id=80 signaler=GstOwrSignaler signaler::server_url=https://webrtc.ridgerun.com:8443 signaler::session_id=root2 name=web1 turn-server=turn stun-server=stun web1.data_src ! fakesink dump=true async=false metasrc is-live=true period=20 metadata="testing...DEF" ! web1.data_sink -v