After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 344639 - Separate threadsafe queuing functionnality in a separate object
Separate threadsafe queuing functionnality in a separate object
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal blocker
: 0.10.11
Assigned To: Edward Hervey
GStreamer Maintainers
Depends on:
Blocks: 347785 370092
 
 
Reported: 2006-06-12 10:13 UTC by Edward Hervey
Modified: 2006-11-28 12:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GstSafeQueue + patched GstQueue (51.13 KB, patch)
2006-06-12 10:14 UTC, Edward Hervey
none Details | Review
Updated version, more versatile. (55.59 KB, patch)
2006-07-06 12:04 UTC, Edward Hervey
none Details | Review
Updated (28.85 KB, patch)
2006-11-03 16:05 UTC, Edward Hervey
none Details | Review
Updated correct patch (59.84 KB, patch)
2006-11-03 16:16 UTC, Edward Hervey
none Details | Review
Patch for GstDataQueue and GstMultiQueue (60.79 KB, patch)
2006-11-28 11:47 UTC, Edward Hervey
committed Details | Review

Description Edward Hervey 2006-06-12 10:13:18 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.
Comment 1 Edward Hervey 2006-06-12 10:14:47 UTC
Created attachment 67165 [details] [review]
GstSafeQueue + patched GstQueue

New GstSafeQueue object + patched GstQueue using that object
Comment 2 Edward Hervey 2006-07-06 12:04:33 UTC
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.
Comment 3 Edward Hervey 2006-11-03 16:05:22 UTC
Created attachment 75942 [details] [review]
Updated
Comment 4 Edward Hervey 2006-11-03 16:12:49 UTC
damn, previous patch is busted. Forget, ignore, new one coming.
Comment 5 Edward Hervey 2006-11-03 16:16:16 UTC
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
Comment 6 Edward Hervey 2006-11-28 11:47:12 UTC
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/
Comment 7 Edward Hervey 2006-11-28 12:08:11 UTC
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