WebRTC dtls errors when sender and receiver are on different networks.

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

WebRTC dtls errors when sender and receiver are on different networks.

Mandar Joshi
Hello,
I am getting errors from GDTlsConnection while using WebRTC with the
sender being on my workstation (wired connection) and receiver on an
Android Phone on Wifi but on a different network. The signalling
server is running on my workstation.

The network structure is
http://www.czarsoftech.com/opensource/images/webrtc_network_setup.png

The error in adb logcat is

GStreamer+dtlsconnection: 0:00:11.613128537 0xb7ad1db0
gstdtlsconnection.c:737:openssl_poll:<GstDtlsConnection@0xb7a3df30>
do_handshake encountered BIO error

Can someone please tell me where I should start debugging ?

When the Android phone is connected to the same network as the
workstation, the pad-added callback is invoked but there are a few for
the 'BIO error' messages before that happens.

The problem occurs on a Linux laptop on the same network as the
Android Phone. However, here the error message is

dtlssrtpdemux gstdtlssrtpdemux.c:134:sink_chain:<dtlssrtpdemux1>
received invalid buffer: 1

The problem only occurs when the sender and the receiver are on
different networks. I am using Google's STUN server
stun://stun.l.google.com:19302

Any suggestions?

Regards
Mandar Joshi
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: WebRTC dtls errors when sender and receiver are on different networks.

Mandar Joshi
> The network structure is
> http://www.czarsoftech.com/opensource/images/webrtc_network_setup.png

With G_MESSAGES_DEBUG=all, I am able to see the libnice messages and there are
"Failed Pair" messages when sender and receiver are on different networks

Here's the log. Can somebody please have a look?

https://pastebin.com/xTscCJLe

Regards
Mandar Joshi
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: WebRTC dtls errors when sender and receiver are on different networks.

Mandar Joshi
>
> > The network structure is
> > http://www.czarsoftech.com/opensource/images/webrtc_network_setup.png
>
I think I've narrowed down the problem to libnice issues.

Unfortunately I have no experience with it. Here's the log at the
receiver end https://pastebin.com/GEv6c0cq

Could it be a simple network setup issue?


Regards
Mandar Joshi
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: WebRTC dtls errors when sender and receiver are on different networks.

Olivier Crête-3
Hi

The libnice log says "4 valid", which means that it thinks it managed
to make a connection. Do you run libnice on the other side too? Do you
have a matching log from the same attempt on both sides? It indeed
never gets to the "connected" state.

Which version of libnice are you using? Can you try with the git master
version?

Olivier

On Sun, 2018-10-21 at 12:31 +0530, Mandar Joshi wrote:
> >
> > > The network structure is
> > >
http://www.czarsoftech.com/opensource/images/webrtc_network_setup.png

>
> I think I've narrowed down the problem to libnice issues.
>
> Unfortunately I have no experience with it. Here's the log at the
> receiver end https://pastebin.com/GEv6c0cq
>
> Could it be a simple network setup issue?
>
>
> Regards
> Mandar Joshi
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
--
Olivier Crête
[hidden email]

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: WebRTC dtls errors when sender and receiver are on different networks.

Mandar Joshi
> Which version of libnice are you using? Can you try with the git master
> version?
>
The libnice version is 0.1.14
I just check on github and this one is quite old.
I'll run the sender and receiver again and post both logs on pastebin.

Thanks for the quick reply.

Regards
Mandar Joshi
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: WebRTC dtls errors when sender and receiver are on different networks.

Mandar Joshi
In reply to this post by Olivier Crête-3
Forgot the reply to this.

> Do you run libnice on the other side too?
Yes.

I have a sender (workstation) and receiver (laptop) as shown in
http://www.czarsoftech.com/opensource/images/webrtc_network_setup.png

Both are written in C using GStreamer 1.14.1 and I have libnice 0.1.14
installed.

Regards
Mandar Joshi
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: WebRTC dtls errors when sender and receiver are on different networks.

Mandar Joshi
In reply to this post by Olivier Crête-3
Hello Olivier,

> Do you have a matching log from the same attempt on both sides?

Here are the logs

Receiver: https://pastebin.com/GEv6c0cq
Sender: https://pastebin.com/8BFcdaxJ

Regards
Mandar Joshi
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: WebRTC dtls errors when sender and receiver are on different networks.

Mandar Joshi
In reply to this post by Olivier Crête-3
> Can you try with the git master version?

With libnice from git master, I was able to move forward.
the "pad-added" callback gets invoked but I get an error from srtpdec,
"srtpdec unable to unprotect buffer"

I also need to try this on my Android phone. Guess I'll have to
compile the latest libnice for Android.

Regards
Mandar Joshi
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: WebRTC dtls errors when sender and receiver are on different networks.

Mandar Joshi
Hello Olivier,

> > Can you try with the git master version?
>
I compiled libnice master for Android. With this new libnice, I am
able to establish connection in the network shown here
http://www.czarsoftech.com/opensource/images/webrtc_network_setup.png

However, it does not work with the phone's 4G connection. Here the
sender's log https://pastebin.com/QWBfUctN

Can you please have a look?

Regards
Mandar Joshi
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: WebRTC dtls errors when sender and receiver are on different networks.

Mandar Joshi
Hello,
I've narrowed down the problem further.
I'm doing all testing using Nirbheek's gstwebrtc-demo sendrecv C demo
with webrtc.nirbheek.in

Here is the log when webrtc.nirbheek.in is opened on Android's Chrome
browser https://pastebin.com/Kp1xFjn1 (This works)
and here is the log when it's opened on a USB tethered Chrome browser
https://pastebin.com/1wqyC0Nr (Doesn't Work)

libnice debug log doesn't show any inbound STUN packets after the
STUN-CC REQ message in the second case.

Appreciate any help.

Regards
Mandar Joshi
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: WebRTC dtls errors when sender and receiver are on different networks.

Nirbheek Chauhan
On Tue, Oct 23, 2018 at 10:27 AM Mandar Joshi <[hidden email]> wrote:

> I've narrowed down the problem further.
> I'm doing all testing using Nirbheek's gstwebrtc-demo sendrecv C demo
> with webrtc.nirbheek.in
>
> Here is the log when webrtc.nirbheek.in is opened on Android's Chrome
> browser https://pastebin.com/Kp1xFjn1 (This works)
> and here is the log when it's opened on a USB tethered Chrome browser
> https://pastebin.com/1wqyC0Nr (Doesn't Work)
>
> libnice debug log doesn't show any inbound STUN packets after the
> STUN-CC REQ message in the second case.
>

In all likelihood the NAT used by the USB tethering on your phone
doesn't support STUN. Check chrome://webrtc-internals on the browser,
and compare with how, say, appear.in works.

In any case, you almost always want to setup your own TURN server for
cases where STUN cannot succeed and set that in the configuration.

Cheers,
Nirbheek
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: WebRTC dtls errors when sender and receiver are on different networks.

Mandar Joshi
Hello,
>
> In all likelihood the NAT used by the USB tethering on your phone
> doesn't support STUN.

Got it. thanks.

> In any case, you almost always want to setup your own TURN server for
> cases where STUN cannot succeed and set that in the configuration.
>
When I try to view the WebRTC stream from a gstreamer app on my phone,
I do get inbound STUN messages but the libnice says that the message
integrity check failed and I get 401 unauthorized. Wireshark logs say
"Binding Error Response error-code: 401 (Unauthorized)".

Can you please have a look at this https://pastebin.com/fwmgiKty

Regards
Mandar Joshi
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: WebRTC dtls errors when sender and receiver are on different networks.

Mandar Joshi
In reply to this post by Nirbheek Chauhan
> > I've narrowed down the problem further.

The ICE candidates I've receiving in a JSON message at the sender
(workstation, wired connection) from my Android app only have
reference to the local IP assigned by the network provider to the
phone.

For some reason even though the stun-server property of webrtcbin is
set to Google's STUN server, I am not receiving the public IP of the
phone.

Any ideas how I can debug this?

Regards
Mandar Joshi
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel