Quantcast

android gst_element_set_state hangs

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

android gst_element_set_state hangs

Jesse
Hello,everyone!

    I'm writing android app to play online video(rtmp live video),when the network is bad(maybe the router disconnected from internet), I call gst_element_set_state (data->pipeline, GST_STATE_PLAYING) on android UI thread and it will hangs about 20 seconds, this is not allowed on android because it will freeze
the app.so I need to call gst_element_set_state on a separated thread. I want to know if there is such a thread in GStreamer or I need to create it myself? what is the best practice?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: android gst_element_set_state hangs

Dimitrios Katsaros
I have no android experience but in c, gst_element_set_state has a timeout parameter. If you set it to 0 it should just issue the operation without causing the calling thread to hang.


dmt

On Wed, Mar 22, 2017 at 4:47 AM, Jesse <[hidden email]> wrote:
Hello,everyone!

    I'm writing android app to play online video(rtmp live video),when the
network is bad(maybe the router disconnected from internet), I call
gst_element_set_state (data->pipeline, GST_STATE_PLAYING) on android UI
thread and it will hangs about 20 seconds, this is not allowed on android
because it will freeze
the app.so I need to call gst_element_set_state on a separated thread. I
want to know if there is such a thread in GStreamer or I need to create it
myself? what is the best practice?



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/android-gst-element-set-state-hangs-tp4682329.html
Sent from the GStreamer-devel mailing list archive at 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
|  
Report Content as Inappropriate

Re: android gst_element_set_state hangs

Jesse
thank you for your reply,but I can't see the timeout parameter,the API is declared like this:
GstStateChangeReturn gst_element_set_state (GstElement *element,GstState state);
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: android gst_element_set_state hangs

Dimitrios Katsaros
wups, my bad, I was talking about gst_element_get_state. Is the hanging element one of your own or something in mainline? because state transitions with set are suppose to not leave the main thread hanging, at least from my understanding. Instead you should be receiving a GST_STATE_CHANGE_ASYNC. I think you can see an example of some threads handling state changes in camerabin under gst-plugins-bad. There is a "reset-element-thread" that resets elements in the pipeline via state transitions. However, my first course of action would be to figure out which element is causing the hang, since it may need a thread of it's own.

Dmt

On Thu, Mar 23, 2017 at 3:13 AM, Jesse <[hidden email]> wrote:
thank you for your reply,but I can't see the timeout parameter,the API is
declared like this:
GstStateChangeReturn gst_element_set_state (GstElement *element,GstState
state);



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/android-gst-element-set-state-hangs-tp4682329p4682363.html
Sent from the GStreamer-devel mailing list archive at 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
Loading...