DataChannel on Android only opens on one side

695 views
Skip to first unread message

Cyrill

unread,
Jul 16, 2014, 3:32:09 PM7/16/14
to discuss...@googlegroups.com
Hi,

I'm trying to get a DataChannel between two Android devices. Chrome and Firefox to Android works really good but I'm running into this when trying it between two Android devices:

I tested this between a Nexus 5 and a Nexus 7 (2012) over a strong WLAN conneciton.
On the offerer side the dataChannel.state never gets set to DataChannel.State.OPEN. On the receiver end it does.
Some logs (DataChannelService is my service that creates the PeerConnection etc.)

offerer:

I/DataChannelService( 5639): IceConnectionState changed: CONNECTED
I/DataChannelService( 5639): Ice Connection complete, registering Observers
I/DataChannelService( 5639): IceConnectionState changed: COMPLETED
I/libjingle( 5639): Channel socket writable (data, 1) for the first time
I/libjingle( 5639): Using Cand[2702239670:1:udp:2122129151:192.168.1.103:41326:local::0:ONTsw7w84B7WuzBc:jc4ItFqNg1IsBT2
yd52kRsBs]->Cand[3467446226:1:udp:2122129151:192.168.1.109:60366:local::0:W7sBpQ0vV8TC/Y0t:COSc71Ot9jtyzDOSOrC7U/wx]
I/libjingle( 5639): Changing data state, recv=1 send=1
I/libjingle( 5639): Sent CONTROL message on channel 1
I/libjingle( 5639): DataChannel received OPEN_ACK message, sid = 1
... 

peer/receiver:
 
I/DataChannelService(26746): IceConnectionState changed: CONNECTED
I/DataChannelService(26746): Ice Connection complete, registering Observers
I/libjingle(26746): Channel socket writable (data, 1) for the first time
I/libjingle(26746): Using Cand[3467446226:1:udp:2122129151:192.168.1.109:60366:local::0:W7sBpQ0vV8TC/Y0t:COSc71Ot9jtyzDO
SOrC7U/wx]->Cand[2702239670:1:udp:2122129151:192.168.1.103:41326:local::0:ONTsw7w84B7WuzBc:jc4ItFqNg1IsBT2yd52kRsBs]
I/libjingle(26746): Changing data state, recv=1 send=1
I/DataChannelService(26746): PeerConnection onDataChannel State: CONNECTING
I/libjingle(26746): Sent CONTROL message on channel 1
I/DataChannelService(26746): DataChannel state changed: OPEN

As you can see the offerer gets a writable socket but the DataChannel never opens. On the peer the onDataChannel state changes are logged and the DataChannel opens.
I tried to send messages between them after this but in neither direction anything arrives.
I have tried to offer on both devices with the same results.

Any idea what is going on here?

Jiayang Liu

unread,
Jul 17, 2014, 12:21:11 PM7/17/14
to discuss...@googlegroups.com
Is the offerer datachannel in "connecting" state? You may add more logging in DataChannel::UpdateState to see why it doesn't transition to OPEN.

Are you using an up-to-date webrtc checkout?

Cyrill

unread,
Jul 20, 2014, 11:49:44 AM7/20/14
to discuss...@googlegroups.com
I just realised that on the offerer side the datachannel never gets created as onDataChannel doesn't fire. I'm calling peerConnection.createDataChannel on the offerer and I figured that should trigger onDataChannel.
I updated and built libjingle last tuesday.

Jiayang Liu

unread,
Jul 21, 2014, 11:58:55 AM7/21/14
to discuss...@googlegroups.com
The offerer DataChannel reference is returned from offerer.createDataChannel, not from onDataChannel. 

OnDataChannel is only called on the remote side not calling createDataChannel.

Cyrill

unread,
Jul 21, 2014, 2:08:19 PM7/21/14
to discuss...@googlegroups.com
Ah, that makes sense. It's working great now, thanks!
But is there some documentation about DataChannels with libjingle? I feel like I have the guess a lot of things here...

Jiayang Liu

unread,
Jul 21, 2014, 2:17:37 PM7/21/14
to discuss-webrtc
If you are familiar with the JS API (http://dev.w3.org/2011/webrtc/editor/webrtc.html), it's fairly straight forward to map it to the C++ API.


--

---
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/71W8aW-vMzU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to discuss-webrt...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gilded Honour

unread,
Apr 14, 2015, 6:22:01 PM4/14/15
to discuss...@googlegroups.com
So what side should I call createDataChannel on:  "offer" or "answer" 's?
Reply all
Reply to author
Forward
0 new messages