DTLS-SRTP handshake sometimes does not complete

daniel at poradnik-webmastera.com daniel at poradnik-webmastera.com
Wed Apr 4 15:13:57 UTC 2018


Hi,
I am still trying to communicate GStreamer with FreeSwitch via WebRTC. 
It turned out that DTLS-SRTP handshake may not be completed properly, 
resulting in one-way audio (from GStreamer to FreeSwitch only). When my 
test app is run without debug logs, it reproduces in about 3 times per 4 
attempts. With debug logs enabled on everything except GST_PADS, and 
piped via tee to file and stdout handshake was always completed, so it 
looks like some race condition for me.

Here are packets exchanged between GST and FS:

Good scenario:
FS->GST: Binding Request
GST->FS: Binding Success
GST->FS: Binding Request
FS->GST: Binding Success
FS->GST: DTLS Handshake
GST->FS: Binding Indication
GST->FS: DTLS Handshake
GST->FS: DTLS Handshake
GST->FS: DTLS Handshake
GST->FS: DTLS Handshake
GST->FS: DTLS Handshake
GST->FS: DTLS Handshake
FS->GST: DTLS Handshake
FS->GST: DTLS Handshake
GST->FS: DTLS Handshake
GST->FS: DTLS Handshake
GST->FS: DTLS Handshake
GST->FS: DTLS Handshake
GST->FS: DTLS Handshake
GST->FS: DTLS Handshake
GST->FS: DTLS Change Cipher Spec
GST->FS: SRTP/SRTCP
FS->GST: SRTP/SRTCP
... more 2-way media here


Bad scenario:
FS->GST: Binding Request
GST->FS: Binding Success
GST->FS: Binding Request
FS->GST: Binding Success
FS->GST: DTLS Handshake
GST->FS: Binding Indication
GST->FS: DTLS Handshake
GST->FS: DTLS Handshake
GST->FS: DTLS Handshake
GST->FS: DTLS Handshake
GST->FS: DTLS Handshake
GST->FS: DTLS Handshake
FS->GST: DTLS Handshake
FS->GST: DTLS Handshake
GST->FS: SRTP/SRTCP
... more media from GST here

In bad scenario GST did not sent 6 DTLS Handshake packets and DTLS 
Change Cipher Spec; instead it started sending media.

I have uploaded logs from both scenarios there.
https://pastebin.com/TF3gnK6A
https://pastebin.com/EqkN4naP

Is there any workaround for this?

Regards,
Daniel


More information about the gstreamer-devel mailing list