diff options
author | Olivier CrĂȘte <olivier.crete@collabora.co.uk> | 2010-03-07 07:36:30 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-03-29 23:36:24 +0800 |
commit | ee584165872d730f364018915231e014fb0ca37f (patch) | |
tree | 39e9ce3380e253ff0e6bf66e4d6eb2af942b823b /src/empathy-call-window.c | |
parent | bcbcb511ce03d1bfde0096830f28bfa21c703569 (diff) | |
download | gsoc2013-empathy-ee584165872d730f364018915231e014fb0ca37f.tar gsoc2013-empathy-ee584165872d730f364018915231e014fb0ca37f.tar.gz gsoc2013-empathy-ee584165872d730f364018915231e014fb0ca37f.tar.bz2 gsoc2013-empathy-ee584165872d730f364018915231e014fb0ca37f.tar.lz gsoc2013-empathy-ee584165872d730f364018915231e014fb0ca37f.tar.xz gsoc2013-empathy-ee584165872d730f364018915231e014fb0ca37f.tar.zst gsoc2013-empathy-ee584165872d730f364018915231e014fb0ca37f.zip |
Return error when the audio source can not be started
Diffstat (limited to 'src/empathy-call-window.c')
-rw-r--r-- | src/empathy-call-window.c | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index 2e1be50e2..f565f1f2d 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -2123,16 +2123,41 @@ empathy_call_window_sink_added_cb (EmpathyCallHandler *handler, EmpathyCallWindow *self = EMPATHY_CALL_WINDOW (user_data); EmpathyCallWindowPriv *priv = GET_PRIV (self); GstPad *pad; + gboolean retval = FALSE; switch (media_type) { case TP_MEDIA_STREAM_TYPE_AUDIO: - gst_bin_add (GST_BIN (priv->pipeline), priv->audio_input); + if (!gst_bin_add (GST_BIN (priv->pipeline), priv->audio_input)) + { + g_warning ("Could not add audio source to pipeline"); + break; + } pad = gst_element_get_static_pad (priv->audio_input, "src"); - gst_pad_link (pad, sink); + if (!pad) + { + gst_bin_remove (GST_BIN (priv->pipeline), priv->audio_input); + g_warning ("Could not get source pad from audio source"); + break; + } - gst_element_set_state (priv->audio_input, GST_STATE_PLAYING); + if (GST_PAD_LINK_FAILED (gst_pad_link (pad, sink))) + { + gst_bin_remove (GST_BIN (priv->pipeline), priv->audio_input); + g_warning ("Could not link audio source to farsight"); + break; + } + + if (gst_element_set_state (priv->audio_input, GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) + { + g_warning ("Could not start audio source"); + gst_element_set_state (priv->audio_input, GST_STATE_NULL); + gst_bin_remove (GST_BIN (priv->pipeline), priv->audio_input); + break; + } + + retval = TRUE; break; case TP_MEDIA_STREAM_TYPE_VIDEO: if (priv->video_input != NULL) @@ -2142,13 +2167,15 @@ empathy_call_window_sink_added_cb (EmpathyCallHandler *handler, pad = gst_element_get_request_pad (priv->video_tee, "src%d"); gst_pad_link (pad, sink); } + + retval = TRUE; } break; default: g_assert_not_reached (); } - return TRUE; + return retval; } static void |