onDatachannel not working :(

389 views
Skip to first unread message

koiba...@gmail.com

unread,
Aug 27, 2018, 9:58:21 AM8/27/18
to discuss-webrtc

I have two PeerConnections, which is properly established and can forward video and audio.

I created datachannel before creating the offer

when I "createDataChannel" and "registerObserver", "onStateChange" method is triggered and datachannel state is open.

But I attached the ondatachannel event to the PeerConnection. It never triggers for some reason. So i cannot get remote datachannel.


A log showed A datachannel is open

B log showed B datachannel is open

But A never trigger the B peerconnection's "onDataChannel" event

B never trigger the A peerconnection's "onDataChannel" event


Why I cannot establish datachannel? :(


//local peerconnection

DataChannel dataChannel = pc.createDataChannel("ApprtcDemo data", init);

dataChannel.registerObserver(new DataChannel.Observer() {

    @Override

    public void onBufferedAmountChange(long previousAmount) { }


    @Override

    public void onStateChange() {  }


    @Override

    public void onMessage(final DataChannel.Buffer buffer) {}

});


//remote peerconnection

public void onDataChannel(DataChannel dc) {    // it never never never triggers

   datachannel = dc;

    dc.registerObserver(new DataChannel.Observer() {

        @Override

        public void onBufferedAmountChange(long previousAmount) {

        }


        @Override

        public void onStateChange() {

        }


        @Override

        public void onMessage(final DataChannel.Buffer buffer) {

        }

    });

}


Here is "local" SDP

{sdpAnswer=v=0

    o=- 3743307821 3743307821 IN IP4 0.0.0.0

    s=Kurento Media Server

    c=IN IP4 0.0.0.0

    t=0 0

    a=msid-semantic: WMS ARDAMS

    a=group:BUNDLE 0 1

    m=video 1 UDP/TLS/RTP/SAVPF 96 100

    a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time

    a=mid:0

    a=rtcp:9 IN IP4 0.0.0.0

    a=rtpmap:96 VP8/90000

    a=rtpmap:100 H264/90000

    a=rtcp-fb:96 goog-remb

    a=rtcp-fb:96 ccm fir

    a=rtcp-fb:96 nack

    a=rtcp-fb:96 nack pli

    a=rtcp-fb:100 goog-remb

    a=rtcp-fb:100 ccm fir

    a=rtcp-fb:100 nack

    a=rtcp-fb:100 nack pli

    a=setup:active

    a=sendrecv

    a=rtcp-mux

    a=fmtp:100 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f

    a=ssrc:4275305174 cname:user3113647210@host-e35e4a62

    a=ice-ufrag:3QZ4

    a=ice-pwd:xwhcs0o3G1Smj4GNscNi6A

    a=fingerprint:sha-256 0B:6F:CC:0A:89:A3:09:CD:92:F3:08:11:F7:4C:6D:B0:9F:80:24:3A:EA:C1:AA:06:E6:4C:9A:F3:3B:6B:6D:5B

    m=audio 1 UDP/TLS/RTP/SAVPF 111 0

    a=mid:1

    a=rtcp:9 IN IP4 0.0.0.0

    a=rtpmap:111 opus/48000/2

    a=rtpmap:0 PCMU/8000

    a=setup:active

    a=sendrecv

    a=rtcp-mux

    a=fmtp:111 minptime=10;useinbandfec=1

    a=ssrc:4034525503 cname:user3113647210@host-e35e4a62

    a=ice-ufrag:3QZ4

    a=ice-pwd:xwhcs0o3G1Smj4GNscNi6A

    a=fingerprint:sha-256 0B:6F:CC:0A:89:A3:09:CD:92:F3:08:11:F7:4C:6D:B0:9F:80:24:3A:EA:C1:AA:06:E6:4C:9A:F3:3B:6B:6D:5B

    , }


Here is "remote" SDP

{sdpAnswer=v=0

    o=- 3743307821 3743307821 IN IP4 0.0.0.0

    s=Kurento Media Server

    c=IN IP4 0.0.0.0

    t=0 0

    a=msid-semantic: WMS

    a=group:BUNDLE 0 1

    m=audio 1 UDP/TLS/RTP/SAVPF 111 0

    a=mid:0

    a=rtcp:9 IN IP4 0.0.0.0

    a=rtpmap:111 opus/48000/2

    a=rtpmap:0 PCMU/8000

    a=setup:active

    a=sendonly

    a=rtcp-mux

    a=fmtp:111 minptime=10;useinbandfec=1

    a=ssrc:3777116269 cname:user1501105106@host-d10399e7

    a=ice-ufrag:fQBB

    a=ice-pwd:8F5PyS8fVfGwUAcvG7ejpy

    a=fingerprint:sha-256 0B:6F:CC:0A:89:A3:09:CD:92:F3:08:11:F7:4C:6D:B0:9F:80:24:3A:EA:C1:AA:06:E6:4C:9A:F3:3B:6B:6D:5B

    m=video 1 UDP/TLS/RTP/SAVPF 96 100

    a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time

    a=mid:1

    a=rtcp:9 IN IP4 0.0.0.0

    a=rtpmap:96 VP8/90000

    a=rtpmap:100 H264/90000

    a=rtcp-fb:96 goog-remb

    a=rtcp-fb:96 ccm fir

    a=rtcp-fb:96 nack

    a=rtcp-fb:96 nack pli

    a=rtcp-fb:100 goog-remb

    a=rtcp-fb:100 ccm fir

    a=rtcp-fb:100 nack

    a=rtcp-fb:100 nack pli

    a=setup:active

    a=sendonly

    a=rtcp-mux

    a=fmtp:100 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f

    a=ssrc:20397261 cname:user1501105106@host-d10399e7

    a=ice-ufrag:fQBB

    a=ice-pwd:8F5PyS8fVfGwUAcvG7ejpy

    a=fingerprint:sha-256 0B:6F:CC:0A:89:A3:09:CD:92:F3:08:11:F7:4C:6D:B0:9F:80:24:3A:EA:C1:AA:06:E6:4C:9A:F3:3B:6B:6D:5B

    , },


Steve Anton

unread,
Aug 27, 2018, 4:30:13 PM8/27/18
to discuss...@googlegroups.com
Hi,

It looks like neither the offer nor answer have a data channel. There should be a line that looks like:

m=application 9 DTLS/SCTP 5000

Make sure that your code creates the data channel before creating the offer and answer.

Best,
Steve

--

---
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/7fb26a78-65bf-432c-9f12-dc1649e91370%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages