[farsight2/master] Have substream emit a unlinked signal

Olivier Crête olivier.crete at collabora.co.uk
Wed May 13 12:27:03 PDT 2009


---
 gst/fsrtpconference/fs-rtp-substream.c |   37 ++++++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/gst/fsrtpconference/fs-rtp-substream.c b/gst/fsrtpconference/fs-rtp-substream.c
index 14e9614..ae0289d 100644
--- a/gst/fsrtpconference/fs-rtp-substream.c
+++ b/gst/fsrtpconference/fs-rtp-substream.c
@@ -53,6 +53,7 @@ enum
   CODEC_CHANGED,
   ERROR_SIGNAL,
   BLOCKED,
+  UNLINKED,
   LAST_SIGNAL
 };
 
@@ -84,6 +85,8 @@ struct _FsRtpSubStreamPrivate {
 
   GstPad *rtpbin_pad;
 
+  gulong rtpbin_unlinked_sig;
+
   GstElement *input_valve;
   GstElement *output_valve;
 
@@ -364,6 +367,23 @@ fs_rtp_sub_stream_class_init (FsRtpSubStreamClass *klass)
       g_cclosure_marshal_VOID__POINTER,
       G_TYPE_NONE, 1, G_TYPE_POINTER);
 
+
+ /**
+   * FsRtpSubStream:unlinked
+   * @self: #FsRtpSubStream that emitted the signal
+   *
+   * This signal is emitted when the rtpbin pad that this substream decodes
+   * from is unlinked.
+   */
+  signals[UNLINKED] = g_signal_new ("unlinked",
+      G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_LAST,
+      0,
+      NULL,
+      NULL,
+      g_cclosure_marshal_VOID__VOID,
+      G_TYPE_NONE, 0, G_TYPE_NONE);
+
   g_type_class_add_private (klass, sizeof (FsRtpSubStreamPrivate));
 }
 
@@ -490,6 +510,14 @@ fs_rtp_sub_stream_stop_no_rtcp_timeout_thread (FsRtpSubStream *self)
 }
 
 static void
+rtpbin_pad_unlinked (GstPad *pad, GstPad *peer, gpointer user_data)
+{
+  FsRtpSubStream *self = user_data;
+
+  g_signal_emit (self, signals[UNLINKED], 0);
+}
+
+static void
 fs_rtp_sub_stream_constructed (GObject *object)
 {
   FsRtpSubStream *self = FS_RTP_SUB_STREAM (object);
@@ -506,6 +534,9 @@ fs_rtp_sub_stream_constructed (GObject *object)
     return;
   }
 
+  self->priv->rtpbin_unlinked_sig = g_signal_connect (self->priv->rtpbin_pad,
+      "unlinked", G_CALLBACK (rtpbin_pad_unlinked), self);
+
   tmp = g_strdup_printf ("output_recv_valve_%d_%d_%d", self->priv->session->id,
       self->ssrc, self->pt);
   self->priv->output_valve = gst_element_factory_make ("valve", tmp);
@@ -1052,6 +1083,12 @@ fs_rtp_sub_stream_try_stop (FsRtpSubStream *substream)
   }
   FS_RTP_SESSION_UNLOCK (substream->priv->session);
 
+  if (substream->priv->rtpbin_unlinked_sig) {
+    g_signal_handler_disconnect (substream->priv->rtpbin_pad,
+        substream->priv->rtpbin_unlinked_sig);
+    substream->priv->rtpbin_unlinked_sig = 0;
+  }
+
   if (substream->priv->output_ghostpad)
     gst_pad_set_active (substream->priv->output_ghostpad, FALSE);
 
-- 
1.5.6.5




More information about the farsight-commits mailing list