Discussion:
gst_element_set_state hangs
Jianchun Zhou
2011-04-13 09:41:18 UTC
Permalink
hi, guys:

A problem has been troubling me a lot for quite a period of time.

when I use gstreamer to play an online radio stream, it blocks on
gst_element_set_state(play,
GST_STATE_PLAYING);
the application hangs and has no response. my system is Ubuntu 10.10 LTS.

the attached is my source code, the url mms://live.cbg.cn/yinyue is the one
blocks, and the other one can play.

anybody can shed some light for me, how can I return from the setting state
operation immediately?

thanks in advance.
--
Best Regards
Julien Moutte
2011-04-13 10:40:19 UTC
Permalink
Depending on the element in the pipeline which will handle the URI you are
trying to play, the state change call can be blocking on network access.

For example libneon HTTP source will change state in a synchronous way and
block the _set_state function whereas libsoup will do this asynchronously.

I guess the same happens to you here, the mms src element is probably doing
stuff synchronously in the state change function and blocks your
application's main thread.

You can either call the set_state function in a deferred thread or try to
improve the element so that the state change is not blocking so much.

Hope this helps,

Best regards,

Julien Moutte
CTO
Fluendo
San Francisco, USA & Barcelona, SPAIN
Tel BCN. +34 933 175 153
Tel USA. +1 415 773 5353

www.fluendo.com & www.moovida.com

P *Please consider the environment before printing this e-mail.*
Post by Jianchun Zhou
A problem has been troubling me a lot for quite a period of time.
when I use gstreamer to play an online radio stream, it blocks on gst_element_set_state(play,
GST_STATE_PLAYING);
the application hangs and has no response. my system is Ubuntu 10.10 LTS.
the attached is my source code, the url mms://live.cbg.cn/yinyue is the
one blocks, and the other one can play.
anybody can shed some light for me, how can I return from the setting state
operation immediately?
thanks in advance.
--
Best Regards
_______________________________________________
gstreamer-devel mailing list
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Johan Thelin
2011-04-13 11:25:45 UTC
Permalink
libmms tries to contact the server blocking, and it waits for a header
(still blocking). I posted a patch that fixes the
hack-on-initial-contact-issue last week, but I have not had the time
to take out all the blocking parts of the mms src element.

Johan Thelin
Post by Julien Moutte
Depending on the element in the pipeline which will handle the URI you are
trying to play, the state change call can be blocking on network access.
For example libneon HTTP source will change state in a synchronous way and
block the _set_state function whereas libsoup will do this asynchronously.
I guess the same happens to you here, the mms src element is probably doing
stuff synchronously in the state change function and blocks your
application's main thread.
You can either call the set_state function in a deferred thread or try to
improve the element so that the state change is not blocking so much.
Hope this helps,
Best regards,
Julien Moutte
CTO
Fluendo
San Francisco, USA & Barcelona, SPAIN
Tel BCN. +34 933 175 153
Tel USA. +1 415 773 5353
www.fluendo.com & www.moovida.com
P Please consider the environment before printing this e-mail.
Post by Jianchun Zhou
A problem has been troubling me a lot for quite a period of time.
when I use gstreamer to play an online radio stream, it blocks on
gst_element_set_state(play, GST_STATE_PLAYING);
the application hangs and has no response. my system is Ubuntu 10.10 LTS.
the attached is my source code, the url mms://live.cbg.cn/yinyue is the
one blocks, and the other one can play.
anybody can shed some light for me, how can I return from the setting
state operation immediately?
thanks in advance.
--
Best Regards
_______________________________________________
gstreamer-devel mailing list
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
--
Johan Thelin M.Sc.E.E.
Senior Software Developer

Pelagicore AB
Ekelundsgatan 4, 6tr, SE-411 18 Gothenburg, Sweden
Mobile: +46 (0)700 900 250
Skype: jothpelagicore
E-Mail: ***@pelagicore.com
Loading...