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] Updated
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 <edward@fluendo.com> * libs/gst/base/Makefile.am: * libs/gst/base/gstdataqueue.c: (gst_data_queue_get_type), (gst_data_queue_base_init), (gst_data_queue_class_init), (gst_data_queue_init), (gst_data_queue_new), (gst_data_queue_cleanup), (gst_data_queue_finalize), (gst_data_queue_locked_flush), (gst_data_queue_locked_is_empty), (gst_data_queue_locked_is_full), (gst_data_queue_flush), (gst_data_queue_is_empty), (gst_data_queue_is_full), (gst_data_queue_set_flushing), (gst_data_queue_push), (gst_data_queue_pop), (gst_data_queue_drop_head), (gst_data_queue_set_property), (gst_data_queue_get_property): * libs/gst/base/gstdataqueue.h: New GstDataQueue object for threadsafe queueing. Most useful for elements that need some queueing functionnality. * docs/libs/gstreamer-libs-docs.sgml: * docs/libs/gstreamer-libs-sections.txt: Insert documentation for GstDataQueue * plugins/elements/Makefile.am: * plugins/elements/gstelements.c: * plugins/elements/gstmultiqueue.c: (gst_multi_queue_base_init), (gst_multi_queue_class_init), (gst_multi_queue_init), (gst_multi_queue_finalize), (gst_multi_queue_set_property), (gst_multi_queue_get_property), (gst_multi_queue_request_new_pad), (gst_multi_queue_release_pad), (gst_single_queue_push_one), (gst_multi_queue_item_destroy), (gst_multi_queue_item_new), (gst_multi_queue_loop), (gst_multi_queue_chain), (gst_multi_queue_sink_activate_push), (gst_multi_queue_sink_event), (gst_multi_queue_getcaps), (gst_multi_queue_bufferalloc), (gst_multi_queue_src_activate_push), (gst_multi_queue_acceptcaps), (gst_multi_queue_src_event), (gst_multi_queue_src_query), (wake_up_next_non_linked), (compute_next_non_linked), (single_queue_overrun_cb), (single_queue_underrun_cb), (single_queue_check_full), (gst_single_queue_new): * plugins/elements/gstmultiqueue.h: New multiqueue element, using GstDataQueue. Used for queuing multiple streams. Closes #344639 and #347785