GNOME Bugzilla – Bug 344639
Separate threadsafe queuing functionnality in a separate object
Last modified: 2006-11-28 12:08:11 UTC
It is currently painful to integrate threadsafe queuing functionnality in elements since that functionality is in an element (GstQueue). That functionnality would be needed to make a multiple input/output queue, make more efficient demuxers, etc...
I separated the threadsafe queuing functionnality in a new GObject : GstSafeQueue. This object has :
_threadsafe functions, which removes any explicit locking from elements using it,
_handles size behaviours in time/buffers/bytes,
_release functions to unlock push/pop functions
_flushing mode to make push/pop functions return immediatly
_signals informing when the queue is full/empty/running
I also included a patched version of GstQueue which uses that new object. It's smaller and doesn't have to worry about locking issues.
I've been using it for the past week with succes. I welcome anybody to try it and comment on it.
Created attachment 67165 [details] [review]
GstSafeQueue + patched GstQueue
New GstSafeQueue object + patched GstQueue using that object
Created attachment 68463 [details] [review]
Updated version, more versatile.
New version of GstSafeQueue.
* There is no longer any buffer/event-specific code in it
* To cope with that change and be able to handle sizes in bytes/buffers/time, gst_safe_queue_push() takes argument to specify the size and duration(time) of the object. The 'visible' flag is set to TRUE if the object has to be taken into account for size growing (typically buffers are and events aren't). The 'last' flag is set to TRUE when the inserted object is the last one of the stream/segment and ensures the queue will be drained until that object (typically for EOS).
* Additional data can be added to the inserted object (along with a DestroyNotify).
The modified GstQueue, updated for this new GstSafeQueue, is also in the patch.
Created attachment 75942 [details] [review]
damn, previous patch is busted. Forget, ignore, new one coming.
Created attachment 75943 [details] [review]
Updated correct patch
Last patch didn't have the GstQueue modifications to work with GstSafeQueue.
I also included the addition to the documentation's gst-libs-sections.txt
Created attachment 77284 [details] [review]
Patch for GstDataQueue and GstMultiQueue
This patch contains GstDataQueue object and gstmultiqueue element.
GstDataQueue was made even more flexible, which means elements using it have a *tiny* bit more work to do.
I now included the multiqueue element in this patch, since it should go in gstreamer/plugins/elements/
2006-11-28 Edward Hervey <email@example.com>
* libs/gst/base/gstdataqueue.c: (gst_data_queue_get_type),
New GstDataQueue object for threadsafe queueing. Most useful for
elements that need some queueing functionnality.
Insert documentation for GstDataQueue
* plugins/elements/gstmultiqueue.c: (gst_multi_queue_base_init),
New multiqueue element, using GstDataQueue. Used for queuing multiple
Closes #344639 and #347785