shmsrc gst app pipeline stalling

mattes effemm at
Mon Apr 8 18:29:39 PDT 2013

I have a custom mixer that is serving a gstreamer recording pipeline via shm.
Typically the recorder is activated via shell script with gst-launch:

  gst-launch -e shmsrc socket-path=/tmp/mysock blocksize=40960 is-live=1
do-timestamp=1 !  \
width=640,height=480,framerate=30/1 !  \
      x264enc profile=2 speed-preset=1 ! qtmux ! filesink

This works and is functioning well.

I am currently writing a gstreamer app with the same functionality.
The app is able to record/encode from a V4l2 device. but when I switch to
the capture the frames via shmsrc it only works briefly and than stalls:

 Setting pipeline to PAUSED...
 Pipeline does not need PREROLL...
 Setting pipeline to PLAYING...
/GstPipeline:gstrecorder/GstIdentity:identit.GstPad:sink: caps =
video/x-raw-yuv, format=(string)I420, width=(int)640, height=(int)480,
/GstPipeline:gstrecorder/GstIdentity:identit: last-message = "chain   *******
(identit:sink) (460800 bytes, timestamp: 0:00:00.000000000, duration:
0:00:00.033333333, offset: 0, offset_end:  1, flags: 33 ro discont ) 0x8c79360"
/GstPipeline:gstrecorder/GstIdentity:identit: last-message = "chain   *******
(identit:sink) (460800 bytes, timestamp: 0:00:00.033333333, duration:
0:00:00.033333333, offset: 1, offset_end:  2, flags: 1 ro ) 0xb6b02020"

** (gstshm:30247): ERROR **:
 ERROR : Internal data flow error.

I found an error/warning when running  GST_DEBUG=5 :

0:00:01.748173633 30266  0x85df660 WARN                 basesrc
gstbasesrc.c:2625:gst_base_src_loop:<shmsrc> error: streaming task paused,
reason not-linked (-1)
0:00:01.748282586 30266  0x85df660 INFO        GST_ERROR_SYSTEM
gstelement.c:1964:gst_element_message_full:<shmsrc> posting message: Internal
data flow error.

Interestingly there is  no problem  with the  c code when using shmsrc with
fakesink, or display

      shmsrc ! videocaps ! fakesink
 or   shmsrc ! videocaps ! xvimagesink

I replaced my custom mixer with the following gst-launch pipeline to provide
frames instead, I am able to recreate the same problem:

    gst-launch -v videotestsrc ! \
       video/x-raw-yuv, width=640, height=480, framerate=30/1,
'format=(fourcc)I420' ! \
       shmsink socket-path=/tmp/mysock shm-size=10000000 wait-for-connection=0

Summary:   gst-launch pipeline works with shmsrc
           gstreamer c app does NOT work with shmsrc

I assume something is missing in my gstreamer C app. Something 'gst-launch'
does right, but not my app.

What is the trick with shmsrc?
Why does the same code work when using v4l2src?

If someone is interested in looking at the test code, it can be downloaded

Any pointers are appreciated.

More information about the gstreamer-devel mailing list