Trouble getting appsrc to work

Soebirk, Thorsten Thorsten.Sobirk at itelligence.dk
Wed Jun 24 06:12:33 UTC 2020


After some sparring with a colleague and some further trial and error, I was able solve this issue. Posting here for posterity ;-)

In my original question, I had left out some pipeline details that turned out to be key. Here are the first elements of my pipeline (truncated to just the relevant pieces) that had the error:

appsrc name=audio-src caps=audio/x-raw,rate=16000,channels=1,format=S16LE,layout=interleaved stream-type=stream block=true do-timestamp=true is-live=true ! queue

Notice that it specifies all the caps on the appsrc element itself. The solution was to move these to a separate capsfilter following the appsrc slement:


appsrc name=audio-src format=3 is-live=1 do-timestamp=1 ! audio/x-raw, channels=1, rate=16000, format=S16LE, layout=interleaved ! queue

I won't pretend to understand what the difference is, since I'm still quite new to GStreamer. If anyone has a good explanation, I'd love to hear it.

Best regards,
Thorsten

From: gstreamer-devel [mailto:gstreamer-devel-bounces at lists.freedesktop.org] On Behalf Of Soebirk, Thorsten
Sent: 23 June 2020 10:35
To: Discussion of the development of and with GStreamer <gstreamer-devel at lists.freedesktop.org>
Subject: Trouble getting appsrc to work

Hi,

I am working on a custom appsrc that produces audio and will ultimately stream it via webrtcbin. The pipeline looks like this (some details left out for clarity):

appsrc ! queue ! opusenc ! rtpopuspay ! queue ! capsfilter

It gets connected to webrtcbin in my code. The pipeline starts up correctly and begins playing, but as soon as appsrc.push_buffer is called, GStreamer throws the following errors.


GStreamer-WARNING **: 09:53:28.785: ../gst/gstpad.c:4551:gst_pad_push_data:<opusenc0:src> Got data flow before segment event

GStreamer-WARNING **: 09:53:28.785: ../gst/gstpad.c:4298:gst_pad_chain_data_unchecked:<rtpopuspay0:sink> Got data flow before segment event

GStreamer-CRITICAL **: 09:53:28.785: gst_segment_to_running_time: assertion 'segment->format == format' failed

GStreamer-WARNING **: 09:53:28.785: ../gst/gstpad.c:4551:gst_pad_push_data:<rtpopuspay0:src> Got data flow before segment event


I have tried replacing my appsrc with audiotestsrc, and in this case the pipeline works and there are no errors.

I have tried troublehooting by replacing elements with fakesink, e.g. "appsrc ! fakesink", "appsrc ! queue ! opusenc ! fakesink", etc. The errors start occurring when rtpopuspay appears in the pipeline.

I have tried sending a SEGMENT event before calling push_buffer, but this doesn't change anything. Admittedly, I am not sure how to populate the SEGMENT event if it is relevant. I looked through the source code of audiotestsrc, and as far as I can tell, it does not send a SEGMENT event.

Can anyone see what I am doing wrong?

Best regards,
Thorsten

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20200624/321b64a1/attachment.htm>


More information about the gstreamer-devel mailing list