diff options
author | Olivier CrĂȘte <olivier.crete@collabora.co.uk> | 2010-03-07 05:59:20 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-03-29 23:36:23 +0800 |
commit | c7662e15ba7412146c8d9d76c9c3b4c3cffb4089 (patch) | |
tree | 8302c0071d7586245e0bf2de7c438c87197734df | |
parent | c3d5568a05b65ec18ff7ff6012be6420340bebab (diff) | |
download | gsoc2013-empathy-c7662e15ba7412146c8d9d76c9c3b4c3cffb4089.tar gsoc2013-empathy-c7662e15ba7412146c8d9d76c9c3b4c3cffb4089.tar.gz gsoc2013-empathy-c7662e15ba7412146c8d9d76c9c3b4c3cffb4089.tar.bz2 gsoc2013-empathy-c7662e15ba7412146c8d9d76c9c3b4c3cffb4089.tar.lz gsoc2013-empathy-c7662e15ba7412146c8d9d76c9c3b4c3cffb4089.tar.xz gsoc2013-empathy-c7662e15ba7412146c8d9d76c9c3b4c3cffb4089.tar.zst gsoc2013-empathy-c7662e15ba7412146c8d9d76c9c3b4c3cffb4089.zip |
Handle errors from audio sink
-rw-r--r-- | src/empathy-call-window.c | 58 |
1 files changed, 53 insertions, 5 deletions
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index d67fc3770..5a157ab94 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -1667,18 +1667,66 @@ empathy_call_window_get_audio_sink_pad (EmpathyCallWindow *self) { priv->liveadder = gst_element_factory_make ("liveadder", NULL); - gst_bin_add (GST_BIN (priv->pipeline), priv->liveadder); - gst_bin_add (GST_BIN (priv->pipeline), priv->audio_output); + if (!gst_bin_add (GST_BIN (priv->pipeline), priv->liveadder)) + { + g_warning ("Could not add liveadder to the pipeline"); + goto error_add_liveadder; + } + if (!gst_bin_add (GST_BIN (priv->pipeline), priv->audio_output)) + { + g_warning ("Could not add audio sink to pipeline"); + goto error_add_output; + } + + if (gst_element_set_state (priv->liveadder, GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) + { + g_warning ("Could not start liveadder"); + goto error; + } - gst_element_link (priv->liveadder, priv->audio_output); + if (gst_element_set_state (priv->audio_output, GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) + { + g_warning ("Could not start audio sink"); + goto error; + } - gst_element_set_state (priv->liveadder, GST_STATE_PLAYING); - gst_element_set_state (priv->audio_output, GST_STATE_PLAYING); + if (GST_PAD_LINK_FAILED ( + gst_element_link (priv->liveadder, priv->audio_output))) + { + g_warning ("Could not link liveadder to audio output"); + goto error; + } } pad = gst_element_get_request_pad (priv->liveadder, "sink%d"); return pad; + + error: + + gst_element_set_locked_state (priv->liveadder, TRUE); + gst_element_set_locked_state (priv->audio_output, TRUE); + + gst_element_set_state (priv->liveadder, GST_STATE_NULL); + gst_element_set_state (priv->audio_output, GST_STATE_NULL); + + gst_bin_remove (GST_BIN (priv->pipeline), priv->audio_output); + + error_add_output: + + gst_bin_remove (GST_BIN (priv->pipeline), priv->liveadder); + + gst_element_set_locked_state (priv->liveadder, FALSE); + gst_element_set_locked_state (priv->audio_output, FALSE); + + error_add_liveadder: + + if (priv->liveadder) + { + gst_object_unref (priv->liveadder); + priv->liveadder = NULL; + } + return NULL; } static gboolean |