[gst-cvs] gstreamer: ghostpad: avoid excessive notify for caps
Wim Taymans
wtay at kemper.freedesktop.org
Thu Jun 4 09:28:50 PDT 2009
Module: gstreamer
Branch: master
Commit: 814b46b6a67d748a91cb7b1b5ba93ed54d03c4f9
URL: http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=814b46b6a67d748a91cb7b1b5ba93ed54d03c4f9
Author: Wim Taymans <wim.taymans at collabora.co.uk>
Date: Thu Jun 4 18:26:04 2009 +0200
ghostpad: avoid excessive notify for caps
Avoid an object property notify if the caps on the other pad were already
set (and thus notified).
---
gst/gstghostpad.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/gst/gstghostpad.c b/gst/gstghostpad.c
index bcf71de..f736693 100644
--- a/gst/gstghostpad.c
+++ b/gst/gstghostpad.c
@@ -673,14 +673,19 @@ static void
on_int_notify (GstPad * internal, GParamSpec * unused, GstGhostPad * pad)
{
GstCaps *caps;
+ gboolean changed;
g_object_get (internal, "caps", &caps, NULL);
GST_OBJECT_LOCK (pad);
- gst_caps_replace (&(GST_PAD_CAPS (pad)), caps);
+ changed = (GST_PAD_CAPS (pad) != caps);
+ if (changed)
+ gst_caps_replace (&(GST_PAD_CAPS (pad)), caps);
GST_OBJECT_UNLOCK (pad);
- g_object_notify (G_OBJECT (pad), "caps");
+ if (changed)
+ g_object_notify (G_OBJECT (pad), "caps");
+
if (caps)
gst_caps_unref (caps);
}
@@ -689,17 +694,20 @@ static void
on_src_target_notify (GstPad * target, GParamSpec * unused, GstGhostPad * pad)
{
GstCaps *caps;
+ gboolean changed;
g_object_get (target, "caps", &caps, NULL);
GST_OBJECT_LOCK (pad);
+ changed = (GST_PAD_CAPS (pad) != caps);
gst_caps_replace (&(GST_PAD_CAPS (pad)), caps);
GST_OBJECT_UNLOCK (pad);
- g_object_notify (G_OBJECT (pad), "caps");
+ if (changed)
+ g_object_notify (G_OBJECT (pad), "caps");
+
if (caps)
gst_caps_unref (caps);
-
}
static gboolean
More information about the Gstreamer-commits
mailing list