[farsight2/master] Ensure sources are used in the right order

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


---
 gst/fsrtpconference/fs-rtp-dtmf-event-source.c |    4 ++++
 gst/fsrtpconference/fs-rtp-special-source.c    |   15 +++++++++++++--
 gst/fsrtpconference/fs-rtp-special-source.h    |    6 ++++++
 3 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/gst/fsrtpconference/fs-rtp-dtmf-event-source.c b/gst/fsrtpconference/fs-rtp-dtmf-event-source.c
index f910c8f..cd27630 100644
--- a/gst/fsrtpconference/fs-rtp-dtmf-event-source.c
+++ b/gst/fsrtpconference/fs-rtp-dtmf-event-source.c
@@ -91,7 +91,11 @@ fs_rtp_dtmf_event_source_class_init (FsRtpDtmfEventSourceClass *klass)
 static void
 fs_rtp_dtmf_event_source_init (FsRtpDtmfEventSource *self)
 {
+  FsRtpSpecialSource *source = FS_RTP_SPECIAL_SOURCE (self);
+
   self->priv = FS_RTP_DTMF_EVENT_SOURCE_GET_PRIVATE (self);
+
+  source->order = 1;
 }
 
 /**
diff --git a/gst/fsrtpconference/fs-rtp-special-source.c b/gst/fsrtpconference/fs-rtp-special-source.c
index 292479c..630d586 100644
--- a/gst/fsrtpconference/fs-rtp-special-source.c
+++ b/gst/fsrtpconference/fs-rtp-special-source.c
@@ -350,6 +350,15 @@ fs_rtp_special_sources_add_blueprints (GList *blueprints)
   return blueprints;
 }
 
+static gboolean
+_source_order_compare_func (gconstpointer item1,gconstpointer item2)
+{
+  FsRtpSpecialSource *src1 = FS_RTP_SPECIAL_SOURCE_CAST (item1);
+  FsRtpSpecialSource *src2 = FS_RTP_SPECIAL_SOURCE_CAST (item2);
+
+  return src1->order - src2->order;
+}
+
 /**
  * fs_rtp_special_sources_update:
  * @current_extra_sources: The #GList returned by previous calls to this function
@@ -409,7 +418,8 @@ fs_rtp_special_sources_update (
           if (!obj)
             goto error;
 
-          current_extra_sources = g_list_append (current_extra_sources, obj);
+          current_extra_sources = g_list_insert_sorted (current_extra_sources,
+              obj, _source_order_compare_func);
         }
       }
       else
@@ -427,7 +437,8 @@ fs_rtp_special_sources_update (
             bin, rtpmuxer, error);
         if (!obj)
           goto error;
-        current_extra_sources = g_list_append (current_extra_sources, obj);
+        current_extra_sources = g_list_insert_sorted (current_extra_sources,
+            obj, _source_order_compare_func);
       }
     }
   }
diff --git a/gst/fsrtpconference/fs-rtp-special-source.h b/gst/fsrtpconference/fs-rtp-special-source.h
index 62b10ba..8b54ce9 100644
--- a/gst/fsrtpconference/fs-rtp-special-source.h
+++ b/gst/fsrtpconference/fs-rtp-special-source.h
@@ -85,6 +85,12 @@ struct _FsRtpSpecialSourceClass
 struct _FsRtpSpecialSource
 {
   GObject parent;
+
+  /* This is set by subclasses init or build methods and is used to know
+   * in which order to try events on.
+   */
+  guint order;
+
   FsRtpSpecialSourcePrivate *priv;
 };
 
-- 
1.5.6.5




More information about the farsight-commits mailing list