How to use webrtcbin DataChannel

Soebirk, Thorsten Nordholm Thorsten.Sobirk at
Mon Jun 8 13:32:37 UTC 2020

Thanks Matt. Good resources.

My failure to find these myself seems to be because I am working with the Java bindings, and I was therefore searching for "DataChannel" (one word) rather than "data-channel" or "data_channel". I'll remember that in the future.

The only thing in the examples that struck me as different from my own program is that the examples set the bundle-policy to "max-bundle". I tried this and my program now works. :)

I am now facing a new challenge. I am using the DataChannel implementation from this fork ( of the gst1-java-core bindings. It only exposes the "send-string" signal, which works, but I need to send binary data. So I need to figure out how to wrap the "send-data" signal. GStreamer expects a GBytes pointer and I can't seem to figure out how to provide something compatibly from Java. I have tried simply supplying a byte[] or a ByteBuffer, but in both cases it gives the error "Requested to send data that is too large" which is probably just an indication that GStreamer doesn't know what to do with the data. Any idea what a correct binding would look like? Og should I be asking this elsewhere?


Best regards,

From: Matthew Waters [mailto:ystreet00 at]
Sent: 07 June 2020 03:05
To: Discussion of the development of and with GStreamer <gstreamer-devel at>; Soebirk, Thorsten Nordholm <Thorsten.Sobirk at>
Subject: Re: How to use webrtcbin DataChannel

What version of GStreamer are you using? You may need the latest master for fixes in some specific cases.

There is an example of data channels within  Search for channel.  There is also data channel usage in the unit tests:

Offers will only be produced if you call the 'create-offer' signal.  That can be in response to the 'negotiation-needed' signal but that is not required.

You don't need to set webtcbin to READY to renegotiate the SDP (within the supported renegotiation scenarios).


On 7/6/20 3:31 am, Soebirk, Thorsten Nordholm wrote:

I am struggling to figure out how to use DataChannels in WebRTC using webrtcbin (using version 1.16.2), and I can't find any example code to illustrate this. My application initiates the WebRTC connection, i.e. sends the offer. It also sends and receives both audio and video streams. Everything works fine except for DataChannels.

Here's what I've tried so far:

1. If I send the create-data-channel signal before sending the offer while webrtcbin is in state ready, no offer is ever produced. Also, no error message is given.

2. If I wait until audio and video have started streaming and then set state back to ready, signal create-data-channel, and set state to play again, this seems to work in that I get a DataChannel instance back. But when I subsequently try to send data using this DataChannel, I get a "not open" error.

3. Signaling create-data-channel when webrtcbin is not in ready state just gives an error.

I wonder if I am missing something simple or perhaps doing things in the wrong order. Any help greatly appreciated. A simple working example would be awesome.

Best regards,


gstreamer-devel mailing list

gstreamer-devel at<mailto:gstreamer-devel at>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gstreamer-devel mailing list