Failing to get SRTP to work

Ben Rush ben at ben-rush.net
Wed Sep 25 20:30:03 UTC 2019


I seemed to solve it myself, I had to add the ssrc key/value pair. Here are
the commands that do work for me now:

Server: gst-launch-1.0 videotestsrc ! videoconvert ! openh264enc !
rtph264pay ! application/x-rtp, payload=(int)96, ssrc=(uint)1356955624 !
srtpenc key=987654321001234567890123456789012345678901234567890123456789
rtp-cipher=aes-128-icm rtp-auth=hmac-sha1-80 rtcp-cipher=aes-128-icm
rtcp-auth=hmac-sha1-80 ! udpsink host=127.0.0.1 port=5000

Client: gst-launch-1.0 udpsrc port=5000 caps="application/x-srtp,
encoding-name=H264, payload=(int)96, ssrc=(uint)1356955624,
srtp-key=(buffer)987654321001234567890123456789012345678901234567890123456789,
srtp-cipher=(string)aes-128-icm, srtp-auth=(string)hmac-sha1-80,
srtcp-cipher=(string)aes-128-icm, srtcp-auth=(string)hmac-sha1-80,
roc=(uint)0" ! srtpdec ! rtph264depay ! h264parse ! openh264dec !
videoconvert ! autovideosink

I'm not sure why setting the synchronization source ID needs to be explicit
and not something negotiated (probably me not understanding some internal
very well), but that did it for me.

Sorry for the spamming.

On Wed, Sep 25, 2019 at 3:00 PM Ben Rush <ben at ben-rush.net> wrote:

> I've looked at the following:
>
>
> https://lists.freedesktop.org/archives/gstreamer-bugs/2017-August/204646.html
>
>
> https://stackoverflow.com/questions/7669240/webcam-streaming-using-gstreamer-over-udp
>
>
> https://stackoverflow.com/questions/44458012/gstreamer-srtp-for-full-hd-h-264-video
>
> http://gstreamer-devel.966125.n4.nabble.com/SRTP-audio-encryption-problems-td4686501.html
>
> ...but for whatever reason, I still cannot get SRTP to work at the command
> line (Windows).  What I mean by that is running both a "server" and a
> "client" and having them communicate with each other over SRTP. The most
> insightful comment was:
>
>  "You have to connect to the "request-key" signal and return appropriate
> caps there, or make sure to set complete caps on the stream via udpsrc.
> Your caps are missing the "roc" field at least."
>
> ...in the last link above. But, I'm doing what's suggested there (I
> believe, anyway). Here are my commands:
>
>  Server == gst-launch-1.0 videotestsrc ! videoconvert ! openh264enc !
> rtph264pay ! application/x-rtp, payload=(int)96 ! srtpenc
> key=987654321001234567890123456789012345678901234567890123456789
> rtp-cipher=aes-128-icm rtp-auth=hmac-sha1-80 rtcp-cipher=aes-128-icm
> rtcp-auth=hmac-sha1-80 ! udpsink host=127.0.0.1 port=5000
>
> Client == gst-launch-1.0 udpsrc port=5000 caps="application/x-srtp,
> payload=(int)96,
> srtp-key=(buffer)987654321001234567890123456789012345678901234567890123456789,
> srtp-cipher=(string)aes-128-icm, srtp-auth=(string)hmac-sha1-80,
> srtcp-cipher=(string)aes-128-icm, srtcp-auth=(string)hmac-sha1-80,
> roc=(uint)0" ! srtpdec ! rtph264depay ! h264parse ! openh264dec !
> videoconvert ! autovideosink
>
> To test, I fire up the "server" first and it spins up and waits. That part
> appears to be correct. However, when running the "client", I get a spew of:
>
> 0:00:02.197235000 23116 000001FF981D7040 WARN                 srtpdec
> gstsrtpdec.c:992:request_key_with_signal:<srtpdec0> Could not get caps for
> stream with SSRC 1451949075
>
> Ok. So, to do some digging. The code is here:
> https://github.com/agx/gst-plugins-bad/blob/master/ext/srtp/gstsrtpdec.c.
> The comment here:
> https://github.com/agx/gst-plugins-bad/blob/74bcc835aa7d74e83e69eafe83869c1be72195a5/ext/srtp/gstsrtpdec.c#L286
> seems to indicate maybe the plugin is unable to determine the keys and
> cipher information it needs. This seems to jive with the comment I
> mentioned earlier (that I need to then put them as caps on the udpsrc,
> therefore) ... but I'm doing that. Do you spot anything wrong with my caps?
> I assume the mechanism is srtpdec is signaling to the pipeline to give to
> it the parameters it needs, but it's not getting a response or getting
> something invalid.
>
> Thanks in advance.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20190925/f9403efe/attachment.html>


More information about the gstreamer-devel mailing list