rtspclientsink: Handle the KeyMgmt header in ANNOUNCE response
authorMathieu Duponchelle <mathieu@centricular.com>
Thu, 29 Mar 2018 14:15:45 +0000 (16:15 +0200)
committerMathieu Duponchelle <mathieu@centricular.com>
Fri, 30 Mar 2018 15:55:32 +0000 (17:55 +0200)
This in order to be able to decrypt the RTCP backchannel

https://bugzilla.gnome.org/show_bug.cgi?id=794813

gst/rtsp-sink/gstrtspclientsink.c

index 29ac59f..e622112 100644 (file)
@@ -4232,6 +4232,8 @@ gst_rtsp_client_sink_record (GstRTSPClientSink * sink, gboolean async)
   GstSDPMessage *sdp;
   guint sdp_index = 0;
   GstSDPInfo info = { 0, };
+  gchar *keymgmt;
+  guint i;
 
   const gchar *proto;
   gchar *sess_id, *client_ip, *str;
@@ -4338,6 +4340,17 @@ gst_rtsp_client_sink_record (GstRTSPClientSink * sink, gboolean async)
               &response, NULL)) < 0)
     goto send_error;
 
+  /* parse the keymgmt */
+  i = 0;
+  walk = sink->contexts;
+  while (gst_rtsp_message_get_header (&response, GST_RTSP_HDR_KEYMGMT,
+          &keymgmt, i++) == GST_RTSP_OK) {
+    GstRTSPStreamContext *context = (GstRTSPStreamContext *) walk->data;
+    walk = g_list_next (walk);
+    if (!gst_rtsp_stream_handle_keymgmt (context->stream, keymgmt))
+      goto keymgmt_error;
+  }
+
   /* send setup for all streams */
   if ((res = gst_rtsp_client_sink_setup_streams (sink, async)) < 0)
     goto setup_failed;
@@ -4414,6 +4427,11 @@ send_error:
      * taken care of it because we passed NULL for the response code */
     goto cleanup_error;
   }
+keymgmt_error:
+  {
+    GST_ELEMENT_ERROR (sink, STREAM, DECRYPT_NOKEY, (NULL),
+        ("Could not handle KeyMgmt"));
+  }
 setup_failed:
   {
     GST_ERROR_OBJECT (sink, "setup failed");