summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 19f5517)
raw | patch | inline | side by side (parent: 19f5517)
author | Alessandro Decina <alessandro.decina@collabora.com> | |
Wed, 11 Apr 2012 12:08:06 +0000 (14:08 +0200) | ||
committer | Alessandro Decina <alessandro.decina@collabora.com> | |
Wed, 11 Apr 2012 12:08:06 +0000 (14:08 +0200) |
Pop items from ->freelist with the pool lock taken to avoid races with other
threads unreffing outstanding buffers.
threads unreffing outstanding buffers.
src/gstducatibufferpool.c | patch | blob | history |
index b81a5228252d880924001275290c7366dc4809fa..6e8b3db15a6108d11c25c81905c92957f02417c6 100644 (file)
gst_mini_object_ref (GST_MINI_OBJECT (pool));
if (pool->strided) {
- buf = gst_ducati_alloc_2d (pool->padded_width,
- pool->padded_height, &sz);
+ buf = gst_ducati_alloc_2d (pool->padded_width, pool->padded_height, &sz);
} else {
sz = pool->size;
buf = gst_ducati_alloc_1d (sz);
MemMgr_Free ((void *) GST_BUFFER_DATA (self));
GST_BUFFER_DATA (self) = NULL;
gst_mini_object_unref (GST_MINI_OBJECT (pool));
- GST_MINI_OBJECT_CLASS (buffer_parent_class)->
- finalize (GST_MINI_OBJECT (self));
+ GST_MINI_OBJECT_CLASS (buffer_parent_class)->finalize (GST_MINI_OBJECT
+ (self));
}
}
buffer_parent_class = g_type_class_peek_parent (g_class);
mini_object_class->finalize = (GstMiniObjectFinalizeFunction)
- GST_DEBUG_FUNCPTR (gst_ducati_buffer_finalize);
+ GST_DEBUG_FUNCPTR (gst_ducati_buffer_finalize);
}
GType
GST_DUCATI_BUFFERPOOL_LOCK (self);
self->running = FALSE;
- GST_DUCATI_BUFFERPOOL_UNLOCK (self);
GST_DEBUG_OBJECT (self->element, "destroy pool");
while (self->freelist) {
GstDucatiBuffer *buf = self->freelist;
self->freelist = buf->next;
+ buf->next = NULL;
+ GST_DEBUG_OBJECT (self, "unreffing %p from freelist", buf);
+ GST_DUCATI_BUFFERPOOL_UNLOCK (self);
gst_buffer_unref (GST_BUFFER (buf));
+ GST_DUCATI_BUFFERPOOL_LOCK (self);
}
-
+ GST_DUCATI_BUFFERPOOL_UNLOCK (self);
gst_mini_object_unref (GST_MINI_OBJECT (self));
}
if (self->caps)
gst_caps_unref (self->caps);
gst_object_unref (self->element);
- GST_MINI_OBJECT_CLASS (bufferpool_parent_class)->
- finalize (GST_MINI_OBJECT (self));
+ GST_MINI_OBJECT_CLASS (bufferpool_parent_class)->finalize (GST_MINI_OBJECT
+ (self));
}
static void
bufferpool_parent_class = g_type_class_peek_parent (g_class);
mini_object_class->finalize = (GstMiniObjectFinalizeFunction)
- GST_DEBUG_FUNCPTR (gst_ducati_bufferpool_finalize);
+ GST_DEBUG_FUNCPTR (gst_ducati_bufferpool_finalize);
}
GType