stream: block the output of rtpbin instead of the source pipeline
authorMatthew Waters <matthew@centricular.com>
Mon, 21 Nov 2016 12:29:56 +0000 (23:29 +1100)
committerMatthew Waters <matthew@centricular.com>
Wed, 23 Nov 2016 12:08:16 +0000 (23:08 +1100)
85c52e194bcb81928b96614be0ae47d59eccb1ce introduced a more correct
detection of the srtp rollover counter to add to the SDP.

Unfortunately, it was incomplete for live pipelines where the logic
blocks the source bin before creating the SDP and thus would never have
the necessary informaiton to create a correct SDP with srtp encryption.

Move the pad blocks to rtpbin's output pads instead so that the
necessary information can be created before we need the information for
the SDP.

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

gst/rtsp-server/rtsp-stream.c

index f5b5cf2..d10b139 100644 (file)
@@ -149,7 +149,7 @@ struct _GstRTSPStreamPrivate
   gint dscp_qos;
 
   /* stream blocking */
-  gulong blocked_id;
+  gulong blocked_id[2];
   gboolean blocking;
 
   /* pt->caps map for RECORD streams */
@@ -3689,6 +3689,7 @@ gboolean
 gst_rtsp_stream_set_blocked (GstRTSPStream * stream, gboolean blocked)
 {
   GstRTSPStreamPrivate *priv;
+  int i;
 
   g_return_val_if_fail (GST_IS_RTSP_STREAM (stream), FALSE);
 
@@ -3697,18 +3698,22 @@ gst_rtsp_stream_set_blocked (GstRTSPStream * stream, gboolean blocked)
   g_mutex_lock (&priv->lock);
   if (blocked) {
     priv->blocking = FALSE;
-    if (priv->blocked_id == 0) {
-      priv->blocked_id = gst_pad_add_probe (priv->srcpad,
-          GST_PAD_PROBE_TYPE_BLOCK | GST_PAD_PROBE_TYPE_BUFFER |
-          GST_PAD_PROBE_TYPE_BUFFER_LIST, pad_blocking,
-          g_object_ref (stream), g_object_unref);
+    for (i = 0; i < 2; i++) {
+      if (priv->blocked_id[i] == 0) {
+        priv->blocked_id[i] = gst_pad_add_probe (priv->send_src[i],
+            GST_PAD_PROBE_TYPE_BLOCK | GST_PAD_PROBE_TYPE_BUFFER |
+            GST_PAD_PROBE_TYPE_BUFFER_LIST, pad_blocking,
+            g_object_ref (stream), g_object_unref);
+      }
     }
   } else {
-    if (priv->blocked_id != 0) {
-      gst_pad_remove_probe (priv->srcpad, priv->blocked_id);
-      priv->blocked_id = 0;
-      priv->blocking = FALSE;
+    for (i = 0; i < 2; i++) {
+      if (priv->blocked_id[i] != 0) {
+        gst_pad_remove_probe (priv->send_src[i], priv->blocked_id[i]);
+        priv->blocked_id[i] = 0;
+      }
     }
+    priv->blocking = FALSE;
   }
   g_mutex_unlock (&priv->lock);