From c4bca15b08a34874fefc06529df98b4609abbf3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Cr=C3=AAte?= Date: Fri, 24 Jul 2015 19:52:11 -0400 Subject: rtpstream: Accept all uncrypted packets if no crypto set --- gst/fsrtpconference/fs-rtp-session.c | 26 ++++++++++++++++++++++++++ gst/fsrtpconference/fs-rtp-stream.c | 8 +++++++- gst/fsrtpconference/fs-rtp-stream.h | 3 +++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/gst/fsrtpconference/fs-rtp-session.c b/gst/fsrtpconference/fs-rtp-session.c index b040a5cb..ee0225f2 100644 --- a/gst/fsrtpconference/fs-rtp-session.c +++ b/gst/fsrtpconference/fs-rtp-session.c @@ -5518,6 +5518,32 @@ _srtpdec_request_key (GstElement *srtpdec, guint ssrc, gpointer user_data) caps = fs_rtp_stream_get_srtp_caps_locked (stream); g_object_unref (stream); } + else + { + GList *item; + gboolean no_crypto = TRUE; + for (item = self->priv->streams; item; item = item->next) + if (fs_rtp_stream_requires_crypto_locked (item->data)) + { + no_crypto = FALSE; + break; + } + if (no_crypto) + { + GST_DEBUG ("No stream found for SSRC %x, none of the streams require" + " crypto, so letting through", ssrc); + caps = gst_caps_new_simple ("application/x-srtp", + "srtp-cipher", G_TYPE_STRING, "null", + "srtcp-cipher", G_TYPE_STRING, "null", + "srtp-auth", G_TYPE_STRING, "null", + "srtcp-auth", G_TYPE_STRING, "null", + NULL); + } + else + { + GST_DEBUG ("Some streams require crypto, dropping packets"); + } + } FS_RTP_SESSION_UNLOCK (self); diff --git a/gst/fsrtpconference/fs-rtp-stream.c b/gst/fsrtpconference/fs-rtp-stream.c index 294a0c8f..b2d59f2c 100644 --- a/gst/fsrtpconference/fs-rtp-stream.c +++ b/gst/fsrtpconference/fs-rtp-stream.c @@ -482,7 +482,7 @@ fs_rtp_stream_get_property (GObject *object, break; case PROP_REQUIRE_ENCRYPTION: FS_RTP_SESSION_LOCK (session); - g_value_set_boolean (value, self->priv->encrypted); + g_value_set_boolean (value, fs_rtp_stream_requires_crypto_locked (self)); FS_RTP_SESSION_UNLOCK (session); break; default: @@ -1580,3 +1580,9 @@ fs_rtp_stream_get_srtp_caps_locked (FsRtpStream *self) "srtcp-auth", G_TYPE_STRING, srtcp_auth, NULL); } + +gboolean +fs_rtp_stream_requires_crypto_locked (FsRtpStream *self) +{ + return self->priv->encrypted; +} diff --git a/gst/fsrtpconference/fs-rtp-stream.h b/gst/fsrtpconference/fs-rtp-stream.h index a2e7d18f..a4b3fb23 100644 --- a/gst/fsrtpconference/fs-rtp-stream.h +++ b/gst/fsrtpconference/fs-rtp-stream.h @@ -131,6 +131,9 @@ validate_srtp_parameters (GstStructure *parameters, GstCaps * fs_rtp_stream_get_srtp_caps_locked (FsRtpStream *self); +gboolean +fs_rtp_stream_requires_crypto_locked (FsRtpStream *self); + G_END_DECLS #endif /* __FS_RTP_STREAM_H__ */ -- cgit v1.2.1