[libmediasoupclient] Error when creating DataProducer using ProduceData method of SendTransport

  • Use libmediasoupclient v3

  • Development environment vs2019

  • webrtc version m84

Error point:

Error when creating DataProducer using ProduceData method of SendTransport

  1. The ProduceData method calls SendDataChannel (line 282 in the file Transport.cpp)
  2. The SendDataChannel method calls SetLocalDescription (line 378 in the file Handler.cpp)
  3. An error occurred on line 204 of the SetLocalDescription method, and an exception was thrown

In line 281 of Transport.cpp, may throw is written.

In the current situation, the future on line 204 of the SetLocalDescription method is empty, and an exception is raised.

In addition, the SendTransport I used was created using the device.CreateSendTransport method. It is also responsible for audio and video.

The server uses the server in mediasoup-demo.

Any ideas about the solution?

v=0
o=- 7423721318464670085 4 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE 0 1 2
a=msid-semantic: WMS 0
m=audio 49796 UDP/TLS/RTP/SAVPF 111 103 104 9 102 0 8 106 105 13 110 112 113 126
c=IN IP4 192.168.1.194

…some a…

m=video 49797 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 127 123 125 122 124 107 108
c=IN IP4 192.168.1.194

…some a…

m=application 9 UDP/DTLS/SCTP webrtc-datachannel
c=IN IP4 0.0.0.0

…some a…

sdp information is above

But I’m sorry, due to restrictions, I can’t paste them all here.

The deepest point debugged so far is the call to GetDataChannelTransport in the SetupDataChannelTransport_n method (located at line 6716 in the file webrtc\pc\peer_connection.cc). It cannot get the transport (mid is 2). I still don’t know how to solve it. ::

Let’s have a look at how you create the transport. Please show some code.

Okay thank you.
Below is the code, I added some comments in the code.

And what’s exactly the error/exception that you get?

As shown in the figure:
The exception is: “Failed to set local offer sdp: Failed to create data channel.”
That’s what I said earlier.

Unfortunately no idea. I would double check the SCTP parameters, since that’s the actual data transport used by Webrtc.

Not sure about the error but ensure you are using the latest libmediasoupclient version.

Thanks. I have updated to the latest version, but it still doesn’t work.

sctpParameters is returned by the signaling 'createWebRtcTransport ’ in the server of mediasoup-demo, and the content is as follows:
MIS: 1024
OS: 1024
isDataChannel: true
maxMessageSize: 262144
port: 5000
sctpBufferedAmount: 0
sendBufferSize: 262144

BTW, using app(web) in mediasoup-demo can support chat. So I think this may not be a server-side problem.

May or may not be related, but the following request:

nlohmann::json r2 = _signaling->SyncRequest(“createWebRtcTransport”, j2);

…should probably be async?

SyncRequest is implemented using std::promise. In fact, it is asynchronous. This name may not be accurate.