Can gst_element_set_state() block?

There is no mention about this in the API.

The call blocks while trying to play files on 'smb://' when there are network issues.

Thanks!

It depends on your pipeline and specifically which elements are used. If there are elements that are doing blocking operations during the given state change, then the function would block for a while.

1 Like

So, why not make the code within 'gst_element_set_state ()' async always, and tell the user to look for 'GST_MESSAGE_STATE_CHANGED' message on the bus.

Thanks!

That’s one of the things I want to do for GStreamer 2.0 (whenever that happens): make all state changes async, always.

But that’s not how things are currently. If you need state changes to happen asynchronously then you need to do them from a different thread. Depending on the language you’re using, this can be trivial or a bit more work.

gst_element_call_async() (which uses a threadpool) can be used for this, for example.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.