mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
gst/gstbin.c: Use an iterator to set the clock and the index so that we can release the object lock appropriately. Fi...
Original commit message from CVS: * gst/gstbin.c: (gst_bin_set_index_func), (gst_bin_set_clock_func), (gst_bin_change_state_func): Use an iterator to set the clock and the index so that we can release the object lock appropriately. Fixes #566393.
This commit is contained in:
parent
8d18476d94
commit
23bdf5c9fe
2 changed files with 64 additions and 13 deletions
|
@ -1,3 +1,10 @@
|
|||
2009-01-05 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||
|
||||
* gst/gstbin.c: (gst_bin_set_index_func), (gst_bin_set_clock_func),
|
||||
(gst_bin_change_state_func):
|
||||
Use an iterator to set the clock and the index so that we can release
|
||||
the object lock appropriately. Fixes #566393.
|
||||
|
||||
2009-01-03 Edward Hervey <edward.hervey@collabora.co.uk>
|
||||
|
||||
* libs/gst/base/gstcollectpads.c: (gst_collect_pads_available):
|
||||
|
|
70
gst/gstbin.c
70
gst/gstbin.c
|
@ -624,17 +624,40 @@ static void
|
|||
gst_bin_set_index_func (GstElement * element, GstIndex * index)
|
||||
{
|
||||
GstBin *bin;
|
||||
GList *children;
|
||||
gboolean done;
|
||||
GstIterator *it;
|
||||
|
||||
bin = GST_BIN (element);
|
||||
|
||||
GST_OBJECT_LOCK (bin);
|
||||
for (children = bin->children; children; children = g_list_next (children)) {
|
||||
GstElement *child = GST_ELEMENT (children->data);
|
||||
it = gst_bin_iterate_elements (bin);
|
||||
|
||||
gst_element_set_index (child, index);
|
||||
done = FALSE;
|
||||
while (!done) {
|
||||
gpointer data;
|
||||
|
||||
switch (gst_iterator_next (it, &data)) {
|
||||
case GST_ITERATOR_OK:
|
||||
{
|
||||
GstElement *child = GST_ELEMENT_CAST (data);
|
||||
|
||||
GST_DEBUG_OBJECT (bin, "setting index on %s", GST_ELEMENT_NAME (child));
|
||||
gst_element_set_index (child, index);
|
||||
|
||||
gst_object_unref (child);
|
||||
break;
|
||||
}
|
||||
case GST_ITERATOR_RESYNC:
|
||||
GST_DEBUG_OBJECT (bin, "iterator doing resync");
|
||||
gst_iterator_resync (it);
|
||||
break;
|
||||
default:
|
||||
case GST_ITERATOR_DONE:
|
||||
GST_DEBUG_OBJECT (bin, "iterator done");
|
||||
done = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
GST_OBJECT_UNLOCK (bin);
|
||||
gst_iterator_free (it);
|
||||
}
|
||||
|
||||
/* set the clock on all elements in this bin
|
||||
|
@ -644,21 +667,42 @@ gst_bin_set_index_func (GstElement * element, GstIndex * index)
|
|||
static gboolean
|
||||
gst_bin_set_clock_func (GstElement * element, GstClock * clock)
|
||||
{
|
||||
GList *children;
|
||||
GstBin *bin;
|
||||
gboolean done;
|
||||
GstIterator *it;
|
||||
gboolean res = TRUE;
|
||||
|
||||
bin = GST_BIN (element);
|
||||
|
||||
GST_OBJECT_LOCK (bin);
|
||||
if (element->clock != clock) {
|
||||
for (children = bin->children; children; children = g_list_next (children)) {
|
||||
GstElement *child = GST_ELEMENT (children->data);
|
||||
it = gst_bin_iterate_elements (bin);
|
||||
|
||||
res &= gst_element_set_clock (child, clock);
|
||||
done = FALSE;
|
||||
while (!done) {
|
||||
gpointer data;
|
||||
|
||||
switch (gst_iterator_next (it, &data)) {
|
||||
case GST_ITERATOR_OK:
|
||||
{
|
||||
GstElement *child = GST_ELEMENT_CAST (data);
|
||||
|
||||
res &= gst_element_set_clock (child, clock);
|
||||
|
||||
gst_object_unref (child);
|
||||
break;
|
||||
}
|
||||
case GST_ITERATOR_RESYNC:
|
||||
GST_DEBUG_OBJECT (bin, "iterator doing resync");
|
||||
gst_iterator_resync (it);
|
||||
res = TRUE;
|
||||
break;
|
||||
default:
|
||||
case GST_ITERATOR_DONE:
|
||||
GST_DEBUG_OBJECT (bin, "iterator done");
|
||||
done = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
GST_OBJECT_UNLOCK (bin);
|
||||
gst_iterator_free (it);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue