Element that plays silence when stream stops?

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

Element that plays silence when stream stops?

saepia
Hello,

I am developing an app in which I use shmsink/shmsrc to communicate between processes. They send audio to each other.

If data in the sender is not flowing (e.g. I fetch file over HTTP and the transfer is temporarily stopped) the shmsrc also stops, as there's no data to consume.

I would prefer that it keeps going and playing silence. Is there any element for this? (maybe audiorate?)

Marcin

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

Re: Element that plays silence when stream stops?

Nicolas Dufresne-4
Le mercredi 06 juillet 2016 à 13:13 +0200, [hidden email] a écrit :
> I am developing an app in which I use shmsink/shmsrc to communicate
> between processes. They send audio to each other.
>
> If data in the sender is not flowing (e.g. I fetch file over HTTP and
> the transfer is temporarily stopped) the shmsrc also stops, as
> there's no data to consume.
>
> I would prefer that it keeps going and playing silence. Is there any
> element for this? (maybe audiorate?)

It's not designed for this, though if your pipeline is live, audiomixer
will keep producing even if the source(s) stops. This only works with
live sources, so maybe use it in front of shmsrc ?

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

signature.asc (188 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Element that plays silence when stream stops?

Tim Müller
In reply to this post by saepia
On Wed, 2016-07-06 at 13:13 +0200, [hidden email] wrote:

Hi,

> I am developing an app in which I use shmsink/shmsrc to communicate
> between processes. They send audio to each other.
>
> If data in the sender is not flowing (e.g. I fetch file over HTTP and
> the transfer is temporarily stopped) the shmsrc also stops, as
> there's no data to consume.
>
> I would prefer that it keeps going and playing silence. Is there any
> element for this? (maybe audiorate?)

Simplest way might be to just do

 ... ! interaudiosink

interaudiosrc ! shmsink

(in which case interaudiosrc will keep producing silence even if you
stop feeding data into interaudiosink)

Other than what Nicolas already suggested, you could also write a
GstAudioSink baseclass that outputs data via shm, in that case the
audiosink/ringbuffer will keep writing silence samples if no data
arrives (assuming the pipeline stays in playing state).

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
Reply | Threaded
Open this post in threaded view
|

Re: Element that plays silence when stream stops?

saepia
Thank Tim,

as far as I see interaudiosrc can be used to communicate within one process, not between two separate processes? I need to do inter-process communication. Effectively I need to achieve what interaudiosrc/sink does but between processes.

m.

2016-07-06 15:02 GMT+02:00 Tim Müller <[hidden email]>:
On Wed, 2016-07-06 at 13:13 +0200, [hidden email] wrote:

Hi,

> I am developing an app in which I use shmsink/shmsrc to communicate
> between processes. They send audio to each other.
>
> If data in the sender is not flowing (e.g. I fetch file over HTTP and
> the transfer is temporarily stopped) the shmsrc also stops, as
> there's no data to consume.
>
> I would prefer that it keeps going and playing silence. Is there any
> element for this? (maybe audiorate?)

Simplest way might be to just do

 ... ! interaudiosink

interaudiosrc ! shmsink

(in which case interaudiosrc will keep producing silence even if you
stop feeding data into interaudiosink)

Other than what Nicolas already suggested, you could also write a
GstAudioSink baseclass that outputs data via shm, in that case the
audiosink/ringbuffer will keep writing silence samples if no data
arrives (assuming the pipeline stays in playing state).

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


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

Re: Element that plays silence when stream stops?

saepia
In reply to this post by Nicolas Dufresne-4
Thanks Nicolas,

how is it going to determine "liveness" of the sources? My livemixer is preceeded by multiqueue, and each source is wrapped in the bin. Source itself (shmsrc) has is-live set to true - is it enough?

Marcin

2016-07-06 14:40 GMT+02:00 Nicolas Dufresne <[hidden email]>:
Le mercredi 06 juillet 2016 à 13:13 +0200, [hidden email] a écrit :
> I am developing an app in which I use shmsink/shmsrc to communicate
> between processes. They send audio to each other.
>
> If data in the sender is not flowing (e.g. I fetch file over HTTP and
> the transfer is temporarily stopped) the shmsrc also stops, as
> there's no data to consume.
>
> I would prefer that it keeps going and playing silence. Is there any
> element for this? (maybe audiorate?)

It's not designed for this, though if your pipeline is live, audiomixer
will keep producing even if the source(s) stops. This only works with
live sources, so maybe use it in front of shmsrc ?

Nicolas

_______________________________________________
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: Element that plays silence when stream stops?

Tim Müller
In reply to this post by saepia
On Wed, 2016-07-06 at 20:23 +0200, [hidden email] wrote:

Hi,

> as far as I see interaudiosrc can be used to communicate within one
> process, not between two separate processes? I need to do inter-
> process communication. Effectively I need to achieve what
> interaudiosrc/sink does but between processes. 

Yes, I'm aware of that. My suggestion was to use interaudiosink/src in
the same process and then to send the audio to the other process with
shmsink.

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
Reply | Threaded
Open this post in threaded view
|

Re: Element that plays silence when stream stops?

Nicolas Dufresne-5
In reply to this post by saepia
Le mercredi 06 juillet 2016 à 20:21 +0200, [hidden email] a écrit :
> how is it going to determine "liveness" of the sources? My livemixer
> is preceeded by multiqueue, and each source is wrapped in the bin.
> Source itself (shmsrc) has is-live set to true - is it enough?

Should be enough. Audiomixer will run an latency query (toward
sources), and look at the "live" boolean in it.

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

signature.asc (188 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Element that plays silence when stream stops?

saepia
In reply to this post by Tim Müller

Ah ok I got the point now. Smart!

M.

06.07.2016 9:58 PM "Tim Müller" <[hidden email]> napisał(a):
On Wed, 2016-07-06 at 20:23 +0200, [hidden email] wrote:

Hi,

> as far as I see interaudiosrc can be used to communicate within one
> process, not between two separate processes? I need to do inter-
> process communication. Effectively I need to achieve what
> interaudiosrc/sink does but between processes. 

Yes, I'm aware of that. My suggestion was to use interaudiosink/src in
the same process and then to send the audio to the other process with
shmsink.

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

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