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 705694 - dataqueue: add gst_data_queue_push_force
dataqueue: add gst_data_queue_push_force
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
unspecified
Other All
: Normal enhancement
: 1.1.4
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-08-08 17:54 UTC by Thiago Sousa Santos
Modified: 2013-08-13 15:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
dataqueue: add gst_data_queue_push_force (5.21 KB, patch)
2013-08-08 17:54 UTC, Thiago Sousa Santos
committed Details | Review

Description Thiago Sousa Santos 2013-08-08 17:54:36 UTC
Request to add a new function to dataqueue that pushes a new item without
checking if the queue is full
Comment 1 Thiago Sousa Santos 2013-08-08 17:54:39 UTC
Created attachment 251205 [details] [review]
dataqueue: add gst_data_queue_push_force

Adds a variant of the _push function that doesn't check the queue limits
before adding the new item. It is useful when pushing an element to the
queue shouldn't lock the thread.

One particular scenario is when the queue is used to serialize buffers
and events that are going to be pushed from another thread. The
dataqueue should have a limit on the amount of buffers to be stored to
avoid large memory consumption, but events can be considered to have
negligible impact on memory compared to buffers. So it is useful to be
used to push items into the queue that contain events, even though the
queue is already full, it shouldn't matter inserting an item that has
no significative size.

This scenario happens on adaptive elements (dashdemux / mssdemux) as
there is a single download thread fetching buffers and putting into the
dataqueues for the streams. This same download thread can als generate
events in some situations as caps changes, eos or a internal control
events. There can be a deadlock at preroll if the first buffer fetched
is large enough to fill the dataqueue and the download thread and the
next iteration of the download thread decides to push an event to this
same dataqueue before fetching buffers to other streams, if this push
locks, the pipeline will be stuck in preroll as no more buffers will be
downloaded.
There is a somewhat common practice in dash streams to have a single
very large buffer for audio and one for video, so this will always
happen as the download thread will have to push an EOS right after
fetching the first buffer for any stream.

API: gst_data_queue_push_force
Comment 2 Sebastian Dröge (slomo) 2013-08-13 10:53:08 UTC
Review of attachment 251205 [details] [review]:

Can't you just make the events "invisible" on the queue then? Apart from that, a pop_force() would be useful too :)
Comment 3 Thiago Sousa Santos 2013-08-13 12:01:38 UTC
(In reply to comment #2)
> Review of attachment 251205 [details] [review]:
> 
> Can't you just make the events "invisible" on the queue then? Apart from that,

I thought on this, but it would be a behaviour break. The 'visible' attribute for items is only used for counting the total of items on the queue. An item can be 'invisible' and have a duration and size. I thought on considering the item 'force pushable' if all item parameters were 0, meaning it has no size, no duration and is invisible. But this would still be a behaviour break and having a separate 'push_force()' function seems more explicit about the action.

> a pop_force() would be useful too :)
I don't get how a 'pop_force()' would work? The dataqueue has no lower limits. Maybe you meant 'try_pop()'?
Comment 4 Sebastian Dröge (slomo) 2013-08-13 13:50:56 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > Review of attachment 251205 [details] [review] [details]:
> > 
> > Can't you just make the events "invisible" on the queue then? Apart from that,
> 
> I thought on this, but it would be a behaviour break. The 'visible' attribute
> for items is only used for counting the total of items on the queue. An item
> can be 'invisible' and have a duration and size. I thought on considering the
> item 'force pushable' if all item parameters were 0, meaning it has no size, no
> duration and is invisible. But this would still be a behaviour break and having
> a separate 'push_force()' function seems more explicit about the action.

Makes sense, please push :)

> > a pop_force() would be useful too :)
> I don't get how a 'pop_force()' would work? The dataqueue has no lower limits.
> Maybe you meant 'try_pop()'?

Oh I was just confused :) I needed something like a force_pop() in queue at some point to be able to pop elements although the queue was flushing.
Comment 5 Sebastian Dröge (slomo) 2013-08-13 13:51:34 UTC
Comment on attachment 251205 [details] [review]
dataqueue: add gst_data_queue_push_force

Please add Since: 1.2 markers to the docs, add the new function to the docs and the symbol to the win32 .def file
Comment 6 Thiago Sousa Santos 2013-08-13 15:03:52 UTC
Pushed as commit 581c4297d0953fe492b34889e95d0353f4b8a509
Comment 7 Thiago Sousa Santos 2013-08-13 15:07:25 UTC
Comment on attachment 251205 [details] [review]
dataqueue: add gst_data_queue_push_force

Added requested changes and pushed.