- GstCaps *caps = (GstCaps *) static_caps;
-
- /* FIXME: this is not threadsafe */
- if (GST_CAPS_REFCOUNT_VALUE (caps) == 1) {
- GstStructure *structure;
- guint i, clen;
-
- clen = GST_CAPS_LEN (caps);
-
- for (i = 0; i < clen; i++) {
- structure = (GstStructure *) gst_caps_get_structure (caps, i);
- gst_structure_set_parent_refcount (structure, NULL);
- gst_structure_free (structure);
- }
- g_ptr_array_free (GST_CAPS_ARRAY (caps), TRUE);
- GST_CAPS_REFCOUNT (caps) = 0;
- }
+ G_LOCK (static_caps_lock);
+ gst_caps_replace (&static_caps->caps, NULL);
+ G_UNLOCK (static_caps_lock);