From 48ed8c6d0e7a07434eae0917b6adfddcdb3ea8bd Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Tue, 15 Jul 2014 15:47:59 +0200 Subject: [PATCH] gnl: Rely on the GstElement to properly handle their seqnums Actually it is not exactly thread safe to tweak them ourself at the GNL level. Co-Authored by: Mathieu Duponchelle --- gnl/gnlcomposition.c | 7 ------- gnl/gnlghostpad.c | 23 ----------------------- gnl/gnlobject.c | 19 ------------------- gnl/gnlobject.h | 6 ------ 4 files changed, 55 deletions(-) diff --git a/gnl/gnlcomposition.c b/gnl/gnlcomposition.c index 0772b3969e..a29011cc9e 100644 --- a/gnl/gnlcomposition.c +++ b/gnl/gnlcomposition.c @@ -973,9 +973,6 @@ ghost_event_probe_handler (GstPad * ghostpad G_GNUC_UNUSED, event2 = gst_event_new_segment (©); GST_EVENT_SEQNUM (event2) = GST_EVENT_SEQNUM (event); - if (GNL_OBJECT (comp)->seqnum == 0) - GNL_OBJECT (comp)->seqnum = GST_EVENT_SEQNUM (event); - GST_PAD_PROBE_INFO_DATA (info) = event2; gst_event_unref (event); } @@ -2450,10 +2447,6 @@ static void _relink_new_stack (GnlComposition * comp, GNode * stack, GstEvent * toplevel_seek) { - GST_INFO_OBJECT (comp, "Reseting seqnum to %i", - gst_event_get_seqnum (toplevel_seek)); - GNL_OBJECT (comp)->wanted_seqnum = gst_event_get_seqnum (toplevel_seek); - _relink_single_node (comp, stack, toplevel_seek); gst_event_unref (toplevel_seek); diff --git a/gnl/gnlghostpad.c b/gnl/gnlghostpad.c index ae68d7829d..e287e980d0 100644 --- a/gnl/gnlghostpad.c +++ b/gnl/gnlghostpad.c @@ -299,12 +299,6 @@ translate_incoming_segment (GnlObject * object, GstEvent * event) GST_EVENT_SEQNUM (event2) = seqnum; gst_event_unref (event); - if (object->seqnum) { - GST_INFO_OBJECT (object, "Tweaking SEGMENT seqnum from %i to %i", - gst_event_get_seqnum (event2), object->seqnum); - gst_event_set_seqnum (event2, object->seqnum); - } - return event2; } @@ -328,25 +322,10 @@ internalpad_event_function (GstPad * internal, GstObject * parent, switch (priv->dir) { case GST_PAD_SRC:{ switch (GST_EVENT_TYPE (event)) { - case GST_EVENT_SEEK: - object->wanted_seqnum = gst_event_get_seqnum (event); - object->seqnum = 0; - GST_DEBUG_OBJECT (object, "Setting wanted_seqnum to %i", - object->wanted_seqnum); - break; case GST_EVENT_SEGMENT: event = translate_outgoing_segment (object, event); - if (object->wanted_seqnum == gst_event_get_seqnum (event)) { - object->seqnum = object->wanted_seqnum; - object->wanted_seqnum = 0; - } break; case GST_EVENT_EOS: - if (object->seqnum) { - GST_INFO_OBJECT (object, "Tweaking EOS seqnum from %i to %i", - gst_event_get_seqnum (event), object->seqnum); - gst_event_set_seqnum (event, object->seqnum); - } break; default: break; @@ -516,8 +495,6 @@ ghostpad_event_function (GstPad * ghostpad, GstObject * parent, GstPad *target; event = gnl_object_translate_incoming_seek (object, event); - object->wanted_seqnum = gst_event_get_seqnum (event); - object->seqnum = 0; if (!(target = gst_ghost_pad_get_target (GST_GHOST_PAD (ghostpad)))) { g_assert ("Seeked a pad with not target SHOULD NOT HAPPEND"); ret = FALSE; diff --git a/gnl/gnlobject.c b/gnl/gnlobject.c index 2f01d0ce5d..5a7e3a8bfe 100644 --- a/gnl/gnlobject.c +++ b/gnl/gnlobject.c @@ -98,20 +98,6 @@ static gboolean gnl_object_commit_func (GnlObject * object, gboolean recurse); static GstStateChangeReturn gnl_object_prepare (GnlObject * object); - -static gboolean -gnl_object_send_event (GstElement * element, GstEvent * event) -{ - if (GST_EVENT_TYPE (event) == GST_EVENT_SEEK) { - GNL_OBJECT (element)->wanted_seqnum = gst_event_get_seqnum (event); - GST_DEBUG_OBJECT (element, "Remember seqnum! %i", - GNL_OBJECT (element)->wanted_seqnum); - } - - - return GST_ELEMENT_CLASS (parent_class)->send_event (element, event); -} - static void gnl_object_class_init (GnlObjectClass * klass) { @@ -131,7 +117,6 @@ gnl_object_class_init (GnlObjectClass * klass) gobject_class->dispose = GST_DEBUG_FUNCPTR (gnl_object_dispose); gstelement_class->change_state = GST_DEBUG_FUNCPTR (gnl_object_change_state); - gstelement_class->send_event = GST_DEBUG_FUNCPTR (gnl_object_send_event); gnlobject_class->prepare = GST_DEBUG_FUNCPTR (gnl_object_prepare_func); gnlobject_class->cleanup = GST_DEBUG_FUNCPTR (gnl_object_cleanup_func); @@ -425,8 +410,6 @@ gnl_object_cleanup (GnlObject * object) GST_DEBUG_OBJECT (object, "cleaning-up"); - object->seqnum = 0; - object->wanted_seqnum = 0; if (!(GNL_OBJECT_GET_CLASS (object)->cleanup (object))) ret = GST_STATE_CHANGE_FAILURE; @@ -663,8 +646,6 @@ gnl_object_reset (GnlObject * object) { GST_INFO_OBJECT (object, "Resetting child timing values to default"); - object->seqnum = 0; - object->wanted_seqnum = 0; object->start = 0; object->duration = 0; object->stop = 0; diff --git a/gnl/gnlobject.h b/gnl/gnlobject.h index b69f4f3f1b..a97eb47b1e 100644 --- a/gnl/gnlobject.h +++ b/gnl/gnlobject.h @@ -126,12 +126,6 @@ struct _GnlObject gint64 segment_stop; gboolean in_composition; - - /* the seqnum we want, will be conciderd as real one right after - * a new segment */ - gint wanted_seqnum; - /* The seqnum that we are working with, 0 if not set */ - gint seqnum; }; struct _GnlObjectClass