[farsight2/master] Add known buffer handler to the nice transmitter

Olivier Crête olivier.crete at collabora.co.uk
Tue Dec 23 15:26:30 PST 2008


---
 transmitters/nice/fs-nice-stream-transmitter.c |   26 +++++++++++++++++++++++-
 transmitters/nice/fs-nice-transmitter.c        |    8 +++++++
 2 files changed, 33 insertions(+), 1 deletions(-)

diff --git a/transmitters/nice/fs-nice-stream-transmitter.c b/transmitters/nice/fs-nice-stream-transmitter.c
index 112c39c..748a097 100644
--- a/transmitters/nice/fs-nice-stream-transmitter.c
+++ b/transmitters/nice/fs-nice-stream-transmitter.c
@@ -162,6 +162,10 @@ static void agent_new_candidate (NiceAgent *agent,
     const gchar *foundation,
     gpointer user_data);
 
+static gboolean known_buffer_have_buffer_handler (GstPad *pad,
+    GstBuffer *buffer,
+    gpointer user_data);
+
 
 static GObjectClass *parent_class = NULL;
 // static guint signals[LAST_SIGNAL] = { 0 };
@@ -988,7 +992,7 @@ fs_nice_stream_transmitter_build (FsNiceStreamTransmitter *self,
       self->priv->transmitter,
       self->priv->agent->agent,
       self->priv->stream_id,
-      NULL, NULL,
+      G_CALLBACK (known_buffer_have_buffer_handler), self,
       error);
   if (self->priv->gststream == NULL)
     return FALSE;
@@ -1242,3 +1246,23 @@ fs_nice_stream_transmitter_newv (FsNiceTransmitter *transmitter,
 
   return streamtransmitter;
 }
+
+
+static gboolean
+known_buffer_have_buffer_handler (GstPad *pad, GstBuffer *buffer,
+    gpointer user_data)
+{
+  FsNiceStreamTransmitter *self = FS_NICE_STREAM_TRANSMITTER (user_data);
+  guint component_id;
+
+  if (!g_atomic_int_get (&self->priv->associate_on_source))
+    return TRUE;
+
+  component_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (pad),
+          "component-id"));
+
+  g_signal_emit_by_name (self, "known-source-packet-received", component_id,
+      buffer);
+
+  return TRUE;
+}
diff --git a/transmitters/nice/fs-nice-transmitter.c b/transmitters/nice/fs-nice-transmitter.c
index 7da2cfa..b7a9082 100644
--- a/transmitters/nice/fs-nice-transmitter.c
+++ b/transmitters/nice/fs-nice-transmitter.c
@@ -544,13 +544,21 @@ _create_sinksource (
   if (have_buffer_callback && buffer_probe_id)
   {
     if (direction == GST_PAD_SINK)
+    {
+      g_object_set_data (G_OBJECT (*requested_pad), "component-id",
+          GUINT_TO_POINTER (component_id));
       *buffer_probe_id = gst_pad_add_buffer_probe (*requested_pad,
           have_buffer_callback,
           have_buffer_user_data);
+    }
     else
+    {
+      g_object_set_data (G_OBJECT (elempad), "component-id",
+          GUINT_TO_POINTER (component_id));
       *buffer_probe_id = gst_pad_add_buffer_probe (elempad,
           have_buffer_callback,
           have_buffer_user_data);
+    }
 
     if (*buffer_probe_id == 0)
     {
-- 
1.5.6.5




More information about the farsight-commits mailing list