WebRTC connection failed due to DTLS error

Vladimir Tyutin vladimir.tyutin at gmail.com
Thu Dec 31 15:06:04 UTC 2020


Finally I found the issue. 
Library responsible for AES algorithms was missed in the build. So I added it and dtls was successfully connected 

> On 31 Dec 2020, at 16:29, Soebirk, Thorsten <Thorsten.Sobirk at itelligence.dk> wrote:
> 
> 
> Could this be a lead? https://stackoverflow.com/a/59372624/2731792
>  
> / Thorsten
>  
> From: gstreamer-devel [mailto:gstreamer-devel-bounces at lists.freedesktop.org] On Behalf Of Vladimir Tyutin
> Sent: 30. december 2020 19:47
> To: Discussion of the development of and with GStreamer <gstreamer-devel at lists.freedesktop.org>
> Subject: Re: WebRTC connection failed due to DTLS error
>  
> EXTERNAL MAIL:  
>  
> Hi Everyone,
> I'm still trying to solve this webrtc issue in gstreamer version 1.18.2.
> Please assist me with it. 
> Digging inside the logs I found that it seems to be DTLS issue. 
> I see in the log (see below) that DTLSTransport state is 0x3 (CONNECTING) for both streams. 
> Then I see errors for OpenSSL and state of dtlstransport becomes 0x2 (FAILED).
> After that webrtc reports peer connection state is failed and it's over. 
>  
> Please review the log below and suggest what is wrong and how to get it solved. 
>  
> 0:02:12.965308316  1078  0x1510fb0 TRACE              webrtcbin gst-plugins-bad-1.18.2/ext/webrtc/gstwebrtcbin.c:1184:_collate_peer_connection_states:<webrtc> returning connecting
> 0:02:12.997038674  1078  0x1510fb0 TRACE              webrtcbin gst-plugins-bad-1.18.2/ext/webrtc/gstwebrtcbin.c:1073:_collate_peer_connection_states:<webrtc> transceiver 0x1504f28 DTLS state: 0x3
> 0:02:12.997216080  1078  0x1510fb0 TRACE              webrtcbin gst-plugins-bad-1.18.2/ext/webrtc/gstwebrtcbin.c:1086:_collate_peer_connection_states:<webrtc> transceiver 0x1504f28 ICE state: 0x2
> 0:02:12.997319324  1078  0x1510fb0 TRACE              webrtcbin gst-plugins-bad-1.18.2/ext/webrtc/gstwebrtcbin.c:1073:_collate_peer_connection_states:<webrtc> transceiver 0x173a800 DTLS state: 0x3
> 0:02:12.997408028  1078  0x1510fb0 TRACE              webrtcbin gst-plugins-bad-1.18.2/ext/webrtc/gstwebrtcbin.c:1086:_collate_peer_connection_states:<webrtc> transceiver 0x173a800 ICE state: 0x2
> 0:02:12.997488898  1078  0x1510fb0 TRACE              webrtcbin gst-plugins-bad-1.18.2/ext/webrtc/gstwebrtcbin.c:1131:_collate_peer_connection_states:<webrtc> ICE connection state: 0x4. DTLS connection state: 0x8
> 0:02:12.997562935  1078  0x1510fb0 TRACE              webrtcbin gst-plugins-bad-1.18.2/ext/webrtc/gstwebrtcbin.c:1184:_collate_peer_connection_states:<webrtc> returning connecting
> 0:02:13.003649538  1078  0x17cfa00 ERROR         dtlsconnection gst-plugins-bad-1.18.2/ext/dtls/gstdtlsconnection.c:985:handle_error:<GstDtlsConnection at 0x191a990> Fatal SSL error
> 0:02:13.003971145  1078  0x17cfa00 ERROR         dtlsconnection gst-plugins-bad-1.18.2/ext/dtls/gstdtlsconnection.c:968:ssl_err_cb:<GstDtlsConnection at 0x191a990> ssl error: 2948545816:error:14102410:lib(20):func(258):reason(1040):NA:0:SSL alert number 40
>  
> 0:02:13.004335832  1078  0x17cfa00 ERROR                dtlsdec gst-plugins-bad-1.18.2/ext/dtls/gstdtlsdec.c:502:process_buffer:<dtlsdec0> Error processing buffer: Fatal SSL error
> 0:02:13.004443659  1078  0x17cfa00 WARN                 dtlsdec gst-plugins-bad-1.18.2/ext/dtls/gstdtlsdec.c:503:process_buffer:<dtlsdec0> error: Fatal SSL error
> 0:02:13.004804096  1078  0x17cfa00 ERROR                dtlsdec gst-plugins-bad-1.18.2/ext/dtls/gstdtlsdec.c:618:sink_chain:<dtlsdec0> Failed to process buffer: error
> 0:02:13.005068414  1078  0x1510fb0 TRACE              webrtcbin gst-plugins-bad-1.18.2/ext/webrtc/gstwebrtcbin.c:1073:_collate_peer_connection_states:<webrtc> transceiver 0x1504f28 DTLS state: 0x2
> 0:02:13.005202156  1078  0x1510fb0 TRACE              webrtcbin gst-plugins-bad-1.18.2/ext/webrtc/gstwebrtcbin.c:1086:_collate_peer_connection_states:<webrtc> transceiver 0x1504f28 ICE state: 0x2
> 0:02:13.005472765  1078  0x1510fb0 TRACE              webrtcbin gst-plugins-bad-1.18.2/ext/webrtc/gstwebrtcbin.c:1073:_collate_peer_connection_states:<webrtc> transceiver 0x173a800 DTLS state: 0x3
> 0:02:13.005710127  1078  0x1510fb0 TRACE              webrtcbin gst-plugins-bad-1.18.2/ext/webrtc/gstwebrtcbin.c:1086:_collate_peer_connection_states:<webrtc> transceiver 0x173a800 ICE state: 0x2
> 0:02:13.005908323  1078  0x1510fb0 TRACE              webrtcbin gst-plugins-bad-1.18.2/ext/webrtc/gstwebrtcbin.c:1131:_collate_peer_connection_states:<webrtc> ICE connection state: 0x4. DTLS connection state: 0xc
> 0:02:13.006157434  1078  0x1510fb0 TRACE              webrtcbin gst-plugins-bad-1.18.2/ext/webrtc/gstwebrtcbin.c:1145:_collate_peer_connection_states:<webrtc> returning failed
> 0:02:13.006358797  1078  0x1510fb0 INFO               webrtcbin gst-plugins-bad-1.18.2/ext/webrtc/gstwebrtcbin.c:1295:_update_peer_connection_state_task:<webrtc> Peer connection state change from connecting(1) to failed(4)
> [CAMERA_DEBUG] Peer connection state: failed
>  
> On Tue, Dec 29, 2020 at 8:29 PM Vladimir Tyutin <vladimir.tyutin at gmail.com> wrote:
> When I set log level 7 my app can’t even successfully start it’s crashed in some time even before I start webrtc. 
>  
> It’s too much for arm processor. 
>  
> As for client version. I’m not sure. I use google webrtc frameworks for Android and iOS. 
> And web JS app I run in Chrome (not sure how to match Chrome version to webrtc version):
> Version 87.0.4280.88 (Official Build) (x86_64)
>  
> 
> 
> On 29 Dec 2020, at 20:05, Anton Pryima <zingfrid at gmail.com> wrote:
>  
> BTW, Vladimir, what gstreamer version do you have at your cleints end?
>  
> On Tue, Dec 29, 2020, 18:14 Vladimir Tyutin <vladimir.tyutin at gmail.com> wrote:
> I could not collect log with GST_DEBUG=7 because it's too much for my camera device. 
> So I collected logs for these plugins:
> export GST_DEBUG=2,webrtc*:7,*rtp*:7,*dtls*:7
>  
> Log started from moment I ask webrtc to create SDP offer. 
> Please give me any idea what might be wrong and how to solve it. 
>  
> Thanks,
> Vladimir
>  
> On Tue, Dec 29, 2020 at 4:06 PM Vladimir Tyutin <vladimir.tyutin at gmail.com> wrote:
> I can collect it from the moment when webrtc offer is generating. 
>  
> My architecture is:
> 1. Remote client (iOS, Android, Web) send MQTT request to camera device to generate SDP offer
> 2. Offer is generating on camera and sent to client. 
> 3. Client responds with SDP answer and webrtc session starts
>  
> I can collect log at the moment offer is generating on camera device.
> 
> 
> On 29 Dec 2020, at 15:56, Anton Pryima <zingfrid at gmail.com> wrote:
>  
> if it is possible, it will be better to have GST_DEBUG=*:7, but cut only the connection state (you know, when it will be.... :)
>  
> Best regards,
> Anton
>  
> On Tue, Dec 29, 2020 at 2:52 PM Vladimir Tyutin <vladimir.tyutin at gmail.com> wrote:
> Sure Anton,
> I will collect it once again and attach it to the next email. 
>  
> I use the following command to activate logging:
> “export GST_DEBUG=2,webrtc*:6,*dtls*:7”
>  
> Let me know if I need to include any other plugins to logging that might assist to analyse the issue. 
>  
> Thanks,
> Vladimir 
> 
> 
> On 29 Dec 2020, at 15:22, Anton Pryima <zingfrid at gmail.com> wrote:
>  
> Hello Vladimir,
>  
> I've tried to google your errors and it looks like that dtls is not the reason. Can you please attach the full connection log from the beginning?
>  
> Best regards,
> Anton.
>  
> On Tue, Dec 29, 2020 at 10:02 AM Vladimir Tyutin <vladimir.tyutin at gmail.com> wrote:
> Anton, 
> It's difficult to do on opponent side because there I have:
> 1. iOS application with webrtc
> 2. Android application with webrtc
> 3. JS application with webrtc
>  
> Can you advise how to check openssl there?
> But all three applications worked well when I used gstreamer version 1.16.0 on my Linux camera device. 
> Once I updated gstreamer version to 1.18.2 on camera device something broke. 
> So I'm pretty sure issue on camera side but I have no idea how to understand this log with dtls error and what should I fix.
>  
> Moreover on my linux camera device I have gnutls and openssl. What is used by dtls plugin? Is it openssl or gnutls?
>  
> Thanks,
> Vladimir  
>  
>  
>  
> On Tue, Dec 29, 2020 at 10:49 AM Anton Pryima <zingfrid at gmail.com> wrote:
> Hello Vladimir.
>  
> Try to execute 'openssl version' at the both sides and provide output.
>  
> Best regards,
> Anton.
>  
> On Mon, Dec 28, 2020, 22:03 Vladimir Tyutin <vladimir.tyutin at gmail.com> wrote:
> I still can't resolve the issue. 
> Can someone with dtls plugin experience analyze the log attached and tell me what is wrong and how to fix it?
>  
> DTLS plugin exists. Openssl is available on my camera device:
> root at tina:~# openssl version
> OpenSSL 1.1.0i  14 Aug 2018
>  
> So why webrtc can't connect due to dtls issue?
>  
> Same code was working on gstreamer version 1.16.0. The issue appeared when I migrated to gstreamer version 1.18.2.
>  
> I have also updated libnice to the latest version. 
>  
> Please help me.
>  
> Thanks,
> Vladimir
>  
> On Thu, Dec 24, 2020 at 10:48 AM Vladimir Tyutin <vladimir.tyutin at gmail.com> wrote:
> Thanks Anton,
> Do you know if there any command in Linux to verify OpenSSL exists and running well?
> In my build for openwrt Linux OpenSSL is included. 
> 
> 
> On 24 Dec 2020, at 10:25, Anton Pryima <zingfrid at gmail.com> wrote:
> 
> 
> Hello Vladimir.
>  
> According to both logs provided, I see an issue with OpenSSL. Please ensure that both ends have correct and working versions of OpenSSL.
>  
> Best regards,
> Anton
> 
> On Thu, Dec 24, 2020, 08:40 Vladimir Tyutin <vladimir.tyutin at gmail.com> wrote:
> Hello everyone,
> Can someone help me with issue below?
> Please review the log from previous mail and suggest what is the issue with dtls and how to fix it. 
>  
> Thanks,
> Vladimir 
> 
> 
> On 20 Dec 2020, at 09:53, Vladimir Tyutin <vladimir.tyutin at gmail.com> wrote:
> 
> 
> Please find the log attached with dtls log level set to 7. 
> Please help me to understand what is wrong and why peer connection is failing. 
>  
> Thanks,
> Vladimir
>  
> On Sun, Dec 20, 2020 at 8:56 AM Vladimir Tyutin <vladimir.tyutin at gmail.com> wrote:
> Hi Sean,
> Thanks for your reply. Could you please advise how better to collect DTLS pcaps?
> I can activate log for DTLS element like this:
> export GST_DEBUG=2,dtls*:7
> Is it enough?
>  
> By the way I'm trying to get webrtc working between Lindenis V536 camera and iOS app. 
> They have already worked before together. On iOS side nothing is changed. 
> in camera side I have migrated from gstreamer version 1.16.0 to version 1.18.2. 
> So is there any changes in dtls side between these versions. 
> Any suggesting how better to debug this issue I would appreciate.
>  
> Thanks,
> Vladimir
>  
> PS. I will share DTLS element logs once I collect it.
>  
> On Sun, Dec 20, 2020 at 1:19 AM Sean DuBois <sean at siobud.com> wrote:
> Hey Vladimir,
> 
> Would you mind getting a pcap of your DTLS traffic? I assume you are
> getting a Close because the clients are incompatible. These are the big
> ones I have seen with DTLS.
> 
> * One side doesn't have use_srtp
> * DTLS v1.0 and v1.2 mismatch
> * One side requiring Extended Master Secret, other side not supporting
> * .... lots of other crazy stuff :)
> 
> thanks
> 
> On Sat, Dec 19, 2020 at 04:54:58PM +0300, Vladimir Tyutin wrote:
> > Please assist me to solve the issue below.
> > I observe WebRTC peer connection can't be established.
> > In log I see some errors related to dtls. Please help me understand the log
> > below and get the issue resolved:
> >
> > 0:01:21.644288173  1090  0x1b401b0 TRACE              webrtcbin
> > gst-plugins-bad-1.18.2/ext/webrtc/gstwebrtcbin.c:1073:_collate_peer_connection_states:<webrtc>
> > transceiver 0x1ab0f08 DTLS state: 0x0
> > 0:01:21.644405214  1090  0x1b401b0 TRACE              webrtcbin
> > gst-plugins-bad-1.18.2/ext/webrtc/gstwebrtcbin.c:1086:_collate_peer_connection_states:<webrtc>
> > transceiver 0x1ab0f08 ICE state: 0x1
> > 0:01:21.644569089  1090  0x1b401b0 TRACE              webrtcbin
> > gst-plugins-bad-1.18.2/ext/webrtc/gstwebrtcbin.c:1073:_collate_peer_connection_states:<webrtc>
> > transceiver 0x1bed050 DTLS state: 0x3
> > 0:01:21.644678631  1090  0x1b401b0 TRACE              webrtcbin
> > gst-plugins-bad-1.18.2/ext/webrtc/gstwebrtcbin.c:1086:_collate_peer_connection_states:<webrtc>
> > transceiver 0x1bed050 ICE state: 0x2
> > 0:01:21.644764381  1090  0x1b401b0 TRACE              webrtcbin
> > gst-plugins-bad-1.18.2/ext/webrtc/gstwebrtcbin.c:1131:_collate_peer_connection_states:<webrtc>
> > ICE connection state: 0x6. DTLS connection state: 0x9
> > 0:01:21.644837673  1090  0x1b401b0 FIXME              webrtcbin
> > gst-plugins-bad-1.18.2/ext/webrtc/gstwebrtcbin.c:1189:_collate_peer_connection_states:<webrtc>
> > Undefined situation detected, returning old state
> > 0:01:21.762102246  1090  0x1f1b7b0 WARN           dtlssrtpdemux
> > gst-plugins-bad-1.18.2/ext/dtls/gstdtlssrtpdemux.c:134:sink_chain:<dtlssrtpdemux2>
> > received invalid buffer: 1
> > 0:01:21.769914036  1090  0x1f1b7b0 ERROR         dtlsconnection
> > gst-plugins-bad-1.18.2/ext/dtls/gstdtlsconnection.c:985:handle_error:<GstDtlsConnection at 0x1da56f0>
> > Fatal SSL error
> > 0:01:21.770157620  1090  0x1f1b7b0 ERROR         dtlsconnection
> > gst-plugins-bad-1.18.2/ext/dtls/gstdtlsconnection.c:968:ssl_err_cb:<GstDtlsConnection at 0x1da56f0>
> > ssl error:
> > 2947169560:error:14102410:lib(20):func(258):reason(1040):NA:0:SSL alert
> > number 40
> >
> > 0:01:21.770551453  1090  0x1f1b7b0 ERROR                dtlsdec
> > gst-plugins-bad-1.18.2/ext/dtls/gstdtlsdec.c:502:process_buffer:<dtlsdec2>
> > Error processing buffer: Fatal SSL error
> > 0:01:21.770553453  1090  0x1b401b0 TRACE              webrtcbin
> > gst-plugins-bad-1.18.2/ext/webrtc/gstwebrtcbin.c:1073:_collate_peer_connection_states:<webrtc>
> > transceiver 0x1ab0f08 DTLS state: 0x0
> > 0:01:21.770745245  1090  0x1b401b0 TRACE              webrtcbin
> > gst-plugins-bad-1.18.2/ext/webrtc/gstwebrtcbin.c:1086:_collate_peer_connection_states:<webrtc>
> > transceiver 0x1ab0f08 ICE state: 0x1
> > 0:01:21.770861286  1090  0x1b401b0 TRACE              webrtcbin
> > gst-plugins-bad-1.18.2/ext/webrtc/gstwebrtcbin.c:1073:_collate_peer_connection_states:<webrtc>
> > transceiver 0x1bed050 DTLS state: 0x2
> > 0:01:21.770951120  1090  0x1b401b0 TRACE              webrtcbin
> > gst-plugins-bad-1.18.2/ext/webrtc/gstwebrtcbin.c:1086:_collate_peer_connection_states:<webrtc>
> > transceiver 0x1bed050 ICE state: 0x2
> > 0:01:21.771039203  1090  0x1b401b0 TRACE              webrtcbin
> > gst-plugins-bad-1.18.2/ext/webrtc/gstwebrtcbin.c:1131:_collate_peer_connection_states:<webrtc>
> > ICE connection state: 0x6. DTLS connection state: 0x5
> > 0:01:21.771119036  1090  0x1b401b0 TRACE              webrtcbin
> > gst-plugins-bad-1.18.2/ext/webrtc/gstwebrtcbin.c:1145:_collate_peer_connection_states:<webrtc>
> > returning failed
> > 0:01:21.771230036  1090  0x1b401b0 INFO               webrtcbin
> > gst-plugins-bad-1.18.2/ext/webrtc/gstwebrtcbin.c:1295:_update_peer_connection_state_task:<webrtc>
> > Peer connection state change from connecting(1) to failed(4)
> > [CAMERA_DEBUG] Peer connection state: failed
> > 0:01:21.770664245  1090  0x1f1b7b0 WARN                 dtlsdec
> > gst-plugins-bad-1.18.2/ext/dtls/gstdtlsdec.c:503:process_buffer:<dtlsdec2>
> > error: Fatal SSL error
> > 0:01:21.772238245  1090  0x1f1b7b0 ERROR                dtlsdec
> > gst-plugins-bad-1.18.2/ext/dtls/gstdtlsdec.c:618:sink_chain:<dtlsdec2>
> > Failed to process buffer: error
> > 0:01:21.808121366  1090  0x1f1ba90 WARN                 basesrc
> > gstreamer-1.18.2/libs/gst/base/gstbasesrc.c:3127:gst_base_src_loop:<nicesrc2>
> > error: Internal data stream error.
> > 0:01:21.808266866  1090  0x1f1ba90 WARN                 basesrc
> > gstreamer-1.18.2/libs/gst/base/gstbasesrc.c:3127:gst_base_src_loop:<nicesrc2>
> > error: streaming stopped, reason error (-5)
> > 0:01:21.809681158  1090  0x1f1ba90 WARN                   queue
> > gstreamer-1.18.2/plugins/elements/gstqueue.c:990:gst_queue_handle_sink_event:<queue8>
> > error: Internal data stream error.
> > 0:01:21.809811158  1090  0x1f1ba90 WARN                   queue
> > gstreamer-1.18.2/plugins/elements/gstqueue.c:990:gst_queue_handle_sink_event:<queue8>
> > error: streaming stopped, reason error (-5)
> 
> > _______________________________________________
> > gstreamer-devel mailing list
> > gstreamer-devel at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> 
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> <log_v536.txt>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>  
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>  
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>  
>  
>  
> 
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20201231/5862553c/attachment-0001.htm>


More information about the gstreamer-devel mailing list