]> git.0d.be Git - empathy.git/commitdiff
Keep a persistent source video tee around
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>
Tue, 3 May 2011 19:03:34 +0000 (20:03 +0100)
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Thu, 9 Jun 2011 09:20:08 +0000 (10:20 +0100)
Always keep the video input tee around, so we can easily hook up new
video contents even if the camera isn't currently enabled. This fixes
issues where a new content is added without the local camera being
enabled.

src/empathy-call-window.c

index af47e2a2dd21da7ef8e506f98a4b36f88e67c06c..0da1df6e6e4f6ac9b2bc17c20df47c80300f4877 100644 (file)
@@ -668,12 +668,6 @@ add_video_preview_to_pipeline (EmpathyCallWindow *self)
       return;
     }
 
-  if (!gst_bin_add (GST_BIN (priv->pipeline), priv->video_tee))
-    {
-      g_warning ("Could not add video tee to pipeline");
-      return;
-    }
-
   if (!gst_bin_add (GST_BIN (priv->pipeline), preview))
     {
       g_warning ("Could not add video preview to pipeline");
@@ -700,7 +694,6 @@ create_video_preview (EmpathyCallWindow *self)
   GstBus *bus;
 
   g_assert (priv->video_preview == NULL);
-  g_assert (priv->video_tee == NULL);
 
   bus = gst_pipeline_get_bus (GST_PIPELINE (priv->pipeline));
 
@@ -711,10 +704,6 @@ create_video_preview (EmpathyCallWindow *self)
   gtk_box_pack_start (GTK_BOX (priv->self_user_output_hbox),
       priv->video_preview, TRUE, TRUE, 0);
 
-  priv->video_tee = gst_element_factory_make ("tee", NULL);
-  gst_object_ref (priv->video_tee);
-  gst_object_sink (priv->video_tee);
-
   g_object_unref (bus);
 }
 
@@ -991,6 +980,12 @@ create_pipeline (EmpathyCallWindow *self)
   priv->pipeline = gst_pipeline_new (NULL);
   priv->pipeline_playing = FALSE;
 
+  priv->video_tee = gst_element_factory_make ("tee", NULL);
+  gst_object_ref (priv->video_tee);
+  gst_object_sink (priv->video_tee);
+
+  gst_bin_add (GST_BIN (priv->pipeline), priv->video_tee);
+
   bus = gst_pipeline_get_bus (GST_PIPELINE (priv->pipeline));
   priv->bus_message_source_id = gst_bus_add_watch (bus,
       empathy_call_window_bus_message, self);
@@ -2487,21 +2482,18 @@ empathy_call_window_sink_added_cb (EmpathyCallHandler *handler,
         retval = TRUE;
         break;
       case FS_MEDIA_TYPE_VIDEO:
-        if (priv->video_input != NULL)
+        if (priv->video_tee != NULL)
           {
-            if (priv->video_tee != NULL)
+            pad = gst_element_get_request_pad (priv->video_tee, "src%d");
+            if (GST_PAD_LINK_FAILED (gst_pad_link (pad, sink)))
               {
-                pad = gst_element_get_request_pad (priv->video_tee, "src%d");
-                if (GST_PAD_LINK_FAILED (gst_pad_link (pad, sink)))
-                  {
-                    g_warning ("Could not link video source input pipeline");
-                    break;
-                  }
-                gst_object_unref (pad);
+                g_warning ("Could not link video source input pipeline");
+                break;
               }
-
-            retval = TRUE;
+            gst_object_unref (pad);
           }
+
+        retval = TRUE;
         break;
       default:
         g_assert_not_reached ();
@@ -2527,7 +2519,7 @@ empathy_call_window_remove_video_input (EmpathyCallWindow *self)
   gst_element_set_state (preview, GST_STATE_NULL);
 
   gst_bin_remove_many (GST_BIN (priv->pipeline), priv->video_input,
-    priv->video_tee, preview, NULL);
+    preview, NULL);
 
   g_object_unref (priv->video_input);
   priv->video_input = NULL;