aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.co.uk>2009-09-02 03:22:04 +0800
committerOlivier CrĂȘte <olivier.crete@collabora.co.uk>2009-09-02 05:14:43 +0800
commitb5cb6b662d66c8230f406c5da0697793d271e8d3 (patch)
tree33accd2dd796e3b8356533eeb7f79e48eaa2f203
parentb7c5ae7a1ae29b6acedfffde3d4319d3cfe15bc9 (diff)
downloadgsoc2013-empathy-b5cb6b662d66c8230f406c5da0697793d271e8d3.tar
gsoc2013-empathy-b5cb6b662d66c8230f406c5da0697793d271e8d3.tar.gz
gsoc2013-empathy-b5cb6b662d66c8230f406c5da0697793d271e8d3.tar.bz2
gsoc2013-empathy-b5cb6b662d66c8230f406c5da0697793d271e8d3.tar.lz
gsoc2013-empathy-b5cb6b662d66c8230f406c5da0697793d271e8d3.tar.xz
gsoc2013-empathy-b5cb6b662d66c8230f406c5da0697793d271e8d3.tar.zst
gsoc2013-empathy-b5cb6b662d66c8230f406c5da0697793d271e8d3.zip
Stop the sink on stream close to prevent deadlock
-rw-r--r--src/empathy-call-window.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c
index f28afa50e..5a24d8840 100644
--- a/src/empathy-call-window.c
+++ b/src/empathy-call-window.c
@@ -1322,6 +1322,52 @@ empathy_call_window_channel_closed_cb (EmpathyCallHandler *handler,
empathy_call_window_restart_call (self);
}
+
+static void
+empathy_call_window_channel_stream_closed_cb (EmpathyCallHandler *handler,
+ TfStream *stream, gpointer user_data)
+{
+ EmpathyCallWindow *self = EMPATHY_CALL_WINDOW (user_data);
+ EmpathyCallWindowPriv *priv = GET_PRIV (self);
+ guint media_type;
+
+ g_object_get (stream, "media-type", &media_type, NULL);
+
+ /*
+ * This assumes that there is only one video stream per channel...
+ */
+
+ if (media_type == TP_MEDIA_STREAM_TYPE_VIDEO)
+ {
+ if (priv->funnel != NULL)
+ {
+ GstElement *output;
+
+ output = empathy_video_widget_get_element (EMPATHY_VIDEO_WIDGET
+ (priv->video_output));
+
+ gst_element_set_state (output, GST_STATE_NULL);
+ gst_element_set_state (priv->funnel, GST_STATE_NULL);
+
+ gst_bin_remove (GST_BIN (priv->pipeline), output);
+ gst_bin_remove (GST_BIN (priv->pipeline), priv->funnel);
+ priv->funnel = NULL;
+ }
+ }
+ else if (media_type == TP_MEDIA_STREAM_TYPE_AUDIO)
+ {
+ if (priv->liveadder != NULL)
+ {
+ gst_element_set_state (priv->audio_output, GST_STATE_NULL);
+ gst_element_set_state (priv->liveadder, GST_STATE_NULL);
+
+ gst_bin_remove (GST_BIN (priv->pipeline), priv->audio_output);
+ gst_bin_remove (GST_BIN (priv->pipeline), priv->liveadder);
+ priv->liveadder = NULL;
+ }
+ }
+}
+
/* Called with global lock held */
static GstPad *
empathy_call_window_get_video_sink_pad (EmpathyCallWindow *self)
@@ -1702,6 +1748,8 @@ empathy_call_window_realized_cb (GtkWidget *widget, EmpathyCallWindow *window)
G_CALLBACK (empathy_call_window_src_added_cb), window);
g_signal_connect (priv->handler, "sink-pad-added",
G_CALLBACK (empathy_call_window_sink_added_cb), window);
+ g_signal_connect (priv->handler, "stream-closed",
+ G_CALLBACK (empathy_call_window_channel_stream_closed_cb), window);
gst_element_set_state (priv->pipeline, GST_STATE_PAUSED);
}