]> git.0d.be Git - empathy.git/commitdiff
Add fakesink to srcpad if not real sink could be linked
authorOlivier CrĂȘte <olivier.crete@collabora.co.uk>
Sat, 6 Mar 2010 23:11:13 +0000 (18:11 -0500)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Mon, 29 Mar 2010 15:36:24 +0000 (17:36 +0200)
src/empathy-call-window.c

index 2c2fa62640d2e2d25b5e089e3660c509c64465e9..0c9c9e3c4a6b069cae555750c20425f0d7f34c0d 100644 (file)
@@ -2039,6 +2039,36 @@ empathy_call_window_src_added_cb (EmpathyCallHandler *handler,
 
  out:
 
+  /* If no sink could be linked, try to add fakesink to prevent the whole call
+   * aborting */
+
+  if (!retval)
+    {
+      GstElement *fakesink = gst_element_factory_make ("fakesink", NULL);
+
+      if (gst_bin_add (GST_BIN (priv->pipeline), fakesink))
+        {
+          GstPad *sinkpad = gst_element_get_static_pad (fakesink, "sink");
+          if (gst_element_set_state (fakesink, GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE ||
+              GST_PAD_LINK_FAILED (gst_pad_link (src, sinkpad)))
+            {
+              gst_element_set_locked_state (fakesink, TRUE);
+              gst_element_set_state (fakesink, GST_STATE_NULL);
+              gst_bin_remove (GST_BIN (priv->pipeline), fakesink);
+            }
+          else
+            {
+              g_debug ("Could not link real sink, linked fakesink instead");
+            }
+          gst_object_unref (sinkpad);
+        }
+      else
+        {
+          gst_object_unref (fakesink);
+        }
+    }
+
+
   g_mutex_unlock (priv->lock);
 
   return TRUE;