V4l2dec and v4l2enc in dmabuf-importmode

Arindam Biswas via gstreamer-devel <[email protected]> Tue, 3 Oct 2023 16:19:14 +0530
Newsgroups gmane.comp.video.gstreamer.devel
Message-ID <CAJNYu6gKVL0HP7VnP23c1hxMLuNCP3PgRTW-msv52P3QAS1VbA@mail.gmail.com>
Hi All,


I am working on a v4l2 decoder and encoder which works on dmabuf-import
mode on both capture and output interface.



But it is evident from the log that v4l2encoder throws error  if downstream
plugin does not provide a pool



example pipeline : gst-launch-1.0 videotestsrc ! v4l2h264enc
capture-io-mode=5 output-io-mode=5 ! fakesink



*gst_v4l2_object_decide_allocation:<v4l2h264enc0> error: When importing
DMABUF or USERPTR, we need a pool to import from*







Similarly in case of decoder also if upstream plugin pushes non-fd buffer
then pipeline throws error dmabuf import failed.



example pipeline : gst-launch-1.0 filesrc location=/1.mp4 ! qtdemux !
h264parse ! v4l2h264dec capture-io-mode=5 output-io-mode=5 ! fakesink



*gst_v4l2_allocator_import_dmabuf:<v4l2h264dec0:pool0:sink:allocator>
Memory 0 is not of DMABUF*

*v4l2bufferpool
gstv4l2bufferpool.c:396:gst_v4l2_buffer_pool_import_dmabuf:<v4l2h264dec0:pool0:sink>
failed to import dmabuf*



What is the recommendation to handle such cases?



1. Implement a two separate gstreamer plugins which generates dma buffers,
for example predmabufgen and postdmabufgen in the following examples



Example Pipeline:



gst-launch-1.0 filesrc location=/1.mp4 ! qtdemux ! h264parse !
*predmabufgen*  v4l2h264dec capture-io-mode=5 output-io-mode=5 !
*postdmabufgen* ! fakesink

gst-launch-1.0 videotestsrc ! *predmabufgen* ! v4l2h264enc
capture-io-mode=5 output-io-mode=5 ! *postdmabufgen* ! fakesink



2. Allocate dmabuf in the v4l2dec/v4l2enc plugin in case of dmabuf-import
if downstream is not providing a pool or upstream plugin is snot sending fd
buffer?


Thanks

Arindam
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.