summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hervey <edward.hervey@collabora.co.uk>2011-02-24 12:51:11 +0100
committerEdward Hervey <edward.hervey@collabora.co.uk>2011-02-24 12:52:13 +0100
commit96e73314b90dbb8a3838401c0cab5d77a0348419 (patch)
treefd538fc39a2eb88f75be35c9f97564365a813be7
parent3bcd4949d4d214d6bfbbcd77bc89e5ac7f0a6701 (diff)
!pendingworkgnlstack
-rw-r--r--gnl/gnlcomposition.c47
1 files changed, 30 insertions, 17 deletions
diff --git a/gnl/gnlcomposition.c b/gnl/gnlcomposition.c
index 7b87432..332ea8e 100644
--- a/gnl/gnlcomposition.c
+++ b/gnl/gnlcomposition.c
@@ -639,11 +639,14 @@ eos_main_thread (GnlComposition * comp)
{
GnlCompositionPrivate *priv = comp->priv;
- /* Set up a non-initial seek on segment_stop */
- GST_DEBUG_OBJECT (comp,
- "Setting segment->start to segment_stop:%" GST_TIME_FORMAT,
- GST_TIME_ARGS (priv->current->stop));
- priv->segment->start = priv->current->stop;
+ if (priv->current) {
+ /* Set up a non-initial seek on segment_stop */
+ GST_DEBUG_OBJECT (comp,
+ "Setting segment->start to segment_stop:%" GST_TIME_FORMAT,
+ GST_TIME_ARGS (priv->current->stop));
+ priv->segment->start = priv->current->stop;
+ } else
+ GST_WARNING_OBJECT (comp, "Got eos on main thread without a current stack");
seek_handling (comp, TRUE);
@@ -2702,7 +2705,7 @@ gnl_composition_remove_object (GstBin * bin, GstElement * element)
gst_object_ref (element);
- gst_element_set_locked_state (element, FALSE);
+ /* gst_element_set_locked_state (element, FALSE); */
/* handle default source */
if ((GNL_OBJECT_PRIORITY (element) == G_MAXUINT32) ||
@@ -2753,21 +2756,22 @@ gnl_composition_remove_object (GstBin * bin, GstElement * element)
else
update_start_stop_duration (comp);
+ gst_element_set_locked_state (element, FALSE);
+
+ /* unblock source pad */
+ if (entry->srcpad)
+ gst_pad_set_blocked_async (entry->srcpad, FALSE,
+ (GstPadBlockCallback) pad_blocked, comp);
+
+ /* Unlock and set to NULL before removing */
+ gst_element_set_state (element, GST_STATE_NULL);
+ GST_LOG_OBJECT (element, "Actually removing from composition");
+
ret = GST_BIN_CLASS (parent_class)->remove_element (bin, element);
- GST_LOG_OBJECT (element, "Done removing from the composition");
+ GST_LOG_OBJECT (element, "Done removing from the composition. ret:%d", ret);
g_hash_table_remove (comp->priv->objects_hash, element);
- /* unblock source pad */
- if (1) {
- GstPad *pad = get_src_pad (element);
-
- if (pad) {
- gst_pad_set_blocked_async (pad, FALSE, (GstPadBlockCallback) pad_blocked,
- comp);
- gst_object_unref (pad);
- }
- }
gst_object_unref (element);
@@ -2861,6 +2865,7 @@ gnl_stack_free (GnlStack * stack)
if (stack->objects)
g_node_destroy (stack->objects);
+ GST_DEBUG_OBJECT (stack->comp, "Done freeing stack %p", stack);
g_slice_free (GnlStack, stack);
}
@@ -2985,6 +2990,12 @@ gnl_stack_expose (GnlStack * stack)
g_error ("Stack %p has no seek event", stack);
/* GST_ERROR_OBJECT (stack->comp, "Stack %p has no seek !!!", stack); */
+ if (G_UNLIKELY (stack->state != STACK_ACTIVATING)) {
+ GST_WARNING_OBJECT (comp, "Aborting exposing stack");
+ ret = FALSE;
+ goto beach;
+ }
+
/* 3. Unblock top-level pad */
GST_LOG_OBJECT (comp, "About to unblock top-level pad : %s:%s",
GST_DEBUG_PAD_NAME (stack->srcpad));
@@ -2995,6 +3006,8 @@ gnl_stack_expose (GnlStack * stack)
stack->state = STACK_ACTIVE;
beach:
+ GST_LOG_OBJECT (comp, "Done exposing stack %p, returning %d", stack, ret);
+
return ret;
}