summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.co.uk>2010-04-09 20:15:13 (GMT)
committerOlivier CrĂȘte <olivier.crete@collabora.co.uk>2010-09-09 08:18:59 (GMT)
commit46ae713c760313ea7b311c1a6f9bff9a508bdc8d (patch)
tree7e53c77cd63a2e3e493c376242779252c603ac1b
parent52cf35fbe185896fb2f5f7cb2bddfe51db089b15 (diff)
downloadtelepathy-stream-engine-46ae713c760313ea7b311c1a6f9bff9a508bdc8d.tar.gz
telepathy-stream-engine-46ae713c760313ea7b311c1a6f9bff9a508bdc8d.tar.xz
Stop the video source asynchronously
-rw-r--r--src/tp-stream-engine.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/tp-stream-engine.c b/src/tp-stream-engine.c
index 65444b1..b48ec7e 100644
--- a/src/tp-stream-engine.c
+++ b/src/tp-stream-engine.c
@@ -574,10 +574,25 @@ tp_stream_engine_inc_video_source (TpStreamEngine *self)
return ret;
}
+static gpointer
+stop_video_source_thread (gpointer data)
+{
+ GstElement *videosrc = data;
+ GstStateChangeReturn state_ret;
+
+ state_ret = gst_element_set_state (videosrc, GST_STATE_NULL);
+
+ if (state_ret == GST_STATE_CHANGE_FAILURE)
+ g_error ("Error stopping the video source");
+ else if (state_ret == GST_STATE_CHANGE_ASYNC)
+ g_debug ("Stopping video src async??");
+
+ gst_object_unref (videosrc);
+}
+
static void
tp_stream_engine_stop_video_source (TpStreamEngine *self)
{
- GstStateChangeReturn state_ret;
GstElement *videosrc;
if (!self->priv->videosrc)
@@ -593,15 +608,8 @@ tp_stream_engine_stop_video_source (TpStreamEngine *self)
if (!gst_bin_remove (GST_BIN (self->priv->pipeline), videosrc))
g_warning ("Could not remove video src from pipeline");
- gst_element_set_locked_state (videosrc, TRUE);
- state_ret = gst_element_set_state (videosrc, GST_STATE_NULL);
-
- if (state_ret == GST_STATE_CHANGE_FAILURE)
- g_error ("Error stopping the video source");
- else if (state_ret == GST_STATE_CHANGE_ASYNC)
- g_debug ("Stopping video src async??");
-
- gst_object_unref (videosrc);
+ if (!g_thread_create (stop_video_source_thread, videosrc, FALSE, NULL))
+ g_error ("Could not create thread to stop the video source");
}