[Bug 782556] decklinkvideosrc: Implement a custom memory allocator

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Wed May 17 08:59:48 UTC 2017


https://bugzilla.gnome.org/show_bug.cgi?id=782556

--- Comment #2 from Sebastian Dröge (slomo) <slomo at coaxion.net> ---
Review of attachment 351714:
 --> (https://bugzilla.gnome.org/review?bug=782556&attachment=351714)

::: sys/decklink/gstdecklink.cpp
@@ +860,3 @@
+private:
+  GMutex m_mutex;
+  GSList * m_sizesList;

If you use C++, use C++ :) std::list is a better choice here (only one
allocation per node instead of two), and it will clean itself up automatically

@@ +866,3 @@
+    uint32_t bufferSize;
+    uint32_t nonEmptyCalls;
+    GstQueueArray * buffers;

Constructor here, and destructor for cleaning up

@@ +944,3 @@
+      pool->nonEmptyCalls = 0;
+      pool->buffers = gst_queue_array_new (5);
+      m_sizesList = g_slist_prepend (m_sizesList, pool);

Mutex needed here at least

@@ +985,3 @@
+    /* Put the buffer back to the pool */
+    DecklinkBufferPool * pool = *(DecklinkBufferPool **) ((uint8_t*)buffer -
128);
+    gst_queue_array_push_tail (pool->buffers, buffer);

What you could do for cleaning up is to count the number of outstanding
buffers, and once that reaches 0 you get rid of everything.

Also this function needs locking

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list