[gst-cvs] gst-plugins-bad: baseparse: slightly optimize sending of pending newsegment events

Mark Nauwelaerts mnauw at kemper.freedesktop.org
Wed Nov 17 06:47:03 PST 2010


Module: gst-plugins-bad
Branch: master
Commit: 587106f1cf9fa740fabdd80682a917db63df6658
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=587106f1cf9fa740fabdd80682a917db63df6658

Author: Mark Nauwelaerts <mark.nauwelaerts at collabora.co.uk>
Date:   Tue Nov 16 18:04:00 2010 +0100

baseparse: slightly optimize sending of pending newsegment events

---

 gst/audioparsers/gstbaseparse.c |   29 +++++++++++------------------
 1 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/gst/audioparsers/gstbaseparse.c b/gst/audioparsers/gstbaseparse.c
index e014d44..784bac0 100644
--- a/gst/audioparsers/gstbaseparse.c
+++ b/gst/audioparsers/gstbaseparse.c
@@ -1508,24 +1508,17 @@ gst_base_parse_push_buffer (GstBaseParse * parse, GstBuffer * buffer)
   }
 
   /* and should then also be linked downstream, so safe to send some events */
-  if (parse->priv->pad_mode == GST_ACTIVATE_PULL) {
-    if (G_UNLIKELY (parse->close_segment)) {
-      GST_DEBUG_OBJECT (parse, "loop sending close segment");
-      gst_pad_push_event (parse->srcpad, parse->close_segment);
-      parse->close_segment = NULL;
-    }
-
-    if (G_UNLIKELY (parse->pending_segment)) {
-      GST_DEBUG_OBJECT (parse, "loop push pending segment");
-      gst_pad_push_event (parse->srcpad, parse->pending_segment);
-      parse->pending_segment = NULL;
-    }
-  } else {
-    if (G_UNLIKELY (parse->pending_segment)) {
-      GST_DEBUG_OBJECT (parse, "chain pushing a pending segment");
-      gst_pad_push_event (parse->srcpad, parse->pending_segment);
-      parse->pending_segment = NULL;
-    }
+  if (G_UNLIKELY (parse->close_segment)) {
+    /* only set up by loop */
+    GST_DEBUG_OBJECT (parse, "loop sending close segment");
+    gst_pad_push_event (parse->srcpad, parse->close_segment);
+    parse->close_segment = NULL;
+  }
+  if (G_UNLIKELY (parse->pending_segment)) {
+    GST_DEBUG_OBJECT (parse, "%s push pending segment",
+        parse->priv->pad_mode == GST_ACTIVATE_PULL ? "loop" : "chain");
+    gst_pad_push_event (parse->srcpad, parse->pending_segment);
+    parse->pending_segment = NULL;
   }
 
   /* update bitrates and optionally post corresponding tags





More information about the Gstreamer-commits mailing list