From 53f023528fd448e02947fe1b0d12f59dc4cc8584 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Fri, 19 May 2006 13:46:10 +0000 Subject: [PATCH] gst/gstpad.c: Short-circuit gst_pad_set_caps if setting the existing caps pointer again, and avoid printing debug and... Original commit message from CVS: * gst/gstpad.c: (gst_pad_set_caps): Short-circuit gst_pad_set_caps if setting the existing caps pointer again, and avoid printing debug and reffing/unreffing the caps. * plugins/elements/gstqueue.c: (gst_queue_push_one): There's actually no need to set the caps before pushing - the acceptcaps method will handle it anyway. --- ChangeLog | 11 +++++++++++ gst/gstpad.c | 5 +++++ plugins/elements/gstqueue.c | 5 ----- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4321b37..f8b6bc8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2006-05-19 Jan Schmidt + + * gst/gstpad.c: (gst_pad_set_caps): + Short-circuit gst_pad_set_caps if setting the existing + caps pointer again, and avoid printing debug and + reffing/unreffing the caps. + + * plugins/elements/gstqueue.c: (gst_queue_push_one): + There's actually no need to set the caps before pushing - + the acceptcaps method will handle it anyway. + 2006-05-19 Tim-Philipp Müller * docs/gst/gstreamer-sections.txt: diff --git a/gst/gstpad.c b/gst/gstpad.c index 86e7d89..15c87b3 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -2206,6 +2206,11 @@ gst_pad_set_caps (GstPad * pad, GstCaps * caps) setcaps = GST_PAD_SETCAPSFUNC (pad); existing = GST_PAD_CAPS (pad); + if (existing == caps) { + GST_OBJECT_UNLOCK (pad); + return TRUE; + } + if (gst_caps_is_equal (caps, existing)) goto setting_same_caps; diff --git a/plugins/elements/gstqueue.c b/plugins/elements/gstqueue.c index 8b7c4ff..0b61ffa 100644 --- a/plugins/elements/gstqueue.c +++ b/plugins/elements/gstqueue.c @@ -776,11 +776,6 @@ gst_queue_push_one (GstQueue * queue) queue->cur_level.time -= GST_BUFFER_DURATION (data); GST_QUEUE_MUTEX_UNLOCK (queue); - /* Set caps on the src pad first, because otherwise when we push it will - * check that we accept the caps which checks upstream, whereas - * explicitly setting the caps doesn't */ - gst_pad_set_caps (queue->srcpad, GST_BUFFER_CAPS (data)); - result = gst_pad_push (queue->srcpad, GST_BUFFER (data)); /* need to check for srcresult here as well */ GST_QUEUE_MUTEX_LOCK_CHECK (queue, out_flushing); -- 2.7.4