[telepathy-stream-engine/master] Remove video src before stopping it to prevent the EOS from propagating
Olivier Crête
olivier.crete at collabora.co.uk
Mon Jul 13 12:31:21 PDT 2009
---
src/tp-stream-engine.c | 32 +++++++++++++++++++++++---------
1 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/src/tp-stream-engine.c b/src/tp-stream-engine.c
index 89600ea..5b5f8b1 100644
--- a/src/tp-stream-engine.c
+++ b/src/tp-stream-engine.c
@@ -127,6 +127,7 @@ struct _TpStreamEnginePrivate
GstElement *pipeline;
+ GstElement *capsfilter;
GstElement *videosrc;
GstElement *videotee;
@@ -365,7 +366,8 @@ tp_stream_engine_dispose (GObject *object)
*/
gst_element_set_state (priv->videosrc, GST_STATE_NULL);
gst_element_set_state (priv->pipeline, GST_STATE_NULL);
- g_object_unref (priv->pipeline);
+ gst_object_unref (priv->videosrc);
+ gst_object_unref (priv->pipeline);
priv->pipeline = NULL;
priv->videosrc = NULL;
}
@@ -419,6 +421,18 @@ tp_stream_engine_start_video_source (TpStreamEngine *self)
g_debug ("Starting video source");
+ if (!gst_bin_add (GST_BIN (self->priv->pipeline), self->priv->videosrc))
+ {
+ g_warning ("Could not add videosrc to pipeline");
+ return FALSE;
+ }
+
+ if (!gst_element_link (self->priv->videosrc, self->priv->capsfilter))
+ {
+ g_warning ("Could not link videosrc to capsfilter");
+ return FALSE;
+ }
+
self->priv->video_source_use_count++;
state_ret = gst_element_set_state (self->priv->videosrc, GST_STATE_PLAYING);
@@ -447,6 +461,9 @@ tp_stream_engine_stop_video_source (TpStreamEngine *self)
g_debug ("Stopping video source");
+ if (!gst_bin_remove (GST_BIN (self->priv->pipeline), self->priv->videosrc))
+ g_warning ("Could not remove video src from pipeline");
+
state_ret = gst_element_set_state (self->priv->videosrc, GST_STATE_NULL);
if (state_ret == GST_STATE_CHANGE_FAILURE)
@@ -957,17 +974,11 @@ _build_base_video_elements (TpStreamEngine *self)
gst_element_set_locked_state (videosrc, TRUE);
- if (!gst_bin_add (GST_BIN (priv->pipeline), videosrc))
- g_error ("Could not add videosrc to pipeline");
-
tee = gst_element_factory_make ("tee", "videotee");
g_assert (tee);
if (!gst_bin_add (GST_BIN (priv->pipeline), tee))
g_error ("Could not add tee to pipeline");
- priv->videosrc = videosrc;
- priv->videotee = tee;
-
#if 0
/* <wtay> Tester_, yes, videorate does not play nice with live pipelines */
tmp = gst_element_factory_make ("videorate", NULL);
@@ -988,10 +999,13 @@ _build_base_video_elements (TpStreamEngine *self)
g_object_set (capsfilter, "caps", filter, NULL);
gst_caps_unref (filter);
- ret = gst_element_link (videosrc, capsfilter);
- g_assert (ret);
ret = gst_element_link (capsfilter, tee);
g_assert (ret);
+
+ priv->capsfilter = capsfilter;
+ priv->videosrc = gst_object_ref (videosrc);
+ priv->videotee = tee;
+
}
--
1.5.6.5
More information about the telepathy-commits
mailing list