How to set streamheader in caps of appsrc? | OPUS

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

How to set streamheader in caps of appsrc? | OPUS

jeyp4
This post was updated on .
Hi

I want to use appsrc as opussrc.
I have set the all caps parameters

caps = gst_caps_new_simple("audio/x-opus",
                                       "rate", G_TYPE_INT, 16000,
                                       "channels", G_TYPE_INT, 1,
                                       "channel-mapping-family", G_TYPE_INT, 0,
                                       "stream-count", G_TYPE_INT, 1,
                                       "coupled-count", G_TYPE_INT, 0,
                                       NULL
                                       );


But I think I have to set streamheader also, in order to avoid using
opusparse. Because parsing may result in being a source of latency.

I can know the stream headers by just a simple command line.

gst-launch-1.0 pulsesrc buffer-time=20000 ! opusenc frame-size=20 ! opusdec ! pulsesink buffer-time=20000 -v

/GstPipeline:pipeline0/GstOpusEnc:opusenc0.GstPad:src: caps = "audio/x-opus\,\ rate\=\(int\)16000\,\ channels\=\(int\)1\,\channel-mapping-family\=\(int\)0\,\ stream-count\=\(int\)1\,\ coupled-count\=\(int\)0\,\ streamheader\=\(buffer\)\<\4f7075734865616401013801803e0000000000\,\4f707573546167731e000000456e636f6465642077697468204753747265616d6572206f707573656e630000000001\ \>"


So, the stream headers are: 4f7075734865616401013801803e0000000000,
4f707573546167731e000000456e636f6465642077697468204753747265616d6572206f707573656e630000000001.

How can I set these in appsrc's caps?



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to set streamheader in caps of appsrc? | OPUS

jeyp4
This post was updated on .
I found the easy hack

caps = gst_caps_from_string("audio/x-opus, rate=(int)16000, channels=(int)1, channel-mapping-family=(int)0, "
                                               "stream-count=(int)1, coupled-count=(int)0, streamheader=(buffer)< 4f70757348"
                                               "65616401013801803e0000000000, "
                                               "4f707573546167731e000000456e636f646564207769746"
                                               "8204753747265616d6572206f707573656e630000000001 >");


But still without opusparse element, pipeline throws error

Error received from element app_source: Internal data flow error.
Debugging information: gstbasesrc.c(2948): gst_base_src_loop ():
/GstPipeline:app_pipeline/GstAppSrc:app_source:
streaming task paused, reason error (-5)




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to set streamheader in caps of appsrc?

Nicolas Dufresne-5
In reply to this post by jeyp4


Le sam. 22 févr. 2020 17 h 00, jeyp4 <[hidden email]> a écrit :
Hi

I want to use appsrc as opussrc.
I have set the all caps parameters
caps = gst_caps_new_simple("audio/x-opus",
                                       "rate", G_TYPE_INT, 16000,
                                       "channels", G_TYPE_INT, 1,
                                       "channel-mapping-family", G_TYPE_INT,
0,
                                       "stream-count", G_TYPE_INT, 1,
                                       "coupled-count", G_TYPE_INT, 0,
                                       NULL
                                       );

But I think I have to set streamheader also, in order to avoid using
opusparse. Because parsing may result in being a source of latency.

I can know the stream headers by just simple command line.
gst-launch-1.0 pulsesrc buffer-time=20000 ! opusenc frame-size=20 ! opusdec
! pulsesink buffer-time=20000 -v

/GstPipeline:pipeline0/GstOpusEnc:opusenc0.GstPad:src: caps =
"audio/x-opus\,\ rate\=\(int\)16000\,\
channels\=\(int\)1\,\channel-mapping-family\=\(int\)0\,\
stream-count\=\(int\)1\,\ coupled-count\=\(int\)0\,\
streamheader\=\(buffer\)\<\4f7075734865616401013801803e0000000000\,\4f707573546167731e000000456e636f6465642077697468204753747265616d6572206f707573656e630000000001\
\>"

So, the stream headers are: 4f7075734865616401013801803e0000000000,
4f707573546167731e000000456e636f6465642077697468204753747265616d6572206f707573656e630000000001.

How can I set these in appsrc's caps?

You need a GstBuffer, propably use new and allocate helper. The you have to write this data in. You could also use an guint8 array, with the data in hex, then use new wrap helper.




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

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

Re: How to set streamheader in caps of appsrc? | OPUS

Nicolas Dufresne-5
In reply to this post by jeyp4


Le sam. 22 févr. 2020 18 h 00, jeyp4 <[hidden email]> a écrit :
I found the easy hack

caps = gst_caps_from_string("audio/x-opus, rate=(int)16000, channels=(int)1,
channel-mapping-family=(int)0,"
                                        " stream-count=(int)1,
coupled-count=(int)0, streamheader=(buffer)< 4f70757348"
                                        "65616401013801803e0000000000,
4f707573546167731e000000456e636f646564207769746"

"8204753747265616d6572206f707573656e630000000001 >");

But still without opusparse element, pipeline throws error
Error received from element app_source: Internal data flow error.
Debugging information: gstbasesrc.c(2948): gst_base_src_loop ():
/GstPipeline:app_pipeline/GstAppSrc:app_source:
streaming task paused, reason error (-5)

It's probably badly framed data. Why don't you want to use the parser?




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

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

Re: How to set streamheader in caps of appsrc? | OPUS

jeyp4
This post was updated on .
I am trying to avoid opusparse.

I am suspecting introduction of parser will result in a delay in pipeline. And for live streaming, I am trying to keep delay as least as possible.

I am pushing opusenc encoded data in appsrc. I tried to match appsrc's caps with opusenc's caps.

My complete pipeline without appsink-appsrc looks like.

gst-launch-1.0 pulsesrc buffer-time=20000 ! audio/x-raw, channels=1 ! opusenc frame-size=20 bitrate=24000 ! opusdec ! pulsesink buffer-time=20000




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to set streamheader in caps of appsrc? | OPUS

Nicolas Dufresne-5


Le dim. 23 févr. 2020 02 h 45, jeyp4 <[hidden email]> a écrit :
I am trying to avoid opusparse.

I am suspecting introduction of parser will result in a delay in pipeline.

Although can't measure if there is any delay introduced.

It should not introduce delays if the input is framed.


I am pushing opusenc encoded data in appsrc. I tried to match appsrc's caps
with opusenc's caps.

My complete pipeline without appsink-appsrc looks like.
gst-launch-1.0 pulsesrc buffer-time=20000 ! audio/x-raw, channels=1 !
opusenc frame-size=20 bitrate=24000 ! opusdec ! pulsesink buffer-time=20000



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

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

Re: How to set streamheader in caps of appsrc? | OPUS

jeyp4
Ok

Thank you for confirming.



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel