[C++] How to set up an SCTP Datachannel ?

1,025 views
Skip to first unread message

Nicolas

unread,
Mar 6, 2014, 1:13:54 PM3/6/14
to discuss...@googlegroups.com
Hi,

I am trying to modify the peerconnection client example to create an SCTP datachannel. I want it to work between two native clients.

I create the peerconnection object with the constraint kEnableDtlsSrtp, and then I call its CreateDataChannel method. Then sdp are exchanged and when the answer is received, I get an error in SetRemoteDescription: "Failed to set data receive codecs". Immediately after SetRemoteDescription I get a segmentation fault on session_description->type().

If I set "local_port_" manually to the SCTP port number in SctpDataMediaChannel::SetRecvCodecs, I can establish a connection and exchange data using the datachannel, but I get an error (in srtpfilter.cc) "Failed to unprotect SRTP packet, err=2", and (in channel.cc) "Failed to unprotect audio RTP packet:" and "Failed to unprotect video RTP packet:".

Why do I get an error if I do not set "local_port_" like that ? Why do I still get errors if I do ?

Thanks !


Nicolas

Pau Ceano

unread,
Mar 31, 2014, 12:28:37 PM3/31/14
to discuss...@googlegroups.com

I am in a very similar situation, any advances?

Jiayang Liu

unread,
Mar 31, 2014, 2:33:15 PM3/31/14
to discuss...@googlegroups.com
Could you attach the offer and answer SDP?

Pau Ceano

unread,
Apr 1, 2014, 6:02:18 AM4/1/14
to discuss...@googlegroups.com
Sure,
I start communication from my app (a modification of peer_connection_client) and use WebRTCPeerconnection JS example.
Using the same testbench RTP Data channel works well.

Offer:
v=0
o=- 4589503729374787877 2 IN IP4 127.0.0.1
s=-
t=0 0
a=msid-semantic: WMS
m=application 1 DTLS/SCTP 5000
c=IN IP4 0.0.0.0
a=ice-ufrag:txUovafjLjoESJL9
a=ice-pwd:aTRxo6zFYlclnbs2wfQrV/PX
a=ice-options:google-ice
a=fingerprint:sha-1 C4:95:AA:1A:34:C7:D4:0D:DA:71:C0:C5:6E:8A:F6:75:C6:5B:00:88
a=setup:actpass
a=mid:data
a=sctpmap:5000 webrtc-datachannel 1024

Answer (I use ):
v=0
o=- 372770647812769445 2 IN IP4 127.0.0.1
s=-
t=0 0
a=msid-semantic: WMS
m=application 1 DTLS/SCTP 5000
c=IN IP4 0.0.0.0
a=ice-ufrag:jaF+SpqRCiDsZR82
a=ice-pwd:CUOXeU8BpV9vmV/wRNuELnXE
a=fingerprint:sha-256 78:2B:42:F5:0C:2E:15:F6:D2:60:D4:7B:30:12:58:00:70:D4:98:E5:7E:0A:82:08:55:AA:26:DC:A1:0B:96:15
a=setup:active
a=mid:data
a=sctpmap:5000 webrtc-datachannel 1024

And I get same errors explained by Nicolas. R
esumed:
Setting local data description
Warning(channel.cc:2265): Failed to set local data description
Error(channel.cc:659): Failure in SetLocalContent with action 0
Error(webrtcsession.cc:253): Failed to set local offer sdp: Session error code: ERROR_CONTENT. Session error description: Failed to set data receive codecs..

Thanks for your help,

Pau

Philipp Hancke

unread,
Apr 1, 2014, 6:08:38 AM4/1/14
to discuss...@googlegroups.com
I have seen that error recently when one side was using rtp data channels (i.e. was passing RtpDataChannels:true to the peerconnection constructor).
Arguably, the error message might be improved then, but RTP data channels are not worth the effort ;-)


--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Pau Ceano

unread,
Apr 1, 2014, 8:04:23 AM4/1/14
to discuss...@googlegroups.com, philipp...@googlemail.com
Thks, I double-checked that and from the oferer I am only defining EnableDtlsSrtp flag  in the constraints. The receiver is WebRTCPeerconnection and has the RTP check box unchecked.

Jiayang Liu

unread,
Apr 1, 2014, 12:15:01 PM4/1/14
to discuss-webrtc, Philipp Hancke, Lally Singh
I think this is similar to what Lally saw when he developed the end-to-end tests: he solved it by serializing the SDP to a string and parsing it to get the codec (i.e. SCTP port) populated.

You can try that to unblock yourself. Meanwhile please file a bug at https://code.google.com/p/webrtc/issues/list


--

---
You received this message because you are subscribed to a topic in the Google Groups "discuss-webrtc" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/discuss-webrtc/VVb3to005Iw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to discuss-webrt...@googlegroups.com.

Pau Ceano

unread,
Apr 1, 2014, 12:22:17 PM4/1/14
to discuss...@googlegroups.com, Philipp Hancke, Lally Singh
Thanks for the answer but I do not totally understand.
You talk about the offer SDP?
Where I have to define the codec?
is Lally workaround documented?

thks.

Jiayang Liu

unread,
Apr 1, 2014, 12:41:56 PM4/1/14
to discuss-webrtc, Philipp Hancke, Lally Singh
No documentation as his work is in progress, I think.


do not do: peer_connection_->SetLocalDescription(
      DummySetSessionDescriptionObserver::Create(), desc);
but do:
peer_connection_->SetLocalDescription(
      DummySetSessionDescriptionObserver::Create(), CreateSessionDescription("offer", sdp));

Pau Ceano

unread,
Apr 1, 2014, 1:13:54 PM4/1/14
to discuss...@googlegroups.com, Philipp Hancke, Lally Singh
thks. Now it is working.

Jiayang Liu

unread,
Apr 1, 2014, 1:16:32 PM4/1/14
to discuss-webrtc, Philipp Hancke, Lally Singh
Could you file a bug?

Pau Ceano

unread,
Apr 1, 2014, 1:28:17 PM4/1/14
to discuss...@googlegroups.com, Philipp Hancke, Lally Singh

sure, doing it.
Reply all
Reply to author
Forward
0 new messages