diff options
author | Thibault Saunier <thibault.saunier@collabora.com> | 2013-05-23 20:35:58 -0400 |
---|---|---|
committer | Thibault Saunier <thibault.saunier@collabora.com> | 2013-05-23 20:35:58 -0400 |
commit | 9db8b0211bf64137ff3215b78172fe76de1994a1 (patch) | |
tree | d12bda35e04fbee68742f454bd30626c9bcfd711 | |
parent | 60e1321e1c111936004a93b22c51f15b1c0e6011 (diff) |
composition: Foward eos from the streaming thread when appropriate
-rw-r--r-- | gnl/gnlcomposition.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/gnl/gnlcomposition.c b/gnl/gnlcomposition.c index 7107e7f..98079fb 100644 --- a/gnl/gnlcomposition.c +++ b/gnl/gnlcomposition.c @@ -735,6 +735,8 @@ ghost_event_probe_handler (GstPad * ghostpad G_GNUC_UNUSED, break; case GST_EVENT_EOS: { + GstClockTime duration, curpos; + COMP_FLUSHING_LOCK (comp); if (priv->flushing) { GST_DEBUG_OBJECT (comp, "flushing, bailing out"); @@ -751,13 +753,26 @@ ghost_event_probe_handler (GstPad * ghostpad G_GNUC_UNUSED, g_source_remove (priv->pending_idle); } - /* FIXME : This should be switched to using a g_thread_create() instead - * of a g_idle_add(). EXTENSIVE TESTING AND ANALYSIS REQUIRED BEFORE - * DOING THE SWITCH !!! */ - priv->pending_idle = - g_idle_add ((GSourceFunc) eos_main_thread, (gpointer) comp); + /* Get current position */ + if ((curpos = get_current_position (comp)) != GST_CLOCK_TIME_NONE) { + + if (comp->priv->segment->rate >= 0.0) + duration = GNL_OBJECT (comp)->duration; + else + duration = 0; + + if (curpos != duration) { + /* FIXME : This should be switched to using a g_thread_create() instead + * of a g_idle_add(). EXTENSIVE TESTING AND ANALYSIS REQUIRED BEFORE + * DOING THE SWITCH !!! */ + priv->pending_idle = + g_idle_add ((GSourceFunc) eos_main_thread, (gpointer) comp); - retval = GST_PAD_PROBE_DROP; + retval = GST_PAD_PROBE_DROP; + } + } + GST_DEBUG_OBJECT (comp, "Got EOS for real, fowarding it"); + /* Else if it is real eos... send it downstream */ } break; default: |