Re: Does `shmsrc` / `shmsink` have a "stable" protocol?

Greg Kennedy via gstreamer-devel <[email protected]>
Newsgroups gmane.comp.video.gstreamer.devel
Message-ID <CAN1+P_1Xdoq-dEB+wPGWrgUoFY6PkfyvBAnL2kQq334Aki8vhA@mail.gmail.com>
Okay, this is very helpful!  I had not seen shmpipe before but it's
exactly what I am looking for.

I do see that shmsrc tends to be followed by a caps filter and it
doesn't seem possible for shmsink to tell shmsrc what caps to use.
The proposed unixfdsrc / sink DOES have a command for sending caps -
would be useful.  One option might be to further wrap it in gdp
payload format and follow shmsrc with a gdpdepay to be able to send
additional commands across shm.

I think I have enough info to proceed now, thanks again for your reply!

On Mon, Sep 18, 2023 at 2:25 PM Nicolas Dufresne <[email protected]> wrote:
>
> Hi Greg,
>
> Le dimanche 17 septembre 2023 à 13:18 -0500, Greg Kennedy via gstreamer-devel a
> écrit :
> > I am trying to write an app that inserts frames into an external
> > gstreamer pipeline, but without marshalling through a socket or
> > container format.  I hit upon the idea of sharing the framebuffer via
> > shm IPC, avoiding a copy entirely.
> >
> > So I considered writing a plugin for this, but it occurred to me that
> > there is already shmsrc in plugins-bad, and it does exactly what I
> > would want: getting frames from shared mem and pushing them into a
> > pipeline, plus supporting other gstreamer features like changing caps
> > midstream.
> >
> > Normally of course shmsrc needs a matching shmsink; my question is
> > somewhat of a hack but I am curious if this could work:
> >
> > * Modify my app to "look like" an shmsink - exposing framebuffer and
> > control info just like shmsink would
>
> Inside the plugin gode, there is a BSD licence part for that purpose.
>
> https://gitlab.freedesktop.org/gstreamer/gstreamer/-/blob/main/subprojects/gst-plugins-bad/sys/shm/shmpipe.h?ref_type=heads
> https://gitlab.freedesktop.org/gstreamer/gstreamer/-/blob/main/subprojects/gst-plugins-bad/sys/shm/shmalloc.h?ref_type=heads
>
> And same for their associated .c files. Typically one would copy that into their
> project and use it.
>
> > * Run a pipeline with shmsrc reading from my app's masquerading interface
> >
> > I am curious how "stable" the interface is between shmsrc / shmsink.
> > If it changes frequently, this will be fragile - but if it's
> > well-defined, then I should be able to do it, and maybe it could be
> > documented (or spun off into a header) so others can do the same.
>
> -bad repo has unstable API, but we have never changed it in 10 years, mostly
> because of the fact that it may be used in some third party software. For a
> modern approach to this, Xavier posted this recently:
>
> https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5328
>
> This is similar, but the approach is different, there is FDs per buffer/memory,
> this allow passing through DMAbuf and/or other already FD located content.
>
> >
> > Thoughts?
>
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.