Commit d42ca1fd authored by Wim Taymans's avatar Wim Taymans

gst/adder/gstadder.c: Make getcaps more robust by not using the proxycaps...

gst/adder/gstadder.c: Make getcaps more robust by not using the proxycaps function. This makes sure that we don't end...

Original commit message from CVS:
* gst/adder/gstadder.c: (gst_adder_sink_getcaps),
(gst_adder_request_new_pad):
Make getcaps more robust by not using the proxycaps function. This makes
sure that we don't end up recursively calling getcaps upstream.
See #316248.
parent d4dfef2a
2007-06-29 Wim Taymans,,, <set EMAIL_ADDRESS environment variable>
2007-07-03 Wim Taymans <wim.taymans@gmail.com>
* gst/adder/gstadder.c: (gst_adder_sink_getcaps),
(gst_adder_request_new_pad):
Make getcaps more robust by not using the proxycaps function. This makes
sure that we don't end up recursively calling getcaps upstream.
See #316248.
2007-06-29 Wim Taymans <wim.taymans@gmail.com>
* gst/audioconvert/audioconvert.c:
Include math.h to fix compilation.
common @ 5167bced
Subproject commit e6a9941c662289c0743e5d8f4150458a664226f2
Subproject commit 5167bced491ffe62251c62d6c5e7b9a7541e97e5
......@@ -161,6 +161,41 @@ MAKE_FUNC_NC (add_float64, gdouble, gdouble)
MAKE_FUNC_NC (add_float32, gfloat, gfloat)
/* *INDENT-ON* */
/* we can only accept caps that we and downstream can handle. */
static GstCaps *
gst_adder_sink_getcaps (GstPad * pad)
{
GstAdder *adder;
GstCaps *result, *peercaps, *sinkcaps;
adder = GST_ADDER (GST_PAD_PARENT (pad));
GST_OBJECT_LOCK (adder);
/* get the downstream possible caps */
peercaps = gst_pad_peer_get_caps (adder->srcpad);
/* get the allowed caps on this sinkpad, we use the fixed caps function so
* that it does not call recursively in this function. */
sinkcaps = gst_pad_get_fixed_caps_func (pad);
if (peercaps) {
/* if the peer has caps, intersect */
GST_DEBUG_OBJECT (adder, "intersecting peer and template caps");
result = gst_caps_intersect (peercaps, sinkcaps);
gst_caps_unref (peercaps);
gst_caps_unref (sinkcaps);
} else {
/* the peer has no caps (or there is no peer), just use the allowed caps
* of this sinkpad. */
GST_DEBUG_OBJECT (adder, "no peer caps, using sinkcaps");
result = sinkcaps;
}
GST_OBJECT_UNLOCK (adder);
return result;
}
/* the first caps we receive on any of the sinkpads will define the caps for all
* the other sinkpads because we can only mix streams with the same caps.
* */
static gboolean
gst_adder_setcaps (GstPad * pad, GstCaps * caps)
{
......@@ -603,7 +638,7 @@ gst_adder_request_new_pad (GstElement * element, GstPadTemplate * templ,
g_free (name);
gst_pad_set_getcaps_function (newpad,
GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps));
GST_DEBUG_FUNCPTR (gst_adder_sink_getcaps));
gst_pad_set_setcaps_function (newpad, GST_DEBUG_FUNCPTR (gst_adder_setcaps));
gst_collect_pads_add_pad (adder->collect, newpad, sizeof (GstCollectData));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment