Shmsink wait-for-connection=false

Hello, I have two test pipelines that use shmsrc and shmsink plugin. I cannot get shmsrc to connect to shmsink when wait-for-connection=false. The pipelines work if I set wait-for-connection=true (default value).

Is there a way, perhaps through setting some caps, to get the pipeline to work with wait-for-connection=false?

shared memory writer pipeline:

gst-launch-1.0 -vvv videotestsrc is-live=true do-timestamp=true ! video/x-raw,framerate=30/1,width=1280,height=720,format=I420 ! gdppay ! shmsink socket-path=/tmp/test.sock wait-for-connection=false

shared memory reader pipeline:

gst-launch-1.0 -vvv shmsrc is-live=true do-timestamp=false socket-path=/tmp/test.sock ! gdpdepay ! queue ! video/x-raw,framerate=30/1,width=1280,height=720,format=I420 ! videoconvert ! matroskamux ! filesink location=test.mkv

Here are the warnings on shmsrc side when wait-for-connection=false:

New clock: GstSystemClock
0:00:00.077888822 19697   0x55be60f280 WARN                gdpdepay gstgdpdepay.c:490:gst_gdp_depay_chain:<gdpdepay0> error: Received a buffer without first receiving caps
0:00:00.078181848 19697   0x55be60f280 WARN                 basesrc gstbasesrc.c:3055:gst_base_src_loop:<shmsrc0> error: Internal data stream error.
0:00:00.078244454 19697   0x55be60f280 WARN                 basesrc gstbasesrc.c:3055:gst_base_src_loop:<shmsrc0> error: streaming stopped, reason not-negotiated (-4)
ERROR: from element /GstPipeline:pipeline0/GstGDPDepay:gdpdepay0: Could not decode stream.

Thank you in advance!

The way shmsink currently is written is not compatible with the GDP elements. We need to add some logic in shmsink to send the “streamheader” part of the caps as the first buffer when a new client connects and it should fix it.

In your example, you can make it work by dropping GDP

No, not really, I tried replacing GDP by matroskamux streamable=true and using matroskademux and same issue appears with wait-forconnection=false. Any other existing plugin suggestion to searialzie/desearialize GstBuffer across shmem? Should this case be logged as a streamheader bug or improvement? Thank you.

You need a format where there is no header at the start, for example, MPEG-TS. If you want to support any format that requires some kind of header, then you need to implement the streamheader support in shmsink, it should actually be relatively easy to do.

I am dealing with video/x-raw (raw video frames) in shared memory would MPEG-TS actually work? Thanks

Please try this merge request, it should fix your problem!