Don't forward gst_pad_set_caps() on a source ghostpad to its target.

Original commit message from CVS:
* gst/gstghostpad.c:
* tests/check/gst/gstghostpad.c:
Don't forward gst_pad_set_caps() on a source ghostpad to its target.
That would cause the ghostpad to emit notify::caps two times (fist
from gst_pad_set_caps() and after from on_src_target_notify()).
This commit is contained in:
Alessandro Decina 2008-12-19 15:11:06 +00:00
parent f1be570630
commit 1b13418a0a
3 changed files with 20 additions and 1 deletions

View file

@ -1,3 +1,11 @@
2008-12-19 Alessandro Decina <alessandro.decina@collabora.co.uk>
* gst/gstghostpad.c:
* tests/check/gst/gstghostpad.c:
Don't forward gst_pad_set_caps() on a source ghostpad to its target.
That would cause the ghostpad to emit notify::caps two times (fist
from gst_pad_set_caps() and after from on_src_target_notify()).
2008-12-19 Wim Taymans <wim.taymans@collabora.co.uk>
* tests/check/gst/gstghostpad.c: (ghost_notify_caps),

View file

@ -704,12 +704,23 @@ on_src_target_notify (GstPad * target, GParamSpec * unused, GstGhostPad * pad)
}
static gboolean
gst_ghost_pad_do_setcaps (GstPad * pad, GstCaps * caps)
{
if (GST_PAD_DIRECTION (pad) == GST_PAD_SRC)
return TRUE;
return gst_proxy_pad_do_setcaps (pad, caps);
}
static void
gst_ghost_pad_init (GstGhostPad * pad)
{
GST_GHOST_PAD_PRIVATE (pad) = G_TYPE_INSTANCE_GET_PRIVATE (pad,
GST_TYPE_GHOST_PAD, GstGhostPadPrivate);
gst_pad_set_setcaps_function (GST_PAD_CAST (pad),
GST_DEBUG_FUNCPTR (gst_ghost_pad_do_setcaps));
gst_pad_set_activatepull_function (GST_PAD_CAST (pad),
GST_DEBUG_FUNCPTR (gst_ghost_pad_do_activate_pull));
gst_pad_set_activatepush_function (GST_PAD_CAST (pad),

View file

@ -721,7 +721,7 @@ GST_START_TEST (test_ghost_pads_forward_setcaps)
caps1 = gst_caps_from_string ("meh");
fail_unless (gst_pad_set_caps (ghost, caps1));
caps2 = GST_PAD_CAPS (src);
fail_unless (gst_caps_is_equal (caps1, caps2));
fail_unless (caps2 == NULL);
fail_unless_equals_int (notify_counter, 1);
gst_object_unref (ghost);