Trouble getting appsrc to work

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Trouble getting appsrc to work

Soebirk, Thorsten Nordholm

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

 


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

RE: Trouble getting appsrc to work

Soebirk, Thorsten Nordholm

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:[hidden email]] On Behalf Of Soebirk, Thorsten
Sent: 23 June 2020 10:35
To: Discussion of the development of and with GStreamer <[hidden email]>
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

 


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Trouble getting appsrc to work

Tim Müller
On Wed, 2020-06-24 at 06:12 +0000, Soebirk, Thorsten wrote:

Hi Thorsten,
 
> 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.

I think the key difference is probably the format=3 which means that
appsrc will send a segment event in TIME format, which is what
downstream elements expect for raw audio. By default appsrc will
operate in BYTE format.

Cheers
 Tim

--
Tim Müller, Centricular Ltd - http://www.centricular.com

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel