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 664290 - [0.11] Add event/query for buffering requirements
[0.11] Add event/query for buffering requirements
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
0.11.x
Other Linux
: Normal major
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-11-17 18:30 UTC by Sebastian Dröge (slomo)
Modified: 2011-12-01 10:29 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Sebastian Dröge (slomo) 2011-11-17 18:30:08 UTC
There should be some way to query downstream and/or upstream about the number of buffers (or the time or number of bytes) it is going to buffer. This is necessary to get the minimum number of buffers required to pre-allocate for things like OpenMAX or V4L2 before playback starts to make sure that enough buffers are allocated and the pipeline never runs out of buffers.

It could be implemented similar to the LATENCY event/query. Elements would first query the other side, then add their own buffering requirements on top of that and return that value.
Comment 1 Tim-Philipp Müller 2011-11-17 18:45:32 UTC
There's min_buffers in the allocation query (params) - is this not what you had in mind?
Comment 2 Sebastian Dröge (slomo) 2011-11-17 19:15:14 UTC
I don't really know how this is supposed to work. Are elements supposed to set the min/max buffer fields on the way downstream to reflect their buffering requirements (and the other fields, like the meta, etc are set on the way downstream too) and then on the most downstream element (that sets the buffer pool etc) these values are taken into account and then everything is returned back upstream? And if the buffering requirements somewhere change a reconfigure event must be sent and a new allocation query has to be performed?

Is this how the allocation query should be used?
Comment 3 Wim Taymans 2011-11-17 19:46:35 UTC
(In reply to comment #2)
> I don't really know how this is supposed to work. Are elements supposed to set
> the min/max buffer fields on the way downstream to reflect their buffering
> requirements (and the other fields, like the meta, etc are set on the way
> downstream too) and then on the most downstream element (that sets the buffer
> pool etc) these values are taken into account and then everything is returned
> back upstream? And if the buffering requirements somewhere change a reconfigure
> event must be sent and a new allocation query has to be performed?
> 
> Is this how the allocation query should be used?

Not really.

The query goes all the way downstream, then upstream elements adjust the query result. At one point some upstream element can choose to use the bufferpool in the query (after configuring and activating it) or use its own allocation method to allocate buffers based on the properties in the queries. This only works with fixed size buffers (pools can only have fixed size buffers). If the parameters change, a reconfigure event needs to be sent. This should be good to negotiate things for v4l2src and sinks. There is no way to add min/max values for bytes in there (use case? you would split those up in buffers of equal size usually) 

You can also use a new allocator if you have special memory of some sort, the allocator can allocate in different sized chunks. This could be interesting to deal with input memory for a decoder, for example. Again, there is no way currently to negotiate min/max size of this area but it could be done.

There is currently also no query for the amount of buffering taking place (amount of buffered bytes and buffers). I don't know why you would need that?
Comment 4 Sebastian Dröge (slomo) 2011-11-17 19:54:30 UTC
I don't really know use cases for byte/time buffering so let's ignore that for now :)


So how would the allocation query be used in this scenario:
OpenMAX decoder wants to know the number of output buffers it has to allocate at minimum. And it can't use a buffer pool but has to allocate the buffers itself.
Comment 5 Wim Taymans 2011-11-23 12:57:50 UTC
> So how would the allocation query be used in this scenario:
> OpenMAX decoder wants to know the number of output buffers it has to allocate
> at minimum. And it can't use a buffer pool but has to allocate the buffers
> itself.

The decoder does an allocation query downstream, it can use the pool from downstream or it can create a pool itself with the min/max buffers in the query result.
Comment 6 Sebastian Dröge (slomo) 2011-11-23 13:27:43 UTC
But this does not provide the decoder with the buffering requirements of all elements between the decoder and the sink. The min/max buffers in the query result are only set by the sink (or whatever answers the query and provides a buffer pool) and is not the maximum of all elements.
Comment 7 Sebastian Dröge (slomo) 2011-12-01 09:01:16 UTC
So, what shall we do about this?

I'd propose a "buffering" (better name? buffering exists already) query and event that works the same way as the latency query/event and (for now) only works with the number of buffers.
Comment 8 Wim Taymans 2011-12-01 09:27:06 UTC
(In reply to comment #7)
> So, what shall we do about this?

About what?

> 
> I'd propose a "buffering" (better name? buffering exists already) query and
> event that works the same way as the latency query/event and (for now) only
> works with the number of buffers.

Why would you add another query for something that is already handled by the ALLOCATION query?
Comment 9 Sebastian Dröge (slomo) 2011-12-01 09:40:49 UTC
See comment 6, the allocation query does not handle or solve this because the min/max buffers are only set by the sink
Comment 10 Wim Taymans 2011-12-01 09:43:12 UTC
(In reply to comment #9)
> See comment 6, the allocation query does not handle or solve this because the
> min/max buffers are only set by the sink

Any element in between can modify the values and add its own min/max requirements.
Comment 11 Sebastian Dröge (slomo) 2011-12-01 10:22:49 UTC
Are the min/max values something that has to be configured on the bufferpool before it is used by an element by taking the values from the allocation query? Then this would work, yes
Comment 12 Wim Taymans 2011-12-01 10:26:23 UTC
(In reply to comment #11)
> Are the min/max values something that has to be configured on the bufferpool
> before it is used by an element by taking the values from the allocation query?
> Then this would work, yes

Yes, you get min/max values in the allocation query then you can change or use those to configure the min/max in the provided pool (or your own pool or something else)

It was designed to work with this use case so it should work.
Comment 13 Sebastian Dröge (slomo) 2011-12-01 10:29:45 UTC
Thanks for clarifying :)