diff options
author | Olivier CrĂȘte <olivier.crete@collabora.co.uk> | 2010-03-07 08:18:27 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-03-29 23:36:24 +0800 |
commit | 66d8d07abade96645aca23d9c0dd526a9ed5481c (patch) | |
tree | bb24661a1e6e1e4445be9608d3d8e4209657e26c /src | |
parent | 1711b4dffc6c39c948ac441aec2bd81a99c411ff (diff) | |
download | gsoc2013-empathy-66d8d07abade96645aca23d9c0dd526a9ed5481c.tar gsoc2013-empathy-66d8d07abade96645aca23d9c0dd526a9ed5481c.tar.gz gsoc2013-empathy-66d8d07abade96645aca23d9c0dd526a9ed5481c.tar.bz2 gsoc2013-empathy-66d8d07abade96645aca23d9c0dd526a9ed5481c.tar.lz gsoc2013-empathy-66d8d07abade96645aca23d9c0dd526a9ed5481c.tar.xz gsoc2013-empathy-66d8d07abade96645aca23d9c0dd526a9ed5481c.tar.zst gsoc2013-empathy-66d8d07abade96645aca23d9c0dd526a9ed5481c.zip |
Check for errors when linking the video source into a call (#612020)
Diffstat (limited to 'src')
-rw-r--r-- | src/empathy-call-window.c | 67 |
1 files changed, 60 insertions, 7 deletions
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index ca7ef6ad1..e984d4060 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -1632,28 +1632,81 @@ empathy_call_window_get_video_sink_pad (EmpathyCallWindow *self) { EmpathyCallWindowPriv *priv = GET_PRIV (self); GstPad *pad; + GstElement *output; if (priv->funnel == NULL) { - GstElement *output; - output = empathy_video_widget_get_element (EMPATHY_VIDEO_WIDGET (priv->video_output)); priv->funnel = gst_element_factory_make ("fsfunnel", NULL); - gst_bin_add (GST_BIN (priv->pipeline), priv->funnel); - gst_bin_add (GST_BIN (priv->pipeline), output); + if (!priv->funnel) + { + g_warning ("Could not create fsfunnel"); + return NULL; + } + + if (!gst_bin_add (GST_BIN (priv->pipeline), priv->funnel)) + { + gst_object_unref (priv->funnel); + priv->funnel = NULL; + g_warning ("Could not add funnel to pipeline"); + return NULL; + } + + if (!gst_bin_add (GST_BIN (priv->pipeline), output)) + { + g_warning ("Could not add the video output widget to the pipeline"); + goto error; + } + + if (!gst_element_link (priv->funnel, output)) + { + g_warning ("Could not link output sink to funnel"); + goto error_output_added; + } - gst_element_link (priv->funnel, output); + if (gst_element_set_state (output, GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) + { + g_warning ("Could not start video sink"); + goto error_output_added; + } - gst_element_set_state (priv->funnel, GST_STATE_PLAYING); - gst_element_set_state (output, GST_STATE_PLAYING); + if (gst_element_set_state (priv->funnel, GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) + { + g_warning ("Could not start funnel"); + goto error_output_added; + } } pad = gst_element_get_request_pad (priv->funnel, "sink%d"); + if (!pad) + g_warning ("Could not get request pad from funnel"); + return pad; + + + error_output_added: + + gst_element_set_locked_state (priv->funnel, TRUE); + gst_element_set_locked_state (output, TRUE); + + gst_element_set_state (priv->funnel, GST_STATE_NULL); + gst_element_set_state (output, GST_STATE_NULL); + + gst_bin_remove (GST_BIN (priv->pipeline), output); + gst_element_set_locked_state (output, FALSE); + + error: + + gst_bin_remove (GST_BIN (priv->pipeline), priv->funnel); + priv->funnel = NULL; + + return NULL; + + } /* Called with global lock held */ |