mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 15:51:11 +00:00
adder: fix deadly setcaps recursion
Use a flag to avoid calling setcaps until our stack is exhausted. I don't see how this would be useful.
This commit is contained in:
parent
0d87fd7146
commit
9debd13665
2 changed files with 12 additions and 0 deletions
|
@ -263,6 +263,11 @@ gst_adder_setcaps (GstAdder * adder, GstPad * pad, GstCaps * caps)
|
|||
IterData idata;
|
||||
gboolean done;
|
||||
|
||||
/* this get called recursively due to gst_iterator_foreach calling
|
||||
* gst_pad_set_caps() */
|
||||
if (adder->in_setcaps)
|
||||
return TRUE;
|
||||
|
||||
GST_LOG_OBJECT (adder, "setting caps pad %p,%s to %" GST_PTR_FORMAT, pad,
|
||||
GST_PAD_NAME (pad), caps);
|
||||
|
||||
|
@ -273,6 +278,7 @@ gst_adder_setcaps (GstAdder * adder, GstPad * pad, GstCaps * caps)
|
|||
idata.caps = caps;
|
||||
idata.pad = pad;
|
||||
|
||||
adder->in_setcaps = TRUE;
|
||||
done = FALSE;
|
||||
while (!done) {
|
||||
ires = gst_iterator_foreach (it, (GstIteratorForeachFunction) setcapsfunc,
|
||||
|
@ -287,6 +293,10 @@ gst_adder_setcaps (GstAdder * adder, GstPad * pad, GstCaps * caps)
|
|||
break;
|
||||
}
|
||||
}
|
||||
adder->in_setcaps = FALSE;
|
||||
|
||||
GST_LOG_OBJECT (adder, "handle caps changes on pad %p,%s to %" GST_PTR_FORMAT,
|
||||
pad, GST_PAD_NAME (pad), caps);
|
||||
|
||||
if (!gst_audio_info_from_caps (&info, caps))
|
||||
goto invalid_format;
|
||||
|
|
|
@ -77,6 +77,8 @@ struct _GstAdder {
|
|||
|
||||
/* Pending inline events */
|
||||
GList *pending_events;
|
||||
|
||||
gboolean in_setcaps;
|
||||
};
|
||||
|
||||
struct _GstAdderClass {
|
||||
|
|
Loading…
Reference in a new issue