Configuration of the v4l2src buffer pool size.

Nicolas Dufresne nicolas at ndufresne.ca
Fri Sep 23 13:03:22 UTC 2022


Le jeu. 22 sept. 2022, 09 h 45, Louis-Antoine Blais-Morin via
gstreamer-devel <gstreamer-devel at lists.freedesktop.org> a écrit :

> Hi,
>
>
>
> We are working on an application where the pipeline is configured as
> follow:
>
>
>
> v4l2src ! capsfilter caps=[…] ! tee name=t ! appsink ! t. [remaining of
> pipeline not important for this discussion]
>
>
>
> The v4l2src video source uses DMABUF acquisition, which is great to reduce
> memory copies.
>
> However, to completely prevent memory copies, the buffer pool in v4l2src
> should have enough buffers available for the v4l2 driver while acquired
> buffers are sent to the downstream elements.
>
> If I understand correctly, the number of buffers in the v4l2src buffer
> pool is decided (amongst other things) according to the
> GST_QUERY_ALLOCATION query response to the downstream elements. The
> downstream elements could inform the upstream v4l2src of their needs (for
> example, if they need to keep references to the acquired buffers).
>
>
>
> Here is where things get complicated: our application keeps references on
> many buffers sent to the app via appsink. The application needs to have
> some short time history of the buffers. We allowed the app to keep
> references to a fixed number of buffers. As far as I investigated, there
> seems to be no way for the appsink to inform the upstream elements
> (v4l2src) about this fact, via GST_QUERY_ALLOCATION reply or via other
> means.
>

>
> My question:
>
> What is the best way to configure the v4l2src to allocate a pool with a
> larger number of buffers?
>
> Is it possible via a reply to GST_QUERY_ALLOCATION from the downstream
> appsink (or other)?
>

You can and should implement the allocation query using a pad probe. You
probably want to expose the videometa support, and set a minimum number of
buffers, be aware that the pool pointer can be left to null. Have a look at
kmscube software for some examples (only the meta though).

Is there a hidden way to configure the v42lsrc buffer pool size directly?
>
>
>
> Thanks
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20220923/3acabd3c/attachment.htm>


More information about the gstreamer-devel mailing list