Is gst_element_set_state(pipe, GST_STATE_NULL) needed when destructing and unref a pipeline

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

Is gst_element_set_state(pipe, GST_STATE_NULL) needed when destructing and unref a pipeline

Nick_law
Afternoon,

I have run into an issue with gstreamer hanging during:

gst_element_set_state(pipeline, GST_STATE_NULL);

I am pretty sure this is due to another process having the filesink location
still open as a fifo.
We use gstreamer to write to a previously created fifo and have found that
if other processes still have the fifo open then when trying to destruct and
unref the pipeline, it hangs.

        if (pipeline != nullptr) {
                gst_element_set_state(pipeline, GST_STATE_NULL);
                gst_object_unref(pipeline);
        }

If I just remove the gst_element_set_state(pipeline, GST_STATE_NULL);
and only call
gst_object_unref(pipeline);

it doesn't hang and seems to be able to deconstruct and start up new
pipelines without issue.

but every tutorial I read and example code, always sets the element state to
GST_STATE_NULL before unref.

So I'm wondering why and if it's even necessary?

Kind regards
Nick



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

Re: Is gst_element_set_state(pipe, GST_STATE_NULL) needed when destructing and unref a pipeline

Thibault Saunier-4
Hello,

It is necessary to set the pipeline state to NULL before destroying it, it is an API requirement.

- Thibault

On Fri, Feb 26, 2021 at 10:24 AM Nick_law <[hidden email]> wrote:
Afternoon,

I have run into an issue with gstreamer hanging during:

gst_element_set_state(pipeline, GST_STATE_NULL);

I am pretty sure this is due to another process having the filesink location
still open as a fifo.
We use gstreamer to write to a previously created fifo and have found that
if other processes still have the fifo open then when trying to destruct and
unref the pipeline, it hangs.

        if (pipeline != nullptr) {
                gst_element_set_state(pipeline, GST_STATE_NULL);
                gst_object_unref(pipeline);
        }

If I just remove the gst_element_set_state(pipeline, GST_STATE_NULL);
and only call
gst_object_unref(pipeline);

it doesn't hang and seems to be able to deconstruct and start up new
pipelines without issue.

but every tutorial I read and example code, always sets the element state to
GST_STATE_NULL before unref.

So I'm wondering why and if it's even necessary?

Kind regards
Nick



--
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: Is gst_element_set_state(pipe, GST_STATE_NULL) needed when destructing and unref a pipeline

Nick_law
This post was updated on .
Thanks I thought as much,

In that case is there anyway to force the state change or stop it from
hanging?

It seems wrong that gst_element_set_state() can hang indefinitely  

-Nick


Thibault Saunier-4 wrote
> Hello,
>
> It is necessary to set the pipeline state to NULL before destroying it, it
> is an API requirement.
>
> - Thibault





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