rtspsrc request-key callback for srtpdec is not setting attributes
Target: rtspsrc from an ip camera via RTSP/SRTP where the suite, key and salt is provided via request-key callback is not working. It seems internal srtp_dec is not set with the provided data.
Looking the code:
In this part suite and key is provided via callback to the upper app. if no callback caps by default is provided.
static GstRTSPResult gst_rtspsrc_setup_streams_start (GstRTSPSrc * src, gboolean async) { . /* set up keys */ if (stream->profile == GST_RTSP_PROFILE_SAVP || stream->profile == GST_RTSP_PROFILE_SAVPF) { hval = gst_rtspsrc_stream_make_keymgmt (src, stream); gst_rtsp_message_take_header (&request, GST_RTSP_HDR_KEYMGMT, hval); } }
static gchar * gst_rtspsrc_stream_make_keymgmt (GstRTSPSrc * src, GstRTSPStream * stream) { gchar *base64, *result = NULL; GstMIKEYMessage *mikey_msg;
stream->srtcpparams = signal_get_srtcp_params (src, stream); if (stream->srtcpparams == NULL) stream->srtcpparams = default_srtcp_params (); }
This part above is ok.
But request_rtp_decoder do not set attributes for decrypt.
static GstElement * request_rtp_decoder (GstElement * rtpbin, guint session, GstRTSPStream * stream) { GST_DEBUG ("decoder session %u, stream %p, %d", session, stream, stream->id); if (stream->id != session) return NULL;
if (stream->profile != GST_RTSP_PROFILE_SAVP && stream->profile != GST_RTSP_PROFILE_SAVPF) return NULL;
if (stream->srtpdec == NULL) { gchar *name;
name = g_strdup_printf ("srtpdec_%u", session);
stream->srtpdec = gst_element_factory_make ("srtpdec", name);
g_free (name);
if (stream->srtpdec == NULL) {
GST_ELEMENT_ERROR (stream->parent, CORE, MISSING_PLUGIN, (NULL),
("no srtpdec element present!"));
return NULL;
}
g_signal_connect (stream->srtpdec, "request-key",
(GCallback) request_key, stream);
} return gst_object_ref (stream->srtpdec); }
static GstCaps * request_key (GstElement * srtpdec, guint ssrc, GstRTSPStream * stream) { guint i; GstCaps *caps; GstMIKEYMessage *msg = stream->mikey;
GST_DEBUG ("request key SSRC %u", ssrc);
caps = gst_caps_ref (stream_get_caps_for_pt (stream, stream->default_pt)); caps = gst_caps_make_writable (caps);
/* parse crypto sessions and look for the SSRC rollover counter */ msg = stream->mikey; for (i = 0; msg && i < gst_mikey_message_get_n_cs (msg); i++) { const GstMIKEYMapSRTP *map = gst_mikey_message_get_cs_srtp (msg, i);
if (ssrc == map->ssrc) {
gst_caps_set_simple (caps, "roc", G_TYPE_UINT, map->roc, NULL);
break;
}
}
return caps; }
But if you look request_rtp_encoder you can see the funcion uses stream->srtcpparams to set srtp_enc.
So, why request_rtp_decoder can not use suite and key provided by stream->srtcpparams via request-key to application?
Or rtspsrc only can work via mikey attribute in DESCRIBE?. I would like to provide the suite and key via request-key because they are obtained via https call.
Best regards,