aggregator: simplify pad_event_func for FLUSH_STOP events
authorStefan Sauer <ensonic@users.sf.net>
Sun, 15 Oct 2017 15:46:45 +0000 (17:46 +0200)
committerStefan Sauer <ensonic@users.sf.net>
Sun, 15 Oct 2017 15:49:54 +0000 (17:49 +0200)
We want to skip serialization for FLUSH_STOP events (apparently). We can
simplify the code to add it to the top-level conditions. There was nothing
done in the first code path if the event was FLUSH_STOP.

gst-libs/gst/base/gstaggregator.c

index a3018cd..538c7e9 100644 (file)
@@ -2663,12 +2663,12 @@ gst_aggregator_pad_event_func (GstPad * pad, GstObject * parent,
   GstAggregatorPad *aggpad = GST_AGGREGATOR_PAD (pad);
   GstAggregatorClass *klass = GST_AGGREGATOR_GET_CLASS (parent);
 
-  if (GST_EVENT_IS_SERIALIZED (event)) {
+  if (GST_EVENT_IS_SERIALIZED (event)
+      && GST_EVENT_TYPE (event) != GST_EVENT_FLUSH_STOP) {
     SRC_LOCK (self);
     PAD_LOCK (aggpad);
 
-    if (aggpad->priv->flow_return != GST_FLOW_OK
-        && GST_EVENT_TYPE (event) != GST_EVENT_FLUSH_STOP) {
+    if (aggpad->priv->flow_return != GST_FLOW_OK) {
       ret = aggpad->priv->flow_return;
       goto flushing;
     }
@@ -2681,18 +2681,12 @@ gst_aggregator_pad_event_func (GstPad * pad, GstObject * parent,
       GST_OBJECT_UNLOCK (aggpad);
     }
 
-    if (GST_EVENT_TYPE (event) != GST_EVENT_FLUSH_STOP) {
-      GST_DEBUG_OBJECT (aggpad, "Store event in queue: %" GST_PTR_FORMAT,
-          event);
-      g_queue_push_head (&aggpad->priv->data, event);
-      event = NULL;
-      SRC_BROADCAST (self);
-    }
+    GST_DEBUG_OBJECT (aggpad, "Store event in queue: %" GST_PTR_FORMAT, event);
+    g_queue_push_head (&aggpad->priv->data, event);
+    SRC_BROADCAST (self);
     PAD_UNLOCK (aggpad);
     SRC_UNLOCK (self);
-  }
-
-  if (event) {
+  } else {
     if (!klass->sink_event (self, aggpad, event)) {
       /* Copied from GstPad to convert boolean to a GstFlowReturn in
        * the event handling func */