Search code examples
gstreamergoogle-coral

Why is gStreamer throwing an error from waylandsink?


I'm working on the Smart Birdfeeder project (https://github.com/google-coral/project-birdfeeder) When running birdfeeder.sh with Coral camera on the Dev Board, I get:

** (python3:3933): CRITICAL **: 16:37:50.961: Failed to flush Wayland connection

The error streams up in the Terminal window and overwhelms the output until I ^Z out of the program. The number following "python3:" is constant for a given run but will be different in different runs. If I plug a video monitor into the HDMI socket on the board and run the program, the real time image from the camera is shown in the monitor and if I hold a photo of a bird in front of the camera, the program works and an image from the camera is saved and the correct identification of the bird is written to the log file. Here is the pipeline code:

def run_pipeline(user_function,
                     src_size=(640,480),
                     appsink_size=(320, 180)):
        PIPELINE = 'v4l2src device=/dev/video0 ! {src_caps} ! {leaky_q}  ! tee name=t'
        if detectCoralDevBoard():

        # Test framerate of 1/1 on 200212 (line 69), then 10/1 back to 30/1

            SRC_CAPS = 'video/x-raw,format=YUY2,width={width},height={height},framerate=30/1'
            PIPELINE += """
                t. ! {leaky_q} ! glupload ! glfilterbin filter=glcolorscale
                   ! {dl_caps} ! videoconvert ! {sink_caps} ! {sink_element}
                t. ! {leaky_q} ! glupload ! glfilterbin filter=glcolorscale
                   ! rsvgoverlay name=overlay ! waylandsink
            """

I am inexperienced with gstreamer and could use any help. Thanks.


Solution

  • For everyone struggling to get GStreamer on Coral Dev-Board running in headless mode and without an active terminal session (registered as Systemd service or alike). There is one bad hack which I found (and which is now also included in newer Coral example code in a similar way):

    os.environ["XDG_RUNTIME_DIR"] = "/run/user/1000"
    

    Put this in the python code where you put together the GStreamer pipeline.

    Another thing I have seen in some Google code before was the injection of messages into the gstreamer bus to please the one element which asks out for the current display.