[Telepathy-commits] [telepathy-stream-engine/master] Don't test the video src, assume its always there

Olivier Crête olivier.crete at collabora.co.uk
Wed Mar 25 12:52:09 PDT 2009


---
 src/tp-stream-engine.c |   65 ++---------------------------------------------
 1 files changed, 3 insertions(+), 62 deletions(-)

diff --git a/src/tp-stream-engine.c b/src/tp-stream-engine.c
index 255db20..b1bf690 100644
--- a/src/tp-stream-engine.c
+++ b/src/tp-stream-engine.c
@@ -139,8 +139,6 @@ struct _TpStreamEnginePrivate
 
   gint video_source_use_count;
 
-  gboolean force_fakesrc;
-
   /* Everything below this is protected by the mutex */
   GList *output_sinks;
   GList *preview_sinks;
@@ -413,12 +411,6 @@ tp_stream_engine_start_video_source (TpStreamEngine *self)
   GstStateChangeReturn state_ret;
 
 
-  if (self->priv->force_fakesrc)
-    {
-      g_debug ("Don't have a video source, not starting it");
-      return FALSE;
-    }
-
   g_debug ("Starting video source");
 
   self->priv->video_source_use_count++;
@@ -888,12 +880,8 @@ _build_base_video_elements (TpStreamEngine *self)
   GstCaps *filter = NULL;
   GstStateChangeReturn state_ret;
 
- try_again:
-
   if ((elem = getenv ("FS_VIDEO_SRC")) || (elem = getenv ("FS_VIDEOSRC")))
     {
-      if (priv->force_fakesrc)
-        g_error ("Invalid video source passed in FS_VIDEOSRC");
       g_debug ("making video src with pipeline \"%s\"", elem);
       videosrc = gst_parse_bin_from_description (elem, TRUE, NULL);
       g_assert (videosrc);
@@ -901,12 +889,6 @@ _build_base_video_elements (TpStreamEngine *self)
     }
   else
     {
-      if (priv->force_fakesrc)
-        {
-          videosrc = gst_element_factory_make ("fakesrc", NULL);
-          g_object_set (videosrc, "is-live", TRUE, NULL);
-        }
-
       if (videosrc == NULL)
         videosrc = gst_element_factory_make ("gconfvideosrc", NULL);
 
@@ -953,42 +935,11 @@ _build_base_video_elements (TpStreamEngine *self)
           NULL);
     }
 
-  fakesink = gst_element_factory_make ("fakesink", NULL);
-
-  gst_bin_add_many (GST_BIN (priv->pipeline), videosrc, fakesink, NULL);
-
-  if (!gst_element_link (videosrc, fakesink))
-    g_error ("Could not link fakesink to videosrc");
-
-  state_ret = gst_element_set_state (priv->pipeline, GST_STATE_PLAYING);
-  if (state_ret == GST_STATE_CHANGE_FAILURE)
-    {
-      if (priv->force_fakesrc)
-        {
-          g_error ("Could not even start fakesrc");
-        }
-      else
-        {
-          g_debug ("Video source failed, falling back to fakesrc");
-          state_ret = gst_element_set_state (priv->pipeline, GST_STATE_NULL);
-          g_assert (state_ret == GST_STATE_CHANGE_SUCCESS);
-          if (!gst_bin_remove (GST_BIN (priv->pipeline), fakesink))
-            g_error ("Could not remove fakesink");
-
-          priv->force_fakesrc = TRUE;
-          gst_bin_remove (GST_BIN (priv->pipeline), videosrc);
-          goto try_again;
-        }
-    }
-  else
-    {
-      state_ret = gst_element_set_state (priv->pipeline, GST_STATE_NULL);
-      g_assert (state_ret == GST_STATE_CHANGE_SUCCESS);
-      gst_bin_remove (GST_BIN (priv->pipeline), fakesink);
-    }
-
   gst_element_set_locked_state (videosrc, TRUE);
 
+  if (!gst_bin_add (GST_BIN (priv->pipeline), videosrc))
+    g_error ("Could not add videosrc to pipeline");
+
   tee = gst_element_factory_make ("tee", "videotee");
   g_assert (tee);
   if (!gst_bin_add (GST_BIN (priv->pipeline), tee))
@@ -1128,16 +1079,6 @@ tp_stream_engine_create_preview_window (StreamEngineSvcStreamEngine *iface,
   TpStreamEngineVideoPreview *preview;
   guint window_id;
 
-  if (self->priv->force_fakesrc)
-    {
-      GError error = {TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
-                      "Could not get a video source"};
-      g_debug ("%s", error.message);
-
-      dbus_g_method_return_error (context, &error);
-      return;
-    }
-
   preview = tp_stream_engine_video_preview_new (GST_BIN (self->priv->pipeline),
       &error);
 
-- 
1.5.6.5




More information about the telepathy-commits mailing list