mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-22 05:56:31 +00:00
gst/gstpad.c: Don't pound the cpu to pieces by checking get_caps when accept_caps is called with the same caps as the...
Original commit message from CVS: * gst/gstpad.c: (gst_pad_accept_caps), (gst_pad_alloc_buffer_full), (gst_pad_push): Don't pound the cpu to pieces by checking get_caps when accept_caps is called with the same caps as the pad already has. Use GST_DEBUG_OBJECT when outputting caps change information.
This commit is contained in:
parent
126088c311
commit
f4987a5399
2 changed files with 21 additions and 2 deletions
|
@ -1,3 +1,11 @@
|
|||
2006-03-16 Jan Schmidt <thaytan@mad.scientist.com>
|
||||
|
||||
* gst/gstpad.c: (gst_pad_accept_caps), (gst_pad_alloc_buffer_full),
|
||||
(gst_pad_push):
|
||||
Don't pound the cpu to pieces by checking get_caps when accept_caps
|
||||
is called with the same caps as the pad already has.
|
||||
Use GST_DEBUG_OBJECT when outputting caps change information.
|
||||
|
||||
2006-03-15 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* gst/gstclock.c: (gst_clock_class_init):
|
||||
|
|
15
gst/gstpad.c
15
gst/gstpad.c
|
@ -2095,6 +2095,7 @@ gst_pad_accept_caps (GstPad * pad, GstCaps * caps)
|
|||
{
|
||||
gboolean result;
|
||||
GstPadAcceptCapsFunction acceptfunc;
|
||||
GstCaps *existing = NULL;
|
||||
|
||||
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
|
||||
|
||||
|
@ -2104,11 +2105,17 @@ gst_pad_accept_caps (GstPad * pad, GstCaps * caps)
|
|||
|
||||
GST_OBJECT_LOCK (pad);
|
||||
acceptfunc = GST_PAD_ACCEPTCAPSFUNC (pad);
|
||||
if (GST_PAD_CAPS (pad) != NULL)
|
||||
existing = gst_caps_ref (GST_PAD_CAPS (pad));
|
||||
|
||||
GST_CAT_DEBUG (GST_CAT_CAPS, "pad accept caps of %s:%s (%p)",
|
||||
GST_DEBUG_PAD_NAME (pad), pad);
|
||||
GST_OBJECT_UNLOCK (pad);
|
||||
|
||||
/* The current caps on a pad are trivially acceptable */
|
||||
if (existing && (caps == existing || gst_caps_is_equal (caps, existing)))
|
||||
goto is_same_caps;
|
||||
|
||||
if (G_LIKELY (acceptfunc)) {
|
||||
/* we can call the function */
|
||||
result = acceptfunc (pad, caps);
|
||||
|
@ -2117,6 +2124,10 @@ gst_pad_accept_caps (GstPad * pad, GstCaps * caps)
|
|||
result = gst_pad_acceptcaps_default (pad, caps);
|
||||
}
|
||||
return result;
|
||||
|
||||
is_same_caps:
|
||||
gst_caps_unref (existing);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2524,7 +2535,7 @@ do_caps:
|
|||
caps_changed = caps && caps != GST_PAD_CAPS (pad);
|
||||
/* we got a new datatype on the pad, see if it can handle it */
|
||||
if (G_UNLIKELY (caps_changed)) {
|
||||
GST_DEBUG ("caps changed to %" GST_PTR_FORMAT, caps);
|
||||
GST_DEBUG_OBJECT (pad, "caps changed to %" GST_PTR_FORMAT, caps);
|
||||
if (G_UNLIKELY (!gst_pad_configure_src (pad, caps, setcaps)))
|
||||
goto not_negotiated;
|
||||
}
|
||||
|
@ -3305,7 +3316,7 @@ gst_pad_push (GstPad * pad, GstBuffer * buffer)
|
|||
|
||||
/* we got a new datatype from the pad, it had better handle it */
|
||||
if (G_UNLIKELY (caps_changed)) {
|
||||
GST_DEBUG ("caps changed to %" GST_PTR_FORMAT, caps);
|
||||
GST_DEBUG_OBJECT (pad, "caps changed to %" GST_PTR_FORMAT, caps);
|
||||
if (G_UNLIKELY (!gst_pad_configure_src (pad, caps, TRUE)))
|
||||
goto not_negotiated;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue