basesrc: Don't use expensive cast checks in get_range.
authorEdward Hervey <bilboed@bilboed.com>
Wed, 17 Feb 2010 11:14:09 +0000 (12:14 +0100)
committerEdward Hervey <bilboed@bilboed.com>
Wed, 17 Feb 2010 11:36:57 +0000 (12:36 +0100)
_get_range() is a pad function set by ourselves, therefore we're certain that
the parent is a GstBaseSrc.

Speeds up _get_range by 38%, and the total call by 30%. (valgrind instruction
calls measurements).

Fixes #610246

libs/gst/base/gstbasesrc.c

index 8f53184..dd71ffd 100644 (file)
@@ -2206,7 +2206,7 @@ gst_base_src_pad_get_range (GstPad * pad, guint64 offset, guint length,
   GstBaseSrc *src;
   GstFlowReturn res;
 
-  src = GST_BASE_SRC (gst_pad_get_parent (pad));
+  src = GST_BASE_SRC_CAST (gst_object_ref (GST_OBJECT_PARENT (pad)));
 
   GST_LIVE_LOCK (src);
   if (G_UNLIKELY (src->priv->flushing))