Request pipeline terminate from pulsesink

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

Request pipeline terminate from pulsesink

GStreamer-devel mailing list
Hi,

I need to stop my pipeline from a pulsesink element, whenever pulseaudio sends a custom defined stream event.
I able to get the event from pulseaudio in the callback - gst_pulsering_stream_event_cb (https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/blob/master/ext/pulse/pulsesink.c#L789)
I am looking for the proper way to get the pipeline terminated upon getting the event from pulseaudio
I am thinking of two options :
1. send EOS from the pulsesink/basesink and use the EOS event in the application bus callback to stop the pipeline
2. post NULL state msg request to the bus (like how PAUSED is posted upon CORK stream event currently)
I am not sure if the clean up will be proper with the above two ways.
Is there any better way for the sink elements to request for termination of the pipeline?

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

Re: Request pipeline terminate from pulsesink

GStreamer-devel mailing list
Le jeudi 20 mai 2021 à 13:03 +0530, Tarun Tej K via gstreamer-devel a écrit :

> Hi,
>
> I need to stop my pipeline from a pulsesink element, whenever pulseaudio sends
> a custom defined stream event.
> I able to get the event from pulseaudio in the callback -
> gst_pulsering_stream_event_cb (    
> https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/blob/master/ext/pulse/pulsesink.c#L789
> )
> I am looking for the proper way to get the pipeline terminated upon getting
> the event from pulseaudio
> I am thinking of two options :
> 1. send EOS from the pulsesink/basesink and use the EOS event in the
> application bus callback to stop the pipeline

This is not really doable from a streaming thread.

> 2. post NULL state msg request to the bus (like how PAUSED is posted upon CORK
> stream event currently)
> I am not sure if the clean up will be proper with the above two ways.
> Is there any better way for the sink elements to request for termination of
> the pipeline?

Perhaps we could have some generic kind of message. So you'd be sending a custom
pulse audio message with the string from the pulse event type. This allow for
"custom" work like yours without changing the element. The application take care
of doing the right thing.

> _______________________________________________
> 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: Request pipeline terminate from pulsesink

GStreamer-devel mailing list
On Thu, May 20, 2021 at 6:27 PM Nicolas Dufresne <[hidden email]> wrote:

>
> Le jeudi 20 mai 2021 à 13:03 +0530, Tarun Tej K via gstreamer-devel a écrit :
> > Hi,
> >
> > I need to stop my pipeline from a pulsesink element, whenever pulseaudio sends
> > a custom defined stream event.
> > I able to get the event from pulseaudio in the callback -
> > gst_pulsering_stream_event_cb (
> > https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/blob/master/ext/pulse/pulsesink.c#L789
> > )
> > I am looking for the proper way to get the pipeline terminated upon getting
> > the event from pulseaudio
> > I am thinking of two options :
> > 1. send EOS from the pulsesink/basesink and use the EOS event in the
> > application bus callback to stop the pipeline
>
> This is not really doable from a streaming thread.
>
> > 2. post NULL state msg request to the bus (like how PAUSED is posted upon CORK
> > stream event currently)
> > I am not sure if the clean up will be proper with the above two ways.
> > Is there any better way for the sink elements to request for termination of
> > the pipeline?
>
> Perhaps we could have some generic kind of message. So you'd be sending a custom
> pulse audio message with the string from the pulse event type. This allow for
> "custom" work like yours without changing the element. The application take care
> of doing the right thing.

Since the requirement is to terminate the pipeline, we have used the
custom message and tried by setting the pipeline to NULL in the bus
callback but it seems to be resulting a deadlock.
Is it recommended to put the pipeline to null from bus callback or
should we use some async call?
>
>
> > _______________________________________________
> > 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: Request pipeline terminate from pulsesink

GStreamer-devel mailing list
Le jeudi 20 mai 2021 à 19:25 +0530, Tarun Tej K a écrit :

> On Thu, May 20, 2021 at 6:27 PM Nicolas Dufresne <[hidden email]> wrote:
> >
> > Le jeudi 20 mai 2021 à 13:03 +0530, Tarun Tej K via gstreamer-devel a écrit :
> > > Hi,
> > >
> > > I need to stop my pipeline from a pulsesink element, whenever pulseaudio sends
> > > a custom defined stream event.
> > > I able to get the event from pulseaudio in the callback -
> > > gst_pulsering_stream_event_cb (
> > > https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/blob/master/ext/pulse/pulsesink.c#L789
> > > )
> > > I am looking for the proper way to get the pipeline terminated upon getting
> > > the event from pulseaudio
> > > I am thinking of two options :
> > > 1. send EOS from the pulsesink/basesink and use the EOS event in the
> > > application bus callback to stop the pipeline
> >
> > This is not really doable from a streaming thread.
> >
> > > 2. post NULL state msg request to the bus (like how PAUSED is posted upon CORK
> > > stream event currently)
> > > I am not sure if the clean up will be proper with the above two ways.
> > > Is there any better way for the sink elements to request for termination of
> > > the pipeline?
> >
> > Perhaps we could have some generic kind of message. So you'd be sending a custom
> > pulse audio message with the string from the pulse event type. This allow for
> > "custom" work like yours without changing the element. The application take care
> > of doing the right thing.
>
> Since the requirement is to terminate the pipeline, we have used the
> custom message and tried by setting the pipeline to NULL in the bus
> callback but it seems to be resulting a deadlock.
> Is it recommended to put the pipeline to null from bus callback or
> should we use some async call?

Don't use a sync_message handler to change your pipeline state. Use an async
handler (though gst_bus_pop, or glib mainloop integration).

> >
> >
> > > _______________________________________________
> > > 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