From: Thibault Saunier Date: Thu, 3 Jul 2014 14:46:21 +0000 (+0200) Subject: composition: Teach the composition to seek same stack X-Git-Tag: 1.19.3~493^2~1472 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0e663da5887f01df3575b2c939aa147bb434b2d0;p=platform%2Fupstream%2Fgstreamer.git composition: Teach the composition to seek same stack Co-Authored by: Thibault Saunier --- diff --git a/gnl/gnlcomposition.c b/gnl/gnlcomposition.c index ff6057b9f7..6ceefe6289 100644 --- a/gnl/gnlcomposition.c +++ b/gnl/gnlcomposition.c @@ -169,6 +169,9 @@ struct _GnlCompositionPrivate GstState deactivated_elements_state; GstElement *current_bin; + + + gboolean seeking_itself; }; static guint _signals[LAST_SIGNAL] = { 0 }; @@ -1509,11 +1512,15 @@ gnl_composition_event_handler (GstPad * ghostpad, GstObject * parent, switch (GST_EVENT_TYPE (event)) { case GST_EVENT_SEEK: { - _add_seek_gsource (comp, event); - event = NULL; - GST_FIXME_OBJECT (comp, "HANDLE seeking errors!"); + if (!priv->seeking_itself) { + _add_seek_gsource (comp, event); + event = NULL; + GST_FIXME_OBJECT (comp, "HANDLE seeking errors!"); + + return TRUE; + } - return TRUE; + break; } case GST_EVENT_QOS: { @@ -2712,14 +2719,26 @@ update_pipeline (GnlComposition * comp, GstClockTime currenttime, } /* Activate stack */ - if (samestack && (startchanged || stopchanged)) { - /* Update seek events need to be flushing if not in PLAYING, - * else we will encounter deadlocks. */ - forcing_flush = (state == GST_STATE_PLAYING) ? FALSE : TRUE; - } + if (!samestack) { + return _activate_new_stack (comp, initial); + } else { + gboolean res; + GstEvent *toplevel_seek; + GstPad *peer = gst_pad_get_peer (GNL_OBJECT_SRC (comp)); + + if (samestack && (startchanged || stopchanged)) { + /* Update seek events need to be flushing if not in PLAYING, + * else we will encounter deadlocks. */ + forcing_flush = (state == GST_STATE_PLAYING) ? FALSE : TRUE; + } + toplevel_seek = get_new_seek_event (comp, TRUE, forcing_flush); - _activate_new_stack (comp, forcing_flush); - return TRUE; + priv->seeking_itself = TRUE; + res = gst_pad_push_event (peer, toplevel_seek); + priv->seeking_itself = FALSE; + + return res; + } } static gboolean diff --git a/tests/check/gnl/complex.c b/tests/check/gnl/complex.c index ef4daa689f..16d69b083b 100644 --- a/tests/check/gnl/complex.c +++ b/tests/check/gnl/complex.c @@ -188,14 +188,14 @@ GST_START_TEST (test_one_space_another) GST_ERROR ("doing one commit"); commit_and_wait (comp, &ret); check_start_stop_duration (comp, 0, 1 * GST_SECOND, 1 * GST_SECOND); - ASSERT_OBJECT_REFCOUNT (source1, "source1", 2); + ASSERT_OBJECT_REFCOUNT (source1, "source1", 1); /* Second source */ gnl_composition_add (GST_BIN (comp), source2); check_start_stop_duration (comp, 0, 1 * GST_SECOND, 1 * GST_SECOND); commit_and_wait (comp, &ret); - ASSERT_OBJECT_REFCOUNT (source2, "source2", 2); + ASSERT_OBJECT_REFCOUNT (source2, "source2", 1); /* Remove first source */ @@ -211,7 +211,7 @@ GST_START_TEST (test_one_space_another) commit_and_wait (comp, &ret); check_start_stop_duration (comp, 0, 3 * GST_SECOND, 3 * GST_SECOND); gst_object_unref (source1); - ASSERT_OBJECT_REFCOUNT (source1, "source1", 2); + ASSERT_OBJECT_REFCOUNT (source1, "source1", 1); /* Expected segments */ segments = g_list_append (segments, @@ -294,7 +294,7 @@ GST_START_TEST (test_one_default_another) commit_and_wait (comp, &ret); check_start_stop_duration (comp, GST_SECOND, 2 * GST_SECOND, 1 * GST_SECOND); - ASSERT_OBJECT_REFCOUNT (source1, "source1", 2); + ASSERT_OBJECT_REFCOUNT (source1, "source1", 1); /* defaultsrc source */ gnl_composition_add (GST_BIN (comp), defaultsrc); @@ -302,7 +302,7 @@ GST_START_TEST (test_one_default_another) check_start_stop_duration (comp, 0, 2 * GST_SECOND, 2 * GST_SECOND); check_start_stop_duration (defaultsrc, 0, 2 * GST_SECOND, 2 * GST_SECOND); - ASSERT_OBJECT_REFCOUNT (defaultsrc, "defaultsrc", 2); + ASSERT_OBJECT_REFCOUNT (defaultsrc, "defaultsrc", 1); /* Second source */ @@ -315,7 +315,7 @@ GST_START_TEST (test_one_default_another) check_start_stop_duration (comp, 0, 5 * GST_SECOND, 5 * GST_SECOND); check_start_stop_duration (defaultsrc, 0, 5 * GST_SECOND, 5 * GST_SECOND); - ASSERT_OBJECT_REFCOUNT (source3, "source3", 2); + ASSERT_OBJECT_REFCOUNT (source3, "source3", 1); /* Expected segments */ segments = g_list_append (segments, @@ -408,7 +408,7 @@ GST_START_TEST (test_one_expandable_another) commit_and_wait (comp, &ret); check_start_stop_duration (comp, GST_SECOND, 2 * GST_SECOND, 1 * GST_SECOND); - ASSERT_OBJECT_REFCOUNT (source1, "source1", 2); + ASSERT_OBJECT_REFCOUNT (source1, "source1", 1); /* defaultsrc source */ @@ -417,7 +417,7 @@ GST_START_TEST (test_one_expandable_another) check_start_stop_duration (comp, 0, 2 * GST_SECOND, 2 * GST_SECOND); check_start_stop_duration (defaultsrc, 0, 2 * GST_SECOND, 2 * GST_SECOND); - ASSERT_OBJECT_REFCOUNT (defaultsrc, "defaultsrc", 2); + ASSERT_OBJECT_REFCOUNT (defaultsrc, "defaultsrc", 1); /* Second source */ @@ -426,7 +426,7 @@ GST_START_TEST (test_one_expandable_another) check_start_stop_duration (comp, 0, 4 * GST_SECOND, 4 * GST_SECOND); check_start_stop_duration (defaultsrc, 0, 4 * GST_SECOND, 4 * GST_SECOND); - ASSERT_OBJECT_REFCOUNT (source2, "source2", 2); + ASSERT_OBJECT_REFCOUNT (source2, "source2", 1); /* Third source */ @@ -436,7 +436,7 @@ GST_START_TEST (test_one_expandable_another) check_start_stop_duration (comp, 0, 5 * GST_SECOND, 5 * GST_SECOND); check_start_stop_duration (defaultsrc, 0, 5 * GST_SECOND, 5 * GST_SECOND); - ASSERT_OBJECT_REFCOUNT (source3, "source3", 2); + ASSERT_OBJECT_REFCOUNT (source3, "source3", 1); /* Expected segments */ segments = g_list_append (segments, @@ -518,7 +518,7 @@ GST_START_TEST (test_renegotiation) commit_and_wait (comp, &ret); check_start_stop_duration (comp, 0, 1 * GST_SECOND, 1 * GST_SECOND); - ASSERT_OBJECT_REFCOUNT (source1, "source1", 2); + ASSERT_OBJECT_REFCOUNT (source1, "source1", 1); /* Second source */ @@ -526,7 +526,7 @@ GST_START_TEST (test_renegotiation) commit_and_wait (comp, &ret); check_start_stop_duration (comp, 0, 2 * GST_SECOND, 2 * GST_SECOND); - ASSERT_OBJECT_REFCOUNT (source2, "source2", 2); + ASSERT_OBJECT_REFCOUNT (source2, "source2", 1); /* Third source */ @@ -535,7 +535,7 @@ GST_START_TEST (test_renegotiation) commit_and_wait (comp, &ret); check_start_stop_duration (comp, 0, 3 * GST_SECOND, 3 * GST_SECOND); - ASSERT_OBJECT_REFCOUNT (source3, "source3", 2); + ASSERT_OBJECT_REFCOUNT (source3, "source3", 1); sink = gst_element_factory_make_or_warn ("fakesink", "sink"); @@ -570,7 +570,7 @@ GST_START_TEST (test_renegotiation) bus = gst_element_get_bus (GST_ELEMENT (pipeline)); GST_DEBUG ("Setting pipeline to PLAYING"); - ASSERT_OBJECT_REFCOUNT (source1, "source1", 2); + ASSERT_OBJECT_REFCOUNT (source1, "source1", 1); fail_if (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE);