WebRTC DataChannel set local offer issue. [ios]

681 views
Skip to first unread message

Sergey Alyasev

unread,
Oct 25, 2016, 5:24:03 PM10/25/16
to discuss-webrtc
The issue is the setLocalDescription method fails with the following error:
"Error Domain=org.webrtc.RTCPeerConnection Code=-1 "Failed to set local offer sdp: Failed to create channels."

I'm trying to create data channel for text messages. No video/audio for this peer connection. So constrains:
    NSDictionary *mandatoryConstraints = nil;
    NSDictionary *optionalConstraints = @{
                                          @"internalSctpDataChannels" : @"true",
                                          @"DtlsSrtpKeyAgreement" : @"true"};
    RTCMediaConstraints* constraints = [[RTCMediaConstraints alloc] initWithMandatoryConstraints:mandatoryConstraints
                                                                             optionalConstraints:optionalConstraints];

My data channel config is the following:
     RTCDataChannelConfiguration *dataConfiguration = [[RTCDataChannelConfiguration alloc] init];
    dataConfiguration.channelId = 1;
Generating sdp works without errors:

                    [self.peerConnection offerForConstraints:[self setupDefaultConstraintsForDataChannel]
                                           completionHandler:^(RTCSessionDescription *sdp,
                                                               NSError *error) {
                                                        ...        });
 SoI got the following sdp that then I try to set using setLocalDescription:
RTCSessionDescription:
offer
v=0
o=- 8070301700869088933 2 IN IP4 127.0.0.1
s=-
t=0 0
a=msid-semantic: WMS
m=application 9 DTLS/SCTP 5000
c=IN IP4 0.0.0.0
a=ice-ufrag:X7ry
a=ice-pwd:evDTtIxBdjsY6LdxbbWmgkDI
a=ice-options:renomination
a=fingerprint:sha-256 5E:67:C9:8E:67:0E:7A:CE:A7:07:13:17:4B:B2:46:BB:93:72:44:8E:C7:E7:1A:7C:3A:BA:A8:A2:83:DA:B8:58
a=setup:actpass
a=mid:data
a=sctpmap:5000 webrtc-datachannel 1024


Why libjingle doesn't accept a local description that was generate ?
Could anyone faced with the same issue?

Thanks in advance.

Taylor Brandstetter

unread,
Oct 25, 2016, 6:54:00 PM10/25/16
to discuss...@googlegroups.com
It sounds like you could be hitting this issue: https://bugs.chromium.org/p/webrtc/issues/detail?id=6218

It's the main case I know where the PeerConnection rejects an offer that its own self created... Are you using max-bundle?

--

---
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-webrtc+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/f654a6f8-eb9e-4086-8533-0b204190916d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sergey Alyasev

unread,
Oct 26, 2016, 6:00:16 PM10/26/16
to discuss-webrtc
Hi Taylor,

Did you mean some RTCBundlePolicy settings in peer connection configuration?
I don't change the RTCBundlePolicy and RTCRtcpMuxPolicy properties at all. These values are always be default.
RTCConfiguration is the same for audio/video and data channel.
ICE_SERVERS array
ALL
MAX_BUNDLE
REQUIRE
TCP_ENABLED
CANDIDATE_ALL_NETWORKS
GATHER_ONCE
50
1000
-1
0
0
0
}

In addition, audio/video calls works well, local and remote offers set correctly. But they has bundle group. Example:
sdp = "RTCSessionDescription:\nanswer\nv=0
\no=- 6680864367847169940 2 IN IP4 127.0.0.1
\ns=-
\nt=0 0
\na=group:BUNDLE audio video
\na=msid-semantic: WMS ARDAMS
\nm=audio 63232 UDP/TLS/RTP/SAVPF 111 103 104 9 102 0 8 106 105 13 126
....
....
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.

Sergey Alyasev

unread,
Oct 26, 2016, 6:20:38 PM10/26/16
to discuss-webrtc
I tried set balanced bundle policy and offer set succeeded.
RTCConfiguration *config = [[RTCConfiguration alloc] init];
config.iceServers = self.iceServers;
config.bundlePolicy = RTCBundlePolicyBalanced;
self.peerConnection = [self.peerConnectionFactory peerConnectionWithConfiguration:config
                                                                              constraints:self.defaultConstraints
                                                                                 delegate:self];

But, It is strange for me.

Thanks you.


On Thursday, October 27, 2016 at 1:00:16 AM UTC+3, Sergey Alyasev wrote:
Hi Taylor,

Did you mean some RTCBundlePolicy settings in peer connection configuration?
.......

Taylor Brandstetter

unread,
Oct 26, 2016, 7:39:46 PM10/26/16
to discuss...@googlegroups.com
Oh, it seems that for Objective-C the default policy is "MAX_BUNDLE" due to this CL: https://codereview.webrtc.org/2297663004

I'm not sure why the Objective-C defaults are different than the C++/Java/Chrome defaults. I generally prefer when every version of the API works the same way. Anyway; glad you were able to find a workaround.

--

---
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-webrtc+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/05f4ec60-0e67-4d23-89d3-76c6ef1142de%40googlegroups.com.

Xavi R. Pinteño

unread,
Oct 28, 2016, 10:15:53 AM10/28/16
to discuss-webrtc
I have also hit this issue and came to the same workaround, setting either RTCBundlePolicyBalancer or RTCBundlePolicyMaxCompat to the config.bundlePolicy.

A problem with this is that delegate

- (void) peerConnection:(RTCPeerConnection *)peerConnection didChangeIceConnectionState:(RTCIceConnectionState)newState;


is getting continuously called with either completed/connected newState.

Reply all
Reply to author
Forward
0 new messages